• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Chummer.ListItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Chummer.ListItem的典型用法代码示例。如果您正苦于以下问题:C# ListItem类的具体用法?C# ListItem怎么用?C# ListItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ListItem类属于Chummer命名空间,在下文中一共展示了ListItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: frmSelectExoticSkill_Load

        private void frmSelectExoticSkill_Load(object sender, EventArgs e)
        {
            XmlDocument objXmlDocument = new XmlDocument();
            objXmlDocument = XmlManager.Instance.Load("skills.xml");

            List<ListItem> lstSkills = new List<ListItem>();

            // Build the list of Exotic Active Skills from the Skills file.
            XmlNodeList objXmlSkillList = objXmlDocument.SelectNodes("/chummer/skills/skill[exotic = \"Yes\"]");
            foreach (XmlNode objXmlSkill in objXmlSkillList)
            {
                ListItem objItem = new ListItem();
                objItem.Value = objXmlSkill["name"].InnerText;
                if (objXmlSkill.Attributes != null)
                {
                    if (objXmlSkill["translate"] != null)
                        objItem.Name = objXmlSkill["translate"].InnerText;
                    else
                        objItem.Name = objXmlSkill["name"].InnerText;
                }
                else
                    objItem.Name = objXmlSkill["name"].InnerXml;
                lstSkills.Add(objItem);
            }
            SortListItem objSort = new SortListItem();
            lstSkills.Sort(objSort.Compare);
            cboCategory.ValueMember = "Value";
            cboCategory.DisplayMember = "Name";
            cboCategory.DataSource = lstSkills;

            // Select the first Skill in the list.
            cboCategory.SelectedIndex = 0;
        }
开发者ID:RunnerHub,项目名称:chummer5a,代码行数:33,代码来源:frmSelectExoticSkill.cs


示例2: cboCategory_SelectedIndexChanged

		private void cboCategory_SelectedIndexChanged(object sender, EventArgs e)
		{
			// Update the list of Kits based on the selected Category.
			List<ListItem> lstKit = new List<ListItem>();

			// Retrieve the list of Kits for the selected Category.
			XmlNodeList objXmlPacksList = _objXmlDocument.SelectNodes("/chummer/packs/pack[category = \"" + cboCategory.SelectedValue + "\"]");
			foreach (XmlNode objXmlPack in objXmlPacksList)
			{
				ListItem objItem = new ListItem();
				objItem.Value = objXmlPack["name"].InnerText;
				if (objXmlPack["translate"] != null)
					objItem.Name = objXmlPack["translate"].InnerText;
				else
					objItem.Name = objXmlPack["name"].InnerText;
				lstKit.Add(objItem);
			}
			SortListItem objSort = new SortListItem();
			lstKit.Sort(objSort.Compare);
			lstKits.DataSource = null;
			lstKits.ValueMember = "Value";
			lstKits.DisplayMember = "Name";
			lstKits.DataSource = lstKit;

			if (lstKits.Items.Count == 0)
				treContents.Nodes.Clear();

			if (cboCategory.SelectedValue.ToString() == "Custom")
			    cmdDelete.Visible = true;
			else
			    cmdDelete.Visible = false;
		}
开发者ID:Vanatrix,项目名称:chummer5a,代码行数:32,代码来源:frmSelectPACKSKit.cs


示例3: frmSelectMartialArtManeuver_Load

		private void frmSelectMartialArtManeuver_Load(object sender, EventArgs e)
		{
			foreach (Label objLabel in this.Controls.OfType<Label>())
			{
				if (objLabel.Text.StartsWith("["))
					objLabel.Text = "";
			}

			List<ListItem> lstManeuver = new List<ListItem>();

			// Load the Martial Art information.
			_objXmlDocument = XmlManager.Instance.Load("martialarts.xml");

			// Populate the Martial Art Maneuver list.
			XmlNodeList objManeuverList = _objXmlDocument.SelectNodes("/chummer/maneuvers/maneuver[" + _objCharacter.Options.BookXPath() + "]");
			foreach (XmlNode objXmlManeuver in objManeuverList)
			{
				ListItem objItem = new ListItem();
				objItem.Value = objXmlManeuver["name"].InnerText;
				if (objXmlManeuver["translate"] != null)
					objItem.Name = objXmlManeuver["translate"].InnerText;
				else
					objItem.Name = objXmlManeuver["name"].InnerText;
				lstManeuver.Add(objItem);
			}
			SortListItem objSort = new SortListItem();
			lstManeuver.Sort(objSort.Compare);
			lstManeuvers.DataSource = null;
			lstManeuvers.ValueMember = "Value";
			lstManeuvers.DisplayMember = "Name";
			lstManeuvers.DataSource = lstManeuver;
		}
开发者ID:AMDX9,项目名称:chummer5a,代码行数:32,代码来源:frmSelectMartialArtManeuver.cs


示例4: frmSelectSetting_Load

        private void frmSelectSetting_Load(object sender, EventArgs e)
        {
            // Build the list of XML files found in the settings directory.
            List<ListItem> lstSettings = new List<ListItem>();
            string settingsDirectoryPath = Path.Combine(Environment.CurrentDirectory, "settings");
            foreach (string strFileName in Directory.GetFiles(settingsDirectoryPath, "*.xml"))
            {
                // Load the file so we can get the Setting name.
                XmlDocument objXmlDocument = new XmlDocument();
                objXmlDocument.Load(strFileName);
                string strSettingsName = objXmlDocument.SelectSingleNode("/settings/name").InnerText;

                ListItem objItem = new ListItem();
                objItem.Value = Path.GetFileName(strFileName);
                objItem.Name = strSettingsName;

                lstSettings.Add(objItem);
            }
            SortListItem objSort = new SortListItem();
            lstSettings.Sort(objSort.Compare);
            cboSetting.DataSource = lstSettings;
            cboSetting.ValueMember = "Value";
            cboSetting.DisplayMember = "Name";

            // Attempt to make default.xml the default one. If it could not be found in the list, select the first item instead.
            cboSetting.SelectedIndex = cboSetting.FindStringExact("Default Settings");
            if (cboSetting.SelectedIndex == -1)
                cboSetting.SelectedIndex = 0;
        }
开发者ID:Refhi,项目名称:chummer5a,代码行数:29,代码来源:frmSelectSetting.cs


示例5: frmSelectSetting_Load

        private void frmSelectSetting_Load(object sender, EventArgs e)
        {
            // Build the list of XML files found in the settings directory.
            List<ListItem> lstSettings = new List<ListItem>();
            foreach (string strFileName in Directory.GetFiles(Path.Combine(GlobalOptions.ApplicationPath(), "settings"), "*.xml"))
            {
                // Remove the path from the file name.
                string strSettingsFile = strFileName;
                strSettingsFile = strSettingsFile.Replace(Path.Combine(GlobalOptions.ApplicationPath(), "settings"), string.Empty);
                strSettingsFile = strSettingsFile.Replace(Path.DirectorySeparatorChar, ' ').Trim();

                // Load the file so we can get the Setting name.
                XmlDocument objXmlDocument = new XmlDocument();
                objXmlDocument.Load(strFileName);
                string strSettingsName = objXmlDocument.SelectSingleNode("/settings/name").InnerText;

                ListItem objItem = new ListItem();
                objItem.Value = strSettingsFile;
                objItem.Name = strSettingsName;

                lstSettings.Add(objItem);
            }
            SortListItem objSort = new SortListItem();
            lstSettings.Sort(objSort.Compare);
            cboSetting.DataSource = lstSettings;
            cboSetting.ValueMember = "Value";
            cboSetting.DisplayMember = "Name";

            // Attempt to make default.xml the default one. If it could not be found in the list, select the first item instead.
            cboSetting.SelectedIndex = cboSetting.FindStringExact("Default Settings");
            if (cboSetting.SelectedIndex == -1)
                cboSetting.SelectedIndex = 0;
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:33,代码来源:frmSelectSetting.cs


示例6: frmSelectMentorSpirit_Load

		private void frmSelectMentorSpirit_Load(object sender, EventArgs e)
		{
			if (_strXmlFile == "paragons.xml")
				this.Text = LanguageManager.Instance.GetString("Title_SelectMentorSpirit_Paragon");

			foreach (Label objLabel in this.Controls.OfType<Label>())
			{
				if (objLabel.Text.StartsWith("["))
					objLabel.Text = "";
			}

			// Load the Mentor information.
			_objXmlDocument = XmlManager.Instance.Load(_strXmlFile);

            List<ListItem> lstMentors = new List<ListItem>();

            // Populate the Mentor list.
            XmlNodeList objXmlMentorList = _objXmlDocument.SelectNodes("/chummer/mentors/mentor[(" + _objCharacter.Options.BookXPath() + ")]");
            foreach (XmlNode objXmlMentor in objXmlMentorList)
            {
                ListItem objItem = new ListItem();
                objItem.Value = objXmlMentor["name"].InnerText;
                if (objXmlMentor["translate"] != null)
                    objItem.Name = objXmlMentor["translate"].InnerText;
                else
                    objItem.Name = objXmlMentor["name"].InnerText;
                lstMentors.Add(objItem);
            }
            SortListItem objSort = new SortListItem();
            lstMentors.Sort(objSort.Compare);
            lstMentor.DataSource = null;
            lstMentor.ValueMember = "Value";
            lstMentor.DisplayMember = "Name";
            lstMentor.DataSource = lstMentors;
        }
开发者ID:AMDX9,项目名称:chummer5a,代码行数:35,代码来源:frmSelectMentorSpirit.cs


示例7: frmSelectWeaponCategory_Load

		private void frmSelectWeaponCategory_Load(object sender, EventArgs e)
		{
			_objXmlDocument = XmlManager.Instance.Load("weapons.xml");

			// Build a list of Weapon Categories found in the Weapons file.
			XmlNodeList objXmlCategoryList;
			List<ListItem> lstCategory = new List<ListItem>();
			if (_strForceCategory != "")
			{
				objXmlCategoryList = _objXmlDocument.SelectNodes("/chummer/categories/category[. = \"" + _strForceCategory + "\"]");
			}
			else
			{
				objXmlCategoryList = _objXmlDocument.SelectNodes("/chummer/categories/category");
			}

			foreach (XmlNode objXmlCategory in objXmlCategoryList)
			{
				if (WeaponType != null)
				{
					if (objXmlCategory.Attributes["type"] == null)
						continue;

					if (objXmlCategory.Attributes["type"].Value != WeaponType)
						continue;
				}

				ListItem objItem = new ListItem();
				objItem.Value = objXmlCategory.InnerText;
				if (objXmlCategory.Attributes != null)
				{
					if (objXmlCategory.Attributes["translate"] != null)
						objItem.Name = objXmlCategory.Attributes["translate"].InnerText;
					else
						objItem.Name = objXmlCategory.InnerText;
				}
				else
					objItem.Name = objXmlCategory.InnerText;
				lstCategory.Add(objItem);
			}

			// Add the Cyberware Category.
			if (/*_strForceCategory == "" ||*/ _strForceCategory == "Cyberware")
			{
				ListItem objItem = new ListItem();
				objItem.Value = "Cyberware";
				objItem.Name = "Cyberware";
				lstCategory.Add(objItem);
			}
			cboCategory.ValueMember = "Value";
			cboCategory.DisplayMember = "Name";
			cboCategory.DataSource = lstCategory;

			// Select the first Skill in the list.
			cboCategory.SelectedIndex = 0;

			if (cboCategory.Items.Count == 1)
				cmdOK_Click(sender, e);
		}
开发者ID:Vanatrix,项目名称:chummer5a,代码行数:59,代码来源:frmSelectWeaponCategory.cs


示例8: frmSelectBP

        public frmSelectBP(Character objCharacter, bool blnUseCurrentValues = false)
        {
            _objCharacter = objCharacter;
            _objOptions = _objCharacter.Options;
            _blnUseCurrentValues = blnUseCurrentValues;
            InitializeComponent();
            LanguageManager.Instance.Load(this);

            // Populate the Build Method list.
            List<ListItem> lstBuildMethod = new List<ListItem>();
            //ListItem objBP = new ListItem();
            //objBP.Value = "BP";
            //objBP.Name = LanguageManager.Instance.GetString("String_BP");

            //ListItem objKarma = new ListItem();
            //objKarma.Value = "Karma";
            //objKarma.Name = LanguageManager.Instance.GetString("String_Karma");

            ListItem objPriority = new ListItem();
            objPriority.Value = "Priority";
            objPriority.Name = LanguageManager.Instance.GetString("String_Priority");

            //lstBuildMethod.Add(objBP);
            //lstBuildMethod.Add(objKarma);
            lstBuildMethod.Add(objPriority);
            cboBuildMethod.DataSource = lstBuildMethod;
            cboBuildMethod.ValueMember = "Value";
            cboBuildMethod.DisplayMember = "Name";

            cboBuildMethod.SelectedValue = _objOptions.BuildMethod;
            nudBP.Value = _objOptions.BuildPoints;
            nudMaxAvail.Value = _objOptions.Availability;

            toolTip1.SetToolTip(chkIgnoreRules, LanguageManager.Instance.GetString("Tip_SelectBP_IgnoreRules"));

            if (blnUseCurrentValues)
            {
                //if (objCharacter.BuildMethod == CharacterBuildMethod.Karma)
                //{
                //    cboBuildMethod.SelectedValue = "Karma";
                //    nudBP.Value = objCharacter.BuildKarma;
                //}
                //else if (objCharacter.BuildMethod == CharacterBuildMethod.BP)
                //{
                //    cboBuildMethod.SelectedValue = "BP";
                //    nudBP.Value = objCharacter.BuildPoints;
                //}
                cboBuildMethod.SelectedValue = "Priority";
                nudBP.Value = objCharacter.BuildKarma;

                nudMaxAvail.Value = objCharacter.MaximumAvailability;

                cboBuildMethod.Enabled = false;
            }
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:55,代码来源:frmSelectBP.cs


示例9: SinglePower

		/// <summary>
		/// Limit the list to a single Power.
		/// </summary>
		/// <param name="strValue">Single Power to display.</param>
		public void SinglePower(string strValue)
		{
			List<ListItem> lstItems = new List<ListItem>();
			ListItem objItem = new ListItem();
			objItem.Value = strValue;
			objItem.Name = strValue;
			lstItems.Add(objItem);
			cboPower.DataSource = null;
			cboPower.ValueMember = "Value";
			cboPower.DisplayMember = "Name";
			cboPower.DataSource = lstItems;
		}
开发者ID:Vanatrix,项目名称:chummer5a,代码行数:16,代码来源:frmSelectOptionalPower.cs


示例10: frmReload_Load

		private void frmReload_Load(object sender, EventArgs e)
		{
			List<ListItem> lstAmmo = new List<ListItem>();

			// Add each of the items to a new List since we need to also grab their plugin information.
			foreach (Gear objGear in _lstAmmo)
			{
				ListItem objAmmo = new ListItem();
				objAmmo.Value = objGear.InternalId;
				objAmmo.Name = objGear.DisplayNameShort;
				objAmmo.Name += " x" + objGear.Quantity.ToString();
				if (objGear.Parent != null)
				{
					if (objGear.Parent.DisplayNameShort != string.Empty)
					{
						objAmmo.Name += " (" + objGear.Parent.DisplayNameShort;
						if (objGear.Parent.Location != string.Empty)
							objAmmo.Name += " @ " + objGear.Parent.Location;
						objAmmo.Name += ")";
					}
				}
				if (objGear.Location != string.Empty)
					objAmmo.Name += " (" + objGear.Location + ")";
				// Retrieve the plugin information if it has any.
				if (objGear.Children.Count > 0)
				{
					string strPlugins = "";
					foreach (Gear objChild in objGear.Children)
					{
						strPlugins += objChild.DisplayNameShort + ", ";
					}
					// Remove the trailing comma.
					strPlugins = strPlugins.Substring(0, strPlugins.Length - 2);
					// Append the plugin information to the name.
					objAmmo.Name += " [" + strPlugins + "]";
				}
				lstAmmo.Add(objAmmo);
			}

			// Populate the lists.
			cboAmmo.DataSource = lstAmmo;
			cboAmmo.ValueMember = "Value";
			cboAmmo.DisplayMember = "Name";

			cboType.DataSource = _lstCount;

			// If there's only 1 value in each list, the character doesn't have a choice, so just accept it.
			if (cboAmmo.Items.Count == 1 && cboType.Items.Count == 1)
				AcceptForm();
		}
开发者ID:AMDX9,项目名称:chummer5a,代码行数:50,代码来源:frmReload.cs


示例11: frmSelectLifestyleQuality_Load

        private void frmSelectLifestyleQuality_Load(object sender, EventArgs e)
        {
            _objXmlDocument = XmlManager.Instance.Load("lifestyles.xml");

            foreach (Label objLabel in this.Controls.OfType<Label>())
            {
                if (objLabel.Text.StartsWith("["))
                    objLabel.Text = "";
            }

            // Load the Quality information.
            _objXmlDocument = XmlManager.Instance.Load("lifestyles.xml");

            // Populate the Quality Category list.
            XmlNodeList objXmlCategoryList = _objXmlDocument.SelectNodes("/chummer/categories/category");
            foreach (XmlNode objXmlCategory in objXmlCategoryList)
            {
                ListItem objItem = new ListItem();
                objItem.Value = objXmlCategory.InnerText;
                if (objXmlCategory.Attributes != null)
                {
                    if (objXmlCategory.Attributes["translate"] != null)
                        objItem.Name = objXmlCategory.Attributes["translate"].InnerText;
                    else
                        objItem.Name = objXmlCategory.InnerText;
                }
                else
                    objItem.Name = objXmlCategory.InnerXml;
                _lstCategory.Add(objItem);
            }
            cboCategory.ValueMember = "Value";
            cboCategory.DisplayMember = "Name";
            cboCategory.DataSource = _lstCategory;

            // Select the first Category in the list.
            if (_strSelectCategory == "")
                cboCategory.SelectedIndex = 0;
            else
                cboCategory.SelectedValue = _strSelectCategory;

            if (cboCategory.SelectedIndex == -1)
                cboCategory.SelectedIndex = 0;

            // Change the BP Label to Karma if the character is being built with Karma instead (or is in Career Mode).
            if (_objCharacter.BuildMethod == CharacterBuildMethod.Karma || _objCharacter.BuildMethod == CharacterBuildMethod.Priority || _objCharacter.Created)
                lblBPLabel.Text = LanguageManager.Instance.GetString("Label_Karma");

            BuildQualityList();
        }
开发者ID:Vanatrix,项目名称:chummer5a,代码行数:49,代码来源:frmSelectLifestyleQuality.cs


示例12: frmCreateImprovement_Load

		private void frmCreateImprovement_Load(object sender, EventArgs e)
		{
			List<ListItem> lstTypes = new List<ListItem>();
			_objDocument = XmlManager.Instance.Load("improvements.xml");

			// Populate the Improvement Type list.
			XmlNodeList objXmlImprovementList = _objDocument.SelectNodes("/chummer/improvements/improvement");
			foreach (XmlNode objXmlImprovement in objXmlImprovementList)
			{
				ListItem objItem = new ListItem();
				objItem.Value = objXmlImprovement["id"].InnerText;
				if (objXmlImprovement["translate"] != null)
					objItem.Name = objXmlImprovement["translate"].InnerText;
				else
					objItem.Name = objXmlImprovement["name"].InnerText;
				lstTypes.Add(objItem);
			}

			SortListItem objSort = new SortListItem();
			lstTypes.Sort(objSort.Compare);
			cboImprovemetType.ValueMember = "Value";
			cboImprovemetType.DisplayMember = "Name";
			cboImprovemetType.DataSource = lstTypes;

			// Load the information from the passed Improvement if one has been given.
			if (_objEditImprovement != null)
			{
				cboImprovemetType.SelectedValue = _objEditImprovement.CustomId;
				txtName.Text = _objEditImprovement.CustomName;
				if (nudMax.Visible)
					nudMax.Value = _objEditImprovement.Maximum;
				if (nudMin.Visible)
					nudMin.Value = _objEditImprovement.Minimum;
				if (nudVal.Visible)
				{
					// specificattribute stores the Value in Augmented instead.
					if (_objEditImprovement.CustomId == "specificattribute")
						nudVal.Value = _objEditImprovement.Augmented;
					else
						nudVal.Value = _objEditImprovement.Value;
				}
				if (chkApplyToRating.Visible)
					chkApplyToRating.Checked = _objEditImprovement.AddToRating;
				else
					chkApplyToRating.Checked = false;
				if (txtSelect.Visible)
					txtSelect.Text = _objEditImprovement.ImprovedName;
			}
		}
开发者ID:AMDX9,项目名称:chummer5a,代码行数:49,代码来源:frmCreateImprovement.cs


示例13: frmSelectMartialArtAdvantage_Load

		private void frmSelectMartialArtAdvantage_Load(object sender, EventArgs e)
		{
			foreach (Label objLabel in this.Controls.OfType<Label>())
			{
				if (objLabel.Text.StartsWith("["))
					objLabel.Text = "";
			}

			List<ListItem> lstAdvantage = new List<ListItem>();

			// Load the Martial Art information.
			_objXmlDocument = XmlManager.Instance.Load("martialarts.xml");

			// Populate the Martial Art Advantage list.
			XmlNodeList objXmlAdvantageList = _objXmlDocument.SelectNodes("/chummer/martialarts/martialart[(" + _objCharacter.Options.BookXPath() + ") and name = \"" + _strMartialArt + "\"]/techniques/technique");
			foreach (XmlNode objXmlAdvantage in objXmlAdvantageList)
			{
				ListItem objItem = new ListItem();
				objItem.Value = objXmlAdvantage["name"].InnerText;
				if (objXmlAdvantage.Attributes["translate"] != null)
					objItem.Name = objXmlAdvantage.Attributes["translate"].InnerText;
				else
					objItem.Name = objXmlAdvantage["name"].InnerText;

                bool blnIsNew = true;
                foreach (MartialArt objMartialArt in _objCharacter.MartialArts)
                {
                    if (objMartialArt.Name == _strMartialArt)
                    {
                        foreach (MartialArtAdvantage objMartialArtAdvantage in objMartialArt.Advantages)
                        {
                            if (objMartialArtAdvantage.Name == objItem.Value)
                            {
                                blnIsNew = false;
                            }
                        }
                    }
                }

                if (blnIsNew)
				    lstAdvantage.Add(objItem);
            }
			SortListItem objSort = new SortListItem();
			lstAdvantage.Sort(objSort.Compare);
			lstAdvantages.DataSource = null;
			lstAdvantages.ValueMember = "Value";
			lstAdvantages.DisplayMember = "Name";
			lstAdvantages.DataSource = lstAdvantage;
		}
开发者ID:Vanatrix,项目名称:chummer5a,代码行数:49,代码来源:frmSelectMartialArtAdvantage.cs


示例14: LimitToList

 /// <summary>
 /// Limit the list to a few Powers.
 /// </summary>
 /// <param name="strValue">List of Powers.</param>
 public void LimitToList(List<string> strValue)
 {
     _lstPowers.Clear();
     foreach (string strPower in strValue)
     {
         ListItem objItem = new ListItem();
         objItem.Value = strPower;
         objItem.Name = strPower;
         _lstPowers.Add(objItem);
     }
     cboPower.DataSource = null;
     cboPower.DataSource = _lstPowers;
     cboPower.ValueMember = "Value";
     cboPower.DisplayMember = "Name";
 }
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:19,代码来源:frmSelectOptionalPower.cs


示例15: LimitToList

 /// <summary>
 /// Limit the list to a few Limits.
 /// </summary>
 /// <param name="strValue">List of Limits.</param>
 public void LimitToList(List<string> strValue)
 {
     _lstLimits.Clear();
     foreach (string strLimit in strValue)
     {
         ListItem objItem = new ListItem();
         objItem.Value = strLimit;
         objItem.Name = LanguageManager.Instance.GetString("String_Limit" + strLimit + "Short");
         _lstLimits.Add(objItem);
     }
     cboLimit.DataSource = null;
     cboLimit.DataSource = _lstLimits;
     cboLimit.ValueMember = "Value";
     cboLimit.DisplayMember = "Name";
 }
开发者ID:Nitsuj83,项目名称:chummer5a,代码行数:19,代码来源:frmSelectLimit.cs


示例16: frmSelectPower_Load

        private void frmSelectPower_Load(object sender, EventArgs e)
        {
			foreach (Label objLabel in this.Controls.OfType<Label>())
			{
				if (objLabel.Text.StartsWith("["))
					objLabel.Text = "";
			}

        	List<ListItem> lstPower = new List<ListItem>();

            // Load the Powers information.
			_objXmlDocument = XmlManager.Instance.Load("powers.xml");

			// Populate the Powers list.
			XmlNodeList objXmlPowerList;
			
				if (_strLimitToPowers != "")
				{
					string strFilter = "(";
					string[] strValue = _strLimitToPowers.Split(',');
					foreach (string strPower in strValue)
						strFilter += "name = \"" + strPower.Trim() + "\" or ";
					// Remove the trailing " or ".
					strFilter = strFilter.Substring(0, strFilter.Length - 4);
					strFilter += ")";
					objXmlPowerList = _objXmlDocument.SelectNodes("chummer/powers/power[" + strFilter + "]");
				}
				else
				{
					objXmlPowerList = _objXmlDocument.SelectNodes("/chummer/powers/power[" + _objCharacter.Options.BookXPath() + "]");
				}
			foreach (XmlNode objXmlPower in objXmlPowerList)
			{
				ListItem objItem = new ListItem();
				objItem.Value = objXmlPower["name"].InnerText;
				if (objXmlPower["translate"] != null)
					objItem.Name = objXmlPower["translate"].InnerText;
				else
					objItem.Name = objXmlPower["name"].InnerText;
				lstPower.Add(objItem);
			}
			SortListItem objSort = new SortListItem();
			lstPower.Sort(objSort.Compare);
			lstPowers.DataSource = null;
			lstPowers.ValueMember = "Value";
			lstPowers.DisplayMember = "Name";
			lstPowers.DataSource = lstPower;
        }
开发者ID:Vanatrix,项目名称:chummer5a,代码行数:48,代码来源:frmSelectPower.cs


示例17: frmSelectAttribute

        public frmSelectAttribute()
        {
            InitializeComponent();
            LanguageManager.Instance.Load(this);

            // Build the list of Attributes.
            ListItem objBOD = new ListItem();
            ListItem objAGI = new ListItem();
            ListItem objREA = new ListItem();
            ListItem objSTR = new ListItem();
            ListItem objCHA = new ListItem();
            ListItem objINT = new ListItem();
            ListItem objLOG = new ListItem();
            ListItem objWIL = new ListItem();
            ListItem objEDG = new ListItem();
            objBOD.Value = "BOD";
            objBOD.Name = LanguageManager.Instance.GetString("String_AttributeBODShort");
            objAGI.Value = "AGI";
            objAGI.Name = LanguageManager.Instance.GetString("String_AttributeAGIShort");
            objREA.Value = "REA";
            objREA.Name = LanguageManager.Instance.GetString("String_AttributeREAShort");
            objSTR.Value = "STR";
            objSTR.Name = LanguageManager.Instance.GetString("String_AttributeSTRShort");
            objCHA.Value = "CHA";
            objCHA.Name = LanguageManager.Instance.GetString("String_AttributeCHAShort");
            objINT.Value = "INT";
            objINT.Name = LanguageManager.Instance.GetString("String_AttributeINTShort");
            objLOG.Value = "LOG";
            objLOG.Name = LanguageManager.Instance.GetString("String_AttributeLOGShort");
            objWIL.Value = "WIL";
            objWIL.Name = LanguageManager.Instance.GetString("String_AttributeWILShort");
            objEDG.Value = "EDG";
            objEDG.Name = LanguageManager.Instance.GetString("String_AttributeEDGShort");
            _lstAttributes.Add(objBOD);
            _lstAttributes.Add(objAGI);
            _lstAttributes.Add(objREA);
            _lstAttributes.Add(objSTR);
            _lstAttributes.Add(objCHA);
            _lstAttributes.Add(objINT);
            _lstAttributes.Add(objLOG);
            _lstAttributes.Add(objWIL);
            _lstAttributes.Add(objEDG);

            cboAttribute.ValueMember = "Value";
            cboAttribute.DisplayMember = "Name";
            cboAttribute.DataSource = _lstAttributes;
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:47,代码来源:frmSelectAttribute.cs


示例18: frmSelectMartialArt_Load

		private void frmSelectMartialArt_Load(object sender, EventArgs e)
		{
			foreach (Label objLabel in this.Controls.OfType<Label>())
			{
				if (objLabel.Text.StartsWith("["))
					objLabel.Text = "";
			}

			XmlNodeList objArtList;
			List<ListItem> lstMartialArt = new List<ListItem>();

			// Load the Martial Arts information.
			_objXmlDocument = XmlManager.Instance.Load("martialarts.xml");

			// Populate the Martial Arts list.
			if (_strForcedValue == "")
				objArtList = _objXmlDocument.SelectNodes("/chummer/martialarts/martialart[" + _objCharacter.Options.BookXPath() + "]");
			else
				objArtList = _objXmlDocument.SelectNodes("/chummer/martialarts/martialart[name = \"" + _strForcedValue + "\"]");
			foreach (XmlNode objXmlArt in objArtList)
			{
                XmlNode objXmlQuality = objXmlArt["quality"];
                if ((_blnShowQualities && objXmlQuality != null) || (!_blnShowQualities && objXmlQuality == null))
                {
                    ListItem objItem = new ListItem();
                    objItem.Value = objXmlArt["name"].InnerText;
                    if (objXmlArt["translate"] != null)
                        objItem.Name = objXmlArt["translate"].InnerText;
                    else
                        objItem.Name = objXmlArt["name"].InnerText;
                    lstMartialArt.Add(objItem);
                }
			}
			SortListItem objSort = new SortListItem();
			lstMartialArt.Sort(objSort.Compare);
			lstMartialArts.DataSource = null;
			lstMartialArts.ValueMember = "Value";
			lstMartialArts.DisplayMember = "Name";
			lstMartialArts.DataSource = lstMartialArt;

			if (lstMartialArts.Items.Count == 1)
			{
				lstMartialArts.SelectedIndex = 0;
				AcceptForm();
			}
		}
开发者ID:AMDX9,项目名称:chummer5a,代码行数:46,代码来源:frmSelectMartialArt.cs


示例19: frmSelectWeapon_Load

        private void frmSelectWeapon_Load(object sender, EventArgs e)
        {
			foreach (Label objLabel in this.Controls.OfType<Label>())
			{
				if (objLabel.Text.StartsWith("["))
					objLabel.Text = "";
			}

        	// Load the Weapon information.
			_objXmlDocument = XmlManager.Instance.Load("weapons.xml");

            // Populate the Weapon Category list.
			XmlNodeList objXmlCategoryList = _objXmlDocument.SelectNodes("/chummer/categories/category");
			foreach (XmlNode objXmlCategory in objXmlCategoryList)
			{
				ListItem objItem = new ListItem();
				objItem.Value = objXmlCategory.InnerText;
				if (objXmlCategory.Attributes != null)
				{
					if (objXmlCategory.Attributes["translate"] != null)
						objItem.Name = objXmlCategory.Attributes["translate"].InnerText;
					else
						objItem.Name = objXmlCategory.InnerText;
				}
				else
					objItem.Name = objXmlCategory.InnerXml;
				_lstCategory.Add(objItem);
			}
			cboCategory.ValueMember = "Value";
			cboCategory.DisplayMember = "Name";
			cboCategory.DataSource = _lstCategory;

			chkBlackMarketDiscount.Visible = _objCharacter.BlackMarketDiscount;

			// Select the first Category in the list.
			if (_strSelectCategory == "")
				cboCategory.SelectedIndex = 0;
			else
				cboCategory.SelectedValue = _strSelectCategory;

			if (cboCategory.SelectedIndex == -1)
				cboCategory.SelectedIndex = 0;

            if (chkBrowse.Checked)
                LoadGrid();
        }
开发者ID:GhostWhoWalksInside,项目名称:chummer5a_Dashboard,代码行数:46,代码来源:frmSelectWeapon.cs


示例20: frmSelectArmorMod_Load

		private void frmSelectArmorMod_Load(object sender, EventArgs e)
		{
			foreach (Label objLabel in this.Controls.OfType<Label>())
			{
				if (objLabel.Text.StartsWith("["))
					objLabel.Text = "";
			}

			List<ListItem> lstMods = new List<ListItem>();

			// Load the Armor information.
			_objXmlDocument = XmlManager.Instance.Load("armor.xml");

			// Populate the Mods list.
			string[] strAllowed = _strAllowedCategories.Split(',');
			string strMount = "";
			foreach (string strAllowedMount in strAllowed)
			{
				if (strAllowedMount != "")
					strMount += "category = \"" + strAllowedMount + "\" or ";
			}
			strMount += "category = \"General\"";
			XmlNodeList objXmlModList = _objXmlDocument.SelectNodes("/chummer/mods/mod[" + strMount + " and (" + _objCharacter.Options.BookXPath() + ")]");

			foreach (XmlNode objXmlMod in objXmlModList)
			{
                bool blnHide = (objXmlMod["hide"] != null);
                if (!blnHide)
                {
                    ListItem objItem = new ListItem();
                    objItem.Value = objXmlMod["name"].InnerText;
                    if (objXmlMod["translate"] != null)
                        objItem.Name = objXmlMod["translate"].InnerText;
                    else
                        objItem.Name = objXmlMod["name"].InnerText;
                    lstMods.Add(objItem);
                }
			}
			chkBlackMarketDiscount.Visible = _objCharacter.BlackMarketDiscount;
			SortListItem objSort = new SortListItem();
			lstMods.Sort(objSort.Compare);
			lstMod.ValueMember = "Value";
			lstMod.DisplayMember = "Name";
			lstMod.DataSource = lstMods;
		}
开发者ID:GhostWhoWalksInside,项目名称:chummer5a_Dashboard,代码行数:45,代码来源:frmSelectArmorMod.cs



注:本文中的Chummer.ListItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Chummer.MartialArt类代码示例发布时间:2022-05-24
下一篇:
C# Chummer.ImprovementManager类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap