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

C# Chummer.SortListItem类代码示例

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

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



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

示例1: 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


示例2: 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


示例3: 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


示例4: 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


示例5: 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


示例6: 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


示例7: 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


示例8: 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


示例9: 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


示例10: 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


示例11: frmSelectWeaponAccessory_Load

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

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

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

			// Populate the Accessory list.
			string[] strAllowed = _strAllowedMounts.Split('/');
			string strMount = "";
			foreach (string strAllowedMount in strAllowed)
			{
				if (strAllowedMount != "")
					strMount += "contains(mount, \"" + strAllowedMount + "\") or ";
			}
			strMount += "contains(mount, \"Internal\") or contains(mount, \"None\") or ";
			strMount += "mount = \"\"";
			XmlNodeList objXmlAccessoryList = _objXmlDocument.SelectNodes("/chummer/accessories/accessory[(" + strMount + ") and (" + _objCharacter.Options.BookXPath() + ")]");
			foreach (XmlNode objXmlAccessory in objXmlAccessoryList)
			{
				ListItem objItem = new ListItem();
				objItem.Value = objXmlAccessory["name"].InnerText;
				if (objXmlAccessory["translate"] != null)
					objItem.Name = objXmlAccessory["translate"].InnerText;
				else
					objItem.Name = objXmlAccessory["name"].InnerText;
				lstAccessories.Add(objItem);
			}

			chkBlackMarketDiscount.Visible = _objCharacter.BlackMarketDiscount;

			SortListItem objSort = new SortListItem();
			lstAccessories.Sort(objSort.Compare);
			lstAccessory.ValueMember = "Value";
			lstAccessory.DisplayMember = "Name";
			lstAccessory.DataSource = lstAccessories;
		}
开发者ID:GhostWhoWalksInside,项目名称:chummer5a_Dashboard,代码行数:43,代码来源:frmSelectWeaponAccessory.cs


示例12: frmSelectProgramOption_Load

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

			// Load the Programs information.
            _objXmlDocument = XmlManager.Instance.Load("complexforms.xml");

			// Populate the Program list.
			XmlNodeList objXmlOptionList = _objXmlDocument.SelectNodes("/chummer/options/option[" + _objCharacter.Options.BookXPath() + "]");

			foreach (XmlNode objXmlOption in objXmlOptionList)
			{
				bool blnAdd = true;
				// If the Option has Category requirements, make sure they are met before adding the item to the list.
				if (objXmlOption["programtypes"] != null)
				{
					blnAdd = false;
					foreach (XmlNode objXmlCategory in objXmlOption.SelectNodes("programtypes/programtype"))
					{
						if (objXmlCategory.InnerText == _strProgramCategory)
							blnAdd = true;
					}
				}

				if (blnAdd)
				{
					ListItem objItem = new ListItem();
					objItem.Value = objXmlOption["name"].InnerText;
					if (objXmlOption["translate"] != null)
						objItem.Name = objXmlOption["translate"].InnerText;
					else
						objItem.Name = objXmlOption["name"].InnerText;
					lstOption.Add(objItem);
				}
			}
			SortListItem objSort = new SortListItem();
			lstOption.Sort(objSort.Compare);
			lstOptions.ValueMember = "Value";
			lstOptions.DisplayMember = "Name";
			lstOptions.DataSource = lstOption;
		}
开发者ID:Vanatrix,项目名称:chummer5a,代码行数:41,代码来源:frmSelectProgramOption.cs


示例13: frmSelectCritterPower_Load


//.........这里部分代码省略.........
            {
                foreach (ListItem objItem in _lstCategory)
                {
                    if (objItem.Value == "Allowed Optional Powers")
                    {
                        _lstCategory.Remove(objItem);
                        break;
                    }
                }
            }

            // Remove Free Spirit Powers if the critter is not a Free Spirit.
            if (_objCharacter.Metatype != "Free Spirit")
            {
                foreach (ListItem objItem in _lstCategory)
                {
                    if (objItem.Value == "Free Spirit")
                    {
                        _lstCategory.Remove(objItem);
                        break;
                    }
                }
            }

            // Remove Toxic Critter Powers if the critter is not a Toxic Critter.
            if (_objCharacter.MetatypeCategory != "Toxic Critters")
            {
                foreach (ListItem objItem in _lstCategory)
                {
                    if (objItem.Value == "Toxic Critter Powers")
                    {
                        _lstCategory.Remove(objItem);
                        break;
                    }
                }
            }

            // Remove Emergent Powers if the critter is not a Sprite or A.I.
            if (!_objCharacter.MetatypeCategory.EndsWith("Sprites") && !_objCharacter.MetatypeCategory.EndsWith("Sprite") && !_objCharacter.MetatypeCategory.EndsWith("A.I.s") & _objCharacter.MetatypeCategory != "Technocritters" && _objCharacter.MetatypeCategory != "Protosapients")
            {
                foreach (ListItem objItem in _lstCategory)
                {
                    if (objItem.Value == "Emergent")
                    {
                        _lstCategory.Remove(objItem);
                        break;
                    }
                }
            }

            // Remove Echoes Powers if the critter is not a Free Sprite.
            if (!_objCharacter.IsFreeSprite)
            {
                foreach (ListItem objItem in _lstCategory)
                {
                    if (objItem.Value == "Echoes")
                    {
                        _lstCategory.Remove(objItem);
                        break;
                    }
                }
            }

            // Remove Shapeshifter Powers if the critter is not a Shapeshifter.
            if (_objCharacter.MetatypeCategory != "Shapeshifter")
            {
                foreach (ListItem objItem in _lstCategory)
                {
                    if (objItem.Value == "Shapeshifter")
                    {
                        _lstCategory.Remove(objItem);
                        break;
                    }
                }
            }

            SortListItem objSort = new SortListItem();
            _lstCategory.Sort(objSort.Compare);
            cboCategory.DataSource = null;
            cboCategory.ValueMember = "Value";
            cboCategory.DisplayMember = "Name";
            cboCategory.DataSource = _lstCategory;

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

            if (cboCategory.SelectedIndex == -1)
                cboCategory.SelectedIndex = 0;
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:101,代码来源:frmSelectCritterPower.cs


示例14: cboCategory_SelectedIndexChanged

        private void cboCategory_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (_objMode == Mode.Bioware)
            {
                // If the window is currently showing Bioware, we may need to rebuild the Grade list since Cultured Bioware is not allowed to select Standard (Second-Hand) as as Grade.
                if (cboGrade.SelectedValue != null)
                {
                    string strSelectedValue = cboGrade.SelectedValue.ToString();
                    bool blnCultured = cboCategory.SelectedValue.ToString() == "Cultured";
                    PopulateGrades(blnCultured);
                    cboGrade.SelectedValue = strSelectedValue;
                }
                if (cboGrade.SelectedIndex == -1 && cboGrade.Items.Count > 0)
                    cboGrade.SelectedIndex = 0;
            }

            // Update the list of Cyberware based on the selected Category.
            XmlNodeList objXmlCyberwareList;
            List<ListItem> lstCyberwares = new List<ListItem>();

            if (cboCategory.SelectedValue.ToString().StartsWith("Genetech:") ||
                cboCategory.SelectedValue.ToString() == "Symbionts" ||
                cboCategory.SelectedValue.ToString() == "Genemods" ||
                _blnLockGrade)
            {
                cboGrade.Enabled = false;

            }
            else
            {
                cboGrade.Enabled = true;
            }

            if (cboCategory.SelectedValue.ToString().StartsWith("Genetech:") ||
                cboCategory.SelectedValue.ToString() == "Symbionts" ||
                cboCategory.SelectedValue.ToString() == "Genemods")
            {
                cboGrade.SelectedValue = "Standard";
            }

            // Retrieve the list of Cyberware for the selected Category.
            if (_blnShowOnlySubsystems)
                objXmlCyberwareList = _objXmlDocument.SelectNodes("/chummer/" + _strNode + "s/" + _strNode + "[category = \"" + cboCategory.SelectedValue + "\" and (" + _objCharacter.Options.BookXPath() + ") and contains(capacity, \"[\")]");
            else
                objXmlCyberwareList = _objXmlDocument.SelectNodes("/chummer/" + _strNode + "s/" + _strNode + "[category = \"" + cboCategory.SelectedValue + "\" and (" + _objCharacter.Options.BookXPath() + ")]");
            foreach (XmlNode objXmlCyberware in objXmlCyberwareList)
            {
                ListItem objItem = new ListItem();
                objItem.Value = objXmlCyberware["name"].InnerText;
                if (objXmlCyberware["translate"] != null)
                    objItem.Name = objXmlCyberware["translate"].InnerText;
                else
                    objItem.Name = objXmlCyberware["name"].InnerText;
                lstCyberwares.Add(objItem);
            }
            SortListItem objSort = new SortListItem();
            lstCyberwares.Sort(objSort.Compare);
            lstCyberware.DataSource = null;
            lstCyberware.ValueMember = "Value";
            lstCyberware.DisplayMember = "Name";
            lstCyberware.DataSource = lstCyberwares;
        }
开发者ID:argo2445,项目名称:chummer5a,代码行数:62,代码来源:frmSelectCyberware.cs


示例15: txtSearch_TextChanged

        private void txtSearch_TextChanged(object sender, EventArgs e)
        {
            if (txtSearch.Text == "")
            {
                cboCategory_SelectedIndexChanged(sender, e);
                return;
            }

            List<ListItem> lstCyberwares = new List<ListItem>();
            string strCategoryFilter = "";

            foreach (ListItem objAllowedCategory in _lstCategory)
            {
                if (objAllowedCategory.Value != "")
                    strCategoryFilter += "category = \"" + objAllowedCategory.Value + "\" or ";
            }

            // Treat everything as being uppercase so the search is case-insensitive.
            string strSearch = "/chummer/" + _strNode + "s/" + _strNode + "[(" + _objCharacter.Options.BookXPath() + ") and ((contains(translate(name,'abcdefghijklmnopqrstuvwxyzàáâãäåçèéêëìíîïñòóôõöùúûüýß','ABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝß'), \"" + txtSearch.Text.ToUpper() + "\") and not(translate)) or contains(translate(translate,'abcdefghijklmnopqrstuvwxyzàáâãäåçèéêëìíîïñòóôõöùúûüýß','ABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝß'), \"" + txtSearch.Text.ToUpper() + "\"))";
            if (strCategoryFilter != "")
                strSearch += " and (" + strCategoryFilter + ")";
            // Remove the trailing " or ";
            strSearch = strSearch.Substring(0, strSearch.Length - 4) + ")";
            strSearch += "]";

            XmlNodeList objXmlCyberwareList = _objXmlDocument.SelectNodes(strSearch);
            foreach (XmlNode objXmlCyberware in objXmlCyberwareList)
            {
                ListItem objItem = new ListItem();
                objItem.Value = objXmlCyberware["name"].InnerText;
                if (objXmlCyberware["translate"] != null)
                    objItem.Name = objXmlCyberware["translate"].InnerText;
                else
                    objItem.Name = objXmlCyberware["name"].InnerText;

                try
                {
                    objItem.Name += " [" + _lstCategory.Find(objFind => objFind.Value == objXmlCyberware["category"].InnerText).Name + "]";
                    lstCyberwares.Add(objItem);
                }
                catch
                {
                }
            }
            SortListItem objSort = new SortListItem();
            lstCyberwares.Sort(objSort.Compare);
            lstCyberware.DataSource = null;
            lstCyberware.ValueMember = "Value";
            lstCyberware.DisplayMember = "Name";
            lstCyberware.DataSource = lstCyberwares;
        }
开发者ID:argo2445,项目名称:chummer5a,代码行数:51,代码来源:frmSelectCyberware.cs


示例16: tmrSearch_Tick


//.........这里部分代码省略.........
                tabWeapons.Columns.Add("Dice");
                tabWeapons.Columns.Add("Accuracy");
                tabWeapons.Columns["Accuracy"].DataType = typeof(Int32);
                tabWeapons.Columns.Add("Damage");
                tabWeapons.Columns.Add("AP");
                tabWeapons.Columns.Add("RC");
                tabWeapons.Columns["RC"].DataType = typeof(Int32);
                tabWeapons.Columns.Add("Ammo");
                tabWeapons.Columns.Add("Mode");
                tabWeapons.Columns.Add("Reach");
                tabWeapons.Columns.Add("Accessories");
                tabWeapons.Columns.Add("Avail");
                tabWeapons.Columns.Add("Source");
                tabWeapons.Columns.Add("Cost");
                tabWeapons.Columns["Cost"].DataType = typeof(Int32);

                // Populate the Weapon list.
                foreach (XmlNode objXmlWeapon in objXmlWeaponList)
                {
                    TreeNode objNode = new TreeNode();
                    Weapon objWeapon = new Weapon(_objCharacter);
                    objWeapon.Create(objXmlWeapon, _objCharacter, objNode, null, null, null);

                    string strWeaponName = objWeapon.Name;
                    string strDice = objWeapon.DicePool;
                    int intAccuracy = Convert.ToInt32(objWeapon.TotalAccuracy);
                    string strDamage = objWeapon.CalculatedDamage();
                    string strAP = objWeapon.TotalAP;
                    if (strAP == "-")
                        strAP = "0";
                    int intRC = Convert.ToInt32(objWeapon.TotalRC);
                    string strAmmo = objWeapon.Ammo;
                    string strMode = objWeapon.Mode;
                    string strReach = objWeapon.TotalReach.ToString();
                    string strAccessories = "";
                    foreach (WeaponAccessory objAccessory in objWeapon.WeaponAccessories)
                    {
                        if (strAccessories.Length > 0)
                            strAccessories += "\n";
                        strAccessories += objAccessory.Name;
                    }
                    string strAvail = objWeapon.Avail.ToString();
                    string strSource = objWeapon.Source + " " + objWeapon.Page;
                    int intCost = objWeapon.Cost;

                    if (objWeapon.DisplayCategory == "Blades" || objWeapon.DisplayCategory == "Clubs" || objWeapon.DisplayCategory == "Improvised Weapons" || objWeapon.DisplayCategory == "Exotic Melee Weapons" || objWeapon.DisplayCategory == "Unarmed")
                    {
                        strAmmo = "";
                        strMode = "";
                    }
                    else
                    {
                        strReach = "";
                    }

                    tabWeapons.Rows.Add(strWeaponName, strDice, intAccuracy, strDamage, strAP, intRC, strAmmo, strMode, strReach, strAccessories, strAvail, strSource, intCost);
                }

                DataSet set = new DataSet("weapons");
                set.Tables.Add(tabWeapons);

                dgvWeapons.Columns[5].Visible = true;
                dgvWeapons.Columns[6].Visible = true;
                dgvWeapons.Columns[7].Visible = true;
                dgvWeapons.Columns[8].Visible = true;
                dgvWeapons.Columns[12].DefaultCellStyle.Alignment = DataGridViewContentAlignment.TopRight;

                dgvWeapons.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
                dgvWeapons.DataSource = set;
                dgvWeapons.DataMember = "weapons";
            }
            else
            {
                List<ListItem> lstWeapons = new List<ListItem>();
                foreach (XmlNode objXmlWeapon in objXmlWeaponList)
                {
                    ListItem objItem = new ListItem();
                    objItem.Value = objXmlWeapon["name"].InnerText;
                    if (objXmlWeapon["translate"] != null)
                        objItem.Name = objXmlWeapon["translate"].InnerText;
                    else
                        objItem.Name = objXmlWeapon["name"].InnerText;

                    try
                    {
                        objItem.Name += " [" + _lstCategory.Find(objFind => objFind.Value == objXmlWeapon["category"].InnerText).Name + "]";
                        lstWeapons.Add(objItem);
                    }
                    catch
                    {
                    }
                }
                SortListItem objSort = new SortListItem();
                lstWeapons.Sort(objSort.Compare);
                lstWeapon.DataSource = null;
                lstWeapon.ValueMember = "Value";
                lstWeapon.DisplayMember = "Name";
                lstWeapon.DataSource = lstWeapons;
            }
        }
开发者ID:Nitsuj83,项目名称:chummer5a,代码行数:101,代码来源:frmSelectWeapon.cs


示例17: cboCategory_SelectedIndexChanged

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

            // Populate the Weapon list.
            XmlNodeList objXmlWeaponList = _objXmlDocument.SelectNodes("/chummer/weapons/weapon[category = \"" + cboCategory.SelectedValue + "\" and (" + _objCharacter.Options.BookXPath() + ")]");
            foreach (XmlNode objXmlWeapon in objXmlWeaponList)
            {
                bool blnCyberware = false;
                try
                {
                    if (objXmlWeapon["cyberware"].InnerText == "yes")
                        blnCyberware = true;
                }
                catch
                { }

                if (!blnCyberware)
                {
                    ListItem objItem = new ListItem();
                    objItem.Value = objXmlWeapon["name"].InnerText;
                    if (objXmlWeapon["translate"] != null)
                        objItem.Name = objXmlWeapon["translate"].InnerText;
                    else
                        objItem.Name = objXmlWeapon["name"].InnerText;
                    lstWeapons.Add(objItem);
                }
            }
            SortListItem objSort = new SortListItem();
            lstWeapons.Sort(objSort.Compare);
            lstWeapon.DataSource = null;
            lstWeapon.ValueMember = "Value";
            lstWeapon.DisplayMember = "Name";
            lstWeapon.DataSource = lstWeapons;

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


示例18: frmSelectSkillGroup_Load

        private void frmSelectSkillGroup_Load(object sender, EventArgs e)
        {
            List<ListItem> lstGroups = new List<ListItem>();
            _objXmlDocument = XmlManager.Instance.Load("skills.xml");

            if (_strForceValue == "")
            {
                // Build the list of Skill Groups found in the Skills file.
                XmlNodeList objXmlSkillList = _objXmlDocument.SelectNodes("/chummer/skillgroups/name");
                foreach (XmlNode objXmlSkill in objXmlSkillList)
                {
                    bool blnAdd = true;
                    if (_strExcludeCategory != string.Empty)
                    {
                        blnAdd = false;
                        string[] strExcludes = _strExcludeCategory.Split(',');
                        string strExclude = "";
                        for (int i = 0; i <= strExcludes.Length - 1; i++)
                            strExclude += "category != \"" + strExcludes[i].Trim() + "\" and ";
                        // Remove the trailing " and ";
                       

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Chummer.Spell类代码示例发布时间:2022-05-24
下一篇:
C# Chummer.SkillControl类代码示例发布时间: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