当前位置: 首页>>代码示例>>C#>>正文


C# frmSelectArt.ShowDialog方法代码示例

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


在下文中一共展示了frmSelectArt.ShowDialog方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: tsMetamagicAddRitual_Click

        private void tsMetamagicAddRitual_Click(object sender, EventArgs e)
        {
			if (treMetamagic.SelectedNode.Level != 0)
				return;

			int intGrade = 0;
			foreach (InitiationGrade objGrade in _objCharacter.InitiationGrades)
			{
				if (objGrade.InternalId == treMetamagic.SelectedNode.Tag.ToString())
				{
					intGrade = objGrade.Grade;
					break;
				}
			}

			frmSelectArt frmPickArt = new frmSelectArt(_objCharacter);
			frmPickArt.WindowMode = frmSelectArt.Mode.Ritual;
			frmPickArt.ShowDialog(this);

			// Make sure a value was selected.
			if (frmPickArt.DialogResult == DialogResult.Cancel)
				return;

			string strEnchantment = frmPickArt.SelectedItem;

			XmlDocument objXmlDocument = new XmlDocument();
			XmlNode objXmlArt;

			TreeNode objNode = new TreeNode();
			Spell objNewSpell = new Spell(_objCharacter);
			Improvement.ImprovementSource objSource;

			objXmlDocument = XmlManager.Instance.Load("spells.xml");
			objXmlArt = objXmlDocument.SelectSingleNode("/chummer/spells/spell[name = \"" + strEnchantment + "\"]");
			objSource = Improvement.ImprovementSource.Initiation;

			objNewSpell.Create(objXmlArt, _objCharacter, objNode, "", false, false, false, objSource);
			objNewSpell.Grade = intGrade;
			objNode.ContextMenuStrip = cmsInitiationNotes;
			if (objNewSpell.InternalId == Guid.Empty.ToString())
				return;

			_objCharacter.Spells.Add(objNewSpell);

			TreeNode objSpellNode = new TreeNode();
			objSpellNode.Text = objNode.Text;
			objSpellNode.Tag = objNode.Tag;

			string strCategory = "";
			if (objNewSpell.Category == "Rituals")
				strCategory = LanguageManager.Instance.GetString("Label_Ritual") + " ";
			if (objNewSpell.Category == "Enchantments")
				strCategory = LanguageManager.Instance.GetString("Label_Enchantment") + " ";
			objNode.Text = strCategory + objNode.Text;
			treMetamagic.SelectedNode.Nodes.Add(objNode);
			treMetamagic.SelectedNode.Expand();

			int intNode = 5;
			if (!_objCharacter.MagicianEnabled)
				intNode = 0;
			treSpells.Nodes[intNode].Nodes.Add(objSpellNode);
			treSpells.Nodes[intNode].Expand();

			UpdateCharacterInfo();

			_blnIsDirty = true;
			UpdateWindowTitle();
		}
开发者ID:cormanater,项目名称:chummer5a,代码行数:68,代码来源:frmCreate.cs

示例2: tsMetamagicAddEnhancement_Click

        private void tsMetamagicAddEnhancement_Click(object sender, EventArgs e)
        {
            if (treMetamagic.SelectedNode.Level != 0)
                return;

            int intGrade = 0;
            foreach (InitiationGrade objGrade in _objCharacter.InitiationGrades)
            {
                if (objGrade.InternalId == treMetamagic.SelectedNode.Tag.ToString())
                {
                    intGrade = objGrade.Grade;
                    break;
                }
            }
            frmSelectArt frmPickArt = new frmSelectArt(_objCharacter);
            frmPickArt.WindowMode = frmSelectArt.Mode.Enhancement;
            frmPickArt.ShowDialog(this);

            // Make sure a value was selected.
            if (frmPickArt.DialogResult == DialogResult.Cancel)
                return;

            string strEnhancement = frmPickArt.SelectedItem;

            XmlDocument objXmlDocument = new XmlDocument();
            XmlNode objXmlArt;

            TreeNode objNode = new TreeNode();
            Enhancement objEnhancement = new Enhancement(_objCharacter);
            Improvement.ImprovementSource objSource;

            objXmlDocument = XmlManager.Instance.Load("powers.xml");
            objXmlArt = objXmlDocument.SelectSingleNode("/chummer/enhancements/enhancement[name = \"" + strEnhancement + "\"]");
            objSource = Improvement.ImprovementSource.Initiation;

            // Find the associated Power
            string strPower = objXmlArt["power"].InnerText.ToString();

            objEnhancement.Create(objXmlArt, _objCharacter, objNode, objSource);
            objEnhancement.Grade = intGrade;
            objNode.ContextMenuStrip = cmsInitiationNotes;
            if (objEnhancement.InternalId == Guid.Empty.ToString())
                return;

            Power objPower = new Power(_objCharacter);
            bool blnPowerFound = false;
            foreach (Power objExistingPower in _objCharacter.Powers)
            {
                if (objExistingPower.Name == strPower)
                {
                    objPower = objExistingPower;
                    objPower.Enhancements.Add(objEnhancement);
                    blnPowerFound = true;
                    break;
                }
            }

            if (!blnPowerFound)
            {
                // Add it to the character instead
                _objCharacter.Enhancements.Add(objEnhancement);
            }

            treMetamagic.SelectedNode.Nodes.Add(objNode);
            treMetamagic.SelectedNode.Expand();

            UpdateCharacterInfo();

            _blnIsDirty = true;
            UpdateWindowTitle();
        }
开发者ID:cormanater,项目名称:chummer5a,代码行数:71,代码来源:frmCreate.cs

示例3: tsMetamagicAddArt_Click

        private void tsMetamagicAddArt_Click(object sender, EventArgs e)
        {
			if (treMetamagic.SelectedNode.Level != 0)
				return;

			int intGrade = 0;
			foreach (InitiationGrade objGrade in _objCharacter.InitiationGrades)
			{
				if (objGrade.InternalId == treMetamagic.SelectedNode.Tag.ToString())
				{
					intGrade = objGrade.Grade;
					break;
				}
			}

			frmSelectArt frmPickArt = new frmSelectArt(_objCharacter);
			frmPickArt.WindowMode = frmSelectArt.Mode.Art;
			frmPickArt.ShowDialog(this);

			// Make sure a value was selected.
			if (frmPickArt.DialogResult == DialogResult.Cancel)
				return;

			string strArt = frmPickArt.SelectedItem;

			XmlDocument objXmlDocument = new XmlDocument();
			XmlNode objXmlArt;

			TreeNode objNode = new TreeNode();
			Art objArt = new Art(_objCharacter);
			Improvement.ImprovementSource objSource;

			objXmlDocument = XmlManager.Instance.Load("metamagic.xml");
			objXmlArt = objXmlDocument.SelectSingleNode("/chummer/arts/art[name = \"" + strArt + "\"]");
			objSource = Improvement.ImprovementSource.Metamagic;

			objArt.Create(objXmlArt, _objCharacter, objNode, objSource);
			objArt.Grade = intGrade;
			objNode.ContextMenuStrip = cmsInitiationNotes;
			if (objArt.InternalId == Guid.Empty.ToString())
				return;

			_objCharacter.Arts.Add(objArt);

			treMetamagic.SelectedNode.Nodes.Add(objNode);
			treMetamagic.SelectedNode.Expand();

			UpdateCharacterInfo();

			_blnIsDirty = true;
			UpdateWindowTitle();
		}
开发者ID:cormanater,项目名称:chummer5a,代码行数:52,代码来源:frmCreate.cs

示例4: tsMetamagicAddEnchantment_Click

        private void tsMetamagicAddEnchantment_Click(object sender, EventArgs e)
        {
            // Character can only have a number of Metamagics/Echoes equal to their Initiate Grade. Additional ones cost Karma.
            bool blnPayWithKarma = false;
            string strType = "";

            if (treMetamagic.SelectedNode.Level != 0)
                return;

            int intGrade = 0;
            foreach (InitiationGrade objGrade in _objCharacter.InitiationGrades)
            {
                if (objGrade.InternalId == treMetamagic.SelectedNode.Tag.ToString())
                {
                    intGrade = objGrade.Grade;
                    break;
                }
            }

            // Evaluate each object
            foreach (Metamagic objMetamagic in _objCharacter.Metamagics)
            {
                if (objMetamagic.Grade == intGrade)
                    blnPayWithKarma = true;
            }

            foreach (Spell objSpell in _objCharacter.Spells)
            {
                if (objSpell.Grade == intGrade)
                    blnPayWithKarma = true;
            }

            frmSelectArt frmPickArt = new frmSelectArt(_objCharacter);
            frmPickArt.WindowMode = frmSelectArt.Mode.Enchantment;
            frmPickArt.ShowDialog(this);

            // Make sure a value was selected.
            if (frmPickArt.DialogResult == DialogResult.Cancel)
                return;

            string strEnchantment = frmPickArt.SelectedItem;

            XmlDocument objXmlDocument = new XmlDocument();
            XmlNode objXmlArt;

            TreeNode objNode = new TreeNode();
            Spell objNewSpell = new Spell(_objCharacter);
            Improvement.ImprovementSource objSource;

            objXmlDocument = XmlManager.Instance.Load("spells.xml");
            objXmlArt = objXmlDocument.SelectSingleNode("/chummer/spells/spell[name = \"" + strEnchantment + "\"]");
            objSource = Improvement.ImprovementSource.Initiation;

            objNewSpell.Create(objXmlArt, _objCharacter, objNode, "", false, false, false, objSource);
            objNewSpell.Grade = intGrade;
            objNode.ContextMenuStrip = cmsInitiationNotes;
            if (objNewSpell.InternalId == Guid.Empty.ToString())
                return;

            _objCharacter.Spells.Add(objNewSpell);

            TreeNode objSpellNode = new TreeNode();
            objSpellNode.Text = objNode.Text;
            objSpellNode.Tag = objNode.Tag;

            string strCategory = "";
            if (objNewSpell.Category == "Rituals")
                strCategory = LanguageManager.Instance.GetString("Label_Ritual") + " ";
            if (objNewSpell.Category == "Enchantments")
                strCategory = LanguageManager.Instance.GetString("Label_Enchantment") + " ";
            objNode.Text = strCategory + objNode.Text;
            treMetamagic.SelectedNode.Nodes.Add(objNode);
            treMetamagic.SelectedNode.Expand();

            treSpells.Nodes[6].Nodes.Add(objSpellNode);
            treSpells.Nodes[6].Expand();

            UpdateCharacterInfo();

            _blnIsDirty = true;
            UpdateWindowTitle();
        }
开发者ID:knightaries,项目名称:chummer5a,代码行数:82,代码来源:frmCreate.cs

示例5: tsMetamagicAddRitual_Click

        private void tsMetamagicAddRitual_Click(object sender, EventArgs e)
        {
            // Character can only have a number of Metamagics/Echoes equal to their Initiate Grade. Additional ones cost Karma.
            bool blnPayWithKarma = false;
            string strType = "";

            if (treMetamagic.SelectedNode.Level != 0)
                return;

            int intGrade = 0;
            foreach (InitiationGrade objGrade in _objCharacter.InitiationGrades)
            {
                if (objGrade.InternalId == treMetamagic.SelectedNode.Tag.ToString())
                {
                    intGrade = objGrade.Grade;
                    break;
                }
            }

            // Evaluate each object
            foreach (Metamagic objMetamagic in _objCharacter.Metamagics)
            {
                if (objMetamagic.Grade == intGrade)
                    blnPayWithKarma = true;
            }

            foreach (Spell objSpell in _objCharacter.Spells)
            {
                if (objSpell.Grade == intGrade)
                    blnPayWithKarma = true;
            }

            if (blnPayWithKarma && _objCharacter.Karma < _objOptions.KarmaSpell)
            {
                // Make sure the Karma expense would not put them over the limit.
                MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (blnPayWithKarma)
                if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseSpend").Replace("{0}", LanguageManager.Instance.GetString("String_Ritual")).Replace("{1}", _objOptions.KarmaSpell.ToString())))
                    return;

            frmSelectArt frmPickArt = new frmSelectArt(_objCharacter);
            frmPickArt.WindowMode = frmSelectArt.Mode.Ritual;
            frmPickArt.ShowDialog(this);

            // Make sure a value was selected.
            if (frmPickArt.DialogResult == DialogResult.Cancel)
                return;

            string strEnchantment = frmPickArt.SelectedItem;

            XmlDocument objXmlDocument = new XmlDocument();
            XmlNode objXmlArt;

            TreeNode objNode = new TreeNode();
            Spell objNewSpell = new Spell(_objCharacter);
            Improvement.ImprovementSource objSource;

            objXmlDocument = XmlManager.Instance.Load("spells.xml");
            objXmlArt = objXmlDocument.SelectSingleNode("/chummer/spells/spell[name = \"" + strEnchantment + "\"]");
            objSource = Improvement.ImprovementSource.Initiation;

            objNewSpell.Create(objXmlArt, _objCharacter, objNode, "", false, false, false, objSource);
            objNewSpell.Grade = intGrade;
            objNode.ContextMenuStrip = cmsInitiationNotes;
            if (objNewSpell.InternalId == Guid.Empty.ToString())
                return;

            _objCharacter.Spells.Add(objNewSpell);

            if (blnPayWithKarma)
            {
                // Create the Expense Log Entry.
                ExpenseLogEntry objEntry = new ExpenseLogEntry();
                objEntry.Create(_objOptions.KarmaSpell * -1, strType + " " + frmPickArt.SelectedItem, ExpenseType.Karma, DateTime.Now);
                _objCharacter.ExpenseEntries.Add(objEntry);

                ExpenseUndo objUndo = new ExpenseUndo();
                objUndo.CreateKarma(KarmaExpenseType.AddSpell, objNewSpell.InternalId);
                objEntry.Undo = objUndo;

                // Adjust the character's Karma total.
                _objCharacter.Karma -= _objOptions.KarmaSpell;
            }

            TreeNode objSpellNode = new TreeNode();
            objSpellNode.Text = objNode.Text;
            objSpellNode.Tag = objNode.Tag;

            string strCategory = "";
            if (objNewSpell.Category == "Rituals")
                strCategory = LanguageManager.Instance.GetString("Label_Ritual") + " ";
            if (objNewSpell.Category == "Enchantments")
                strCategory = LanguageManager.Instance.GetString("Label_Enchantment") + " ";
            objNode.Text = strCategory + objNode.Text;
            treMetamagic.SelectedNode.Nodes.Add(objNode);
            treMetamagic.SelectedNode.Expand();

//.........这里部分代码省略.........
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:101,代码来源:frmCareer.cs

示例6: tsMetamagicAddEnhancement_Click

        private void tsMetamagicAddEnhancement_Click(object sender, EventArgs e)
        {
            bool blnPayWithKarma = false;
            string strType = "";

            if (treMetamagic.SelectedNode.Level != 0)
                return;

            int intGrade = 0;
            foreach (InitiationGrade objGrade in _objCharacter.InitiationGrades)
            {
                if (objGrade.InternalId == treMetamagic.SelectedNode.Tag.ToString())
                {
                    intGrade = objGrade.Grade;
                    break;
                }
            }

            blnPayWithKarma = true;
            if (blnPayWithKarma && _objCharacter.Karma < _objOptions.KarmaSpell)
            {
                // Make sure the Karma expense would not put them over the limit.
                MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseSpend").Replace("{0}", LanguageManager.Instance.GetString("String_Enhancement")).Replace("{1}", _objOptions.KarmaSpell.ToString())))
                return;

            frmSelectArt frmPickArt = new frmSelectArt(_objCharacter);
            frmPickArt.WindowMode = frmSelectArt.Mode.Enhancement;
            frmPickArt.ShowDialog(this);

            // Make sure a value was selected.
            if (frmPickArt.DialogResult == DialogResult.Cancel)
                return;

            string strEnhancement = frmPickArt.SelectedItem;

            XmlDocument objXmlDocument = new XmlDocument();
            XmlNode objXmlArt;

            TreeNode objNode = new TreeNode();
            Enhancement objEnhancement = new Enhancement(_objCharacter);
            Improvement.ImprovementSource objSource;

            objXmlDocument = XmlManager.Instance.Load("powers.xml");
            objXmlArt = objXmlDocument.SelectSingleNode("/chummer/enhancements/enhancement[name = \"" + strEnhancement + "\"]");
            objSource = Improvement.ImprovementSource.Initiation;

            // Find the associated Power
            string strPower = objXmlArt["power"].InnerText.ToString();

            objEnhancement.Create(objXmlArt, _objCharacter, objNode, objSource);
            objEnhancement.Grade = intGrade;
            objNode.ContextMenuStrip = cmsInitiationNotes;
            if (objEnhancement.InternalId == Guid.Empty.ToString())
                return;

            Power objPower = new Power(_objCharacter);
            bool blnPowerFound = false;
            foreach (Power objExistingPower in _objCharacter.Powers)
            {
                if (objExistingPower.Name == strPower)
                {
                    objPower = objExistingPower;
                    objPower.Enhancements.Add(objEnhancement);
                    blnPowerFound = true;
                    break;
                }
            }

            if (!blnPowerFound)
            {
                // Add it to the character instead
                _objCharacter.Enhancements.Add(objEnhancement);
            }

            if (blnPayWithKarma)
            {
                // Create the Expense Log Entry.
                ExpenseLogEntry objEntry = new ExpenseLogEntry();
                objEntry.Create(_objOptions.KarmaEnhancement * -1, strType + " " + frmPickArt.SelectedItem, ExpenseType.Karma, DateTime.Now);
                _objCharacter.ExpenseEntries.Add(objEntry);

                ExpenseUndo objUndo = new ExpenseUndo();
                objUndo.CreateKarma(KarmaExpenseType.AddSpell, objEnhancement.InternalId);
                objEntry.Undo = objUndo;

                // Adjust the character's Karma total.
                _objCharacter.Karma -= _objOptions.KarmaEnhancement;
            }

            treMetamagic.SelectedNode.Nodes.Add(objNode);
            treMetamagic.SelectedNode.Expand();

            UpdateCharacterInfo();

            _blnIsDirty = true;
            UpdateWindowTitle();
//.........这里部分代码省略.........
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:101,代码来源:frmCareer.cs

示例7: tsMetamagicAddArt_Click

        private void tsMetamagicAddArt_Click(object sender, EventArgs e)
        {
            // Character can only have a number of Metamagics/Echoes equal to their Initiate Grade. Additional ones cost Karma.
            bool blnPayWithKarma = false;
            string strType = "";

            if (treMetamagic.SelectedNode.Level != 0)
                return;

            int intGrade = 0;
            foreach (InitiationGrade objGrade in _objCharacter.InitiationGrades)
            {
                if (objGrade.InternalId == treMetamagic.SelectedNode.Tag.ToString())
                {
                    intGrade = objGrade.Grade;
                    break;
                }
            }

            if (blnPayWithKarma && _objCharacter.Karma < _objOptions.KarmaMetamagic)
            {
                // Make sure the Karma expense would not put them over the limit.
                MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            frmSelectArt frmPickArt = new frmSelectArt(_objCharacter);
            frmPickArt.WindowMode = frmSelectArt.Mode.Art;
            frmPickArt.ShowDialog(this);

            // Make sure a value was selected.
            if (frmPickArt.DialogResult == DialogResult.Cancel)
                return;

            string strArt = frmPickArt.SelectedItem;

            XmlDocument objXmlDocument = new XmlDocument();
            XmlNode objXmlArt;

            TreeNode objNode = new TreeNode();
            Art objArt = new Art(_objCharacter);
            Improvement.ImprovementSource objSource;

            objXmlDocument = XmlManager.Instance.Load("metamagic.xml");
            objXmlArt = objXmlDocument.SelectSingleNode("/chummer/arts/art[name = \"" + strArt + "\"]");
            objSource = Improvement.ImprovementSource.Metamagic;

            objArt.Create(objXmlArt, _objCharacter, objNode, objSource);
            objArt.Grade = intGrade;
            objNode.ContextMenuStrip = cmsInitiationNotes;
            if (objArt.InternalId == Guid.Empty.ToString())
                return;

            _objCharacter.Arts.Add(objArt);

            if (blnPayWithKarma)
            {
                // Create the Expense Log Entry.
                ExpenseLogEntry objEntry = new ExpenseLogEntry();
                objEntry.Create(_objOptions.KarmaMetamagic * -1, strType + " " + frmPickArt.SelectedItem, ExpenseType.Karma, DateTime.Now);
                _objCharacter.ExpenseEntries.Add(objEntry);

                ExpenseUndo objUndo = new ExpenseUndo();
                objUndo.CreateKarma(KarmaExpenseType.AddMetamagic, objArt.InternalId);
                objEntry.Undo = objUndo;

                // Adjust the character's Karma total.
                _objCharacter.Karma -= _objOptions.KarmaMetamagic;
            }

            treMetamagic.SelectedNode.Nodes.Add(objNode);
            treMetamagic.SelectedNode.Expand();

            UpdateCharacterInfo();

            _blnIsDirty = true;
            UpdateWindowTitle();
        }
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:78,代码来源:frmCareer.cs


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