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


C# frmSelectVehicleMod.ShowDialog方法代码示例

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


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

示例1: tsVehicleAddWeaponModification_Click

        private void tsVehicleAddWeaponModification_Click(object sender, EventArgs e)
        {
            // Attempt to locate the selected VehicleWeapon.
            bool blnFound = false;
            Vehicle objFoundVehicle = new Vehicle(_objCharacter);
            Weapon objWeapon = _objFunctions.FindVehicleWeapon(treVehicles.SelectedNode.Tag.ToString(), _objCharacter.Vehicles, out objFoundVehicle);
            if (objWeapon != null)
                blnFound = true;

            if (!blnFound)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_VehicleWeaponMods"), LanguageManager.Instance.GetString("MessageTitle_VehicleWeaponMods"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            frmSelectVehicleMod frmPickVehicleMod = new frmSelectVehicleMod(_objCharacter);

            // Make sure the Weapon allows Modifications to be added to it.
            // Open the Weapons XML file and locate the selected Weapon.
            XmlDocument objXmlDocument = XmlManager.Instance.Load("weapons.xml");
            XmlNode objXmlWeapon = objXmlDocument.SelectSingleNode("/chummer/weapons/weapon[name = \"" + objWeapon.Name + "\"]");

            if (objXmlWeapon == null)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotModifyWeaponMod"), LanguageManager.Instance.GetString("MessageTitle_CannotModifyWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (objXmlWeapon["allowmod"] != null)
            {
                if (objXmlWeapon["allowmod"].InnerText == "false")
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotModifyWeaponMod"), LanguageManager.Instance.GetString("MessageTitle_CannotModifyWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            // Set the Weapon properties for the window.
            frmPickVehicleMod.WeaponCost = objWeapon.Cost;
            frmPickVehicleMod.TotalWeaponCost = objWeapon.TotalCost;
            frmPickVehicleMod.ModMultiplier = objWeapon.ModMultiplier;
            frmPickVehicleMod.InputFile = "weapons";

            frmPickVehicleMod.ShowDialog(this);

            // Make sure the dialogue window was not canceled.
            if (frmPickVehicleMod.DialogResult == DialogResult.Cancel)
                return;

            // Locate the selected piece.
            XmlNode objXmlMod = objXmlDocument.SelectSingleNode("/chummer/mods/mod[name = \"" + frmPickVehicleMod.SelectedMod + "\"]");

            TreeNode objNode = new TreeNode();
            WeaponMod objMod = new WeaponMod(_objCharacter);
            objMod.Create(objXmlMod, objNode);
            objMod.Rating = frmPickVehicleMod.SelectedRating;
            objMod.Parent = objWeapon;

            objWeapon.WeaponMods.Add(objMod);
            objNode.Text = objMod.DisplayName;
            objNode.ContextMenuStrip = cmsVehicleWeaponMod;

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

            if (frmPickVehicleMod.AddAgain)
                tsVehicleAddWeaponModification_Click(sender, e);

            UpdateCharacterInfo();
        }
开发者ID:cormanater,项目名称:chummer5a,代码行数:70,代码来源:frmCreate.cs

示例2: tsVehicleAddMod_Click

        private void tsVehicleAddMod_Click(object sender, EventArgs e)
        {
            // Make sure a parent items is selected, then open the Select Vehicle Mod window.
            try
            {
                if (treVehicles.SelectedNode.Level == 0)
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectVehicle"), LanguageManager.Instance.GetString("MessageTitle_SelectVehicle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            catch
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectVehicle"), LanguageManager.Instance.GetString("MessageTitle_SelectVehicle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (treVehicles.SelectedNode.Level > 1)
                treVehicles.SelectedNode = treVehicles.SelectedNode.Parent;

            Vehicle objSelectedVehicle = _objFunctions.FindVehicle(treVehicles.SelectedNode.Tag.ToString(), _objCharacter.Vehicles);

            frmSelectVehicleMod frmPickVehicleMod = new frmSelectVehicleMod(_objCharacter);
            // Set the Vehicle properties for the window.
            frmPickVehicleMod.VehicleCost = Convert.ToInt32(objSelectedVehicle.Cost);
            frmPickVehicleMod.Body = objSelectedVehicle.TotalBody;
			frmPickVehicleMod.Seats = objSelectedVehicle.Seats;
			frmPickVehicleMod.Handling = objSelectedVehicle.Handling;
			frmPickVehicleMod.Speed = objSelectedVehicle.Speed;
            frmPickVehicleMod.Accel = objSelectedVehicle.Accel;
            frmPickVehicleMod.DeviceRating = objSelectedVehicle.DeviceRating;
            frmPickVehicleMod.HasModularElectronics = objSelectedVehicle.HasModularElectronics();

            frmPickVehicleMod.ShowDialog(this);

            // Make sure the dialogue window was not canceled.
            if (frmPickVehicleMod.DialogResult == DialogResult.Cancel)
                return;

            // Open the Vehicles XML file and locate the selected piece.
            XmlDocument objXmlDocument = XmlManager.Instance.Load("vehicles.xml");

            XmlNode objXmlMod = objXmlDocument.SelectSingleNode("/chummer/mods/mod[name = \"" + frmPickVehicleMod.SelectedMod + "\"]");

            TreeNode objNode = new TreeNode();
            VehicleMod objMod = new VehicleMod(_objCharacter);
            objMod.Create(objXmlMod, objNode, frmPickVehicleMod.SelectedRating);

            // Make sure that the Armor Rating does not exceed the maximum allowed by the Vehicle.
            if (objMod.Name.StartsWith("Armor"))
            {
                if (objMod.Rating > objSelectedVehicle.MaxArmor)
                {
                    objMod.Rating = objSelectedVehicle.MaxArmor;
                    objNode.Text = objMod.DisplayName;
                }
            }

            objSelectedVehicle.Mods.Add(objMod);

            objNode.ContextMenuStrip = cmsVehicle;
            treVehicles.SelectedNode.Nodes.Add(objNode);
            treVehicles.SelectedNode.Expand();
            RefreshSelectedVehicle();

            // Check for Improved Sensor bonus.
            if (objMod.Bonus != null)
            {
                if (objMod.Bonus["selecttext"] != null)
                {
                    frmSelectText frmPickText = new frmSelectText();
                    frmPickText.Description = LanguageManager.Instance.GetString("String_Improvement_SelectText").Replace("{0}", objMod.DisplayNameShort);
                    frmPickText.ShowDialog(this);
                    objMod.Extra = frmPickText.SelectedValue;
                    objNode.Text = objMod.DisplayName;
                }
                if (objMod.Bonus["improvesensor"] != null)
                {
                    ChangeVehicleSensor(objSelectedVehicle, true);
                }
            }

            _blnIsDirty = true;
            UpdateWindowTitle();

            if (frmPickVehicleMod.AddAgain)
                tsVehicleAddMod_Click(sender, e);
        }
开发者ID:cormanater,项目名称:chummer5a,代码行数:88,代码来源:frmCreate.cs

示例3: tsWeaponAddModification_Click

        private void tsWeaponAddModification_Click(object sender, EventArgs e)
        {
            // Make sure a parent item is selected, then open the Select Accessory window.
            try
            {
                if (treWeapons.SelectedNode.Level == 0)
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectWeaponMod"), LanguageManager.Instance.GetString("MessageTitle_SelectWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            catch
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectWeaponMod"), LanguageManager.Instance.GetString("MessageTitle_SelectWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            // Locate the Weapon that is selected in the Tree.
            Weapon objWeapon = _objFunctions.FindWeapon(treWeapons.SelectedNode.Tag.ToString(), _objCharacter.Weapons);

            frmSelectVehicleMod frmPickVehicleMod = new frmSelectVehicleMod(_objCharacter, true);

            // Make sure the Weapon allows Modifications to be added to it.
            // Open the Weapons XML file and locate the selected Weapon.
            XmlDocument objXmlDocument = XmlManager.Instance.Load("weapons.xml");
            XmlNode objXmlWeapon = objXmlDocument.SelectSingleNode("/chummer/weapons/weapon[name = \"" + objWeapon.Name + "\"]");

            if (objXmlWeapon == null)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotModifyWeaponMod"), LanguageManager.Instance.GetString("MessageTitle_CannotModifyWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (objXmlWeapon["allowmod"] != null)
            {
                if (objXmlWeapon["allowmod"].InnerText == "false")
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotModifyWeaponMod"), LanguageManager.Instance.GetString("MessageTitle_CannotModifyWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            // Set the Weapon properties for the window.
            frmPickVehicleMod.WeaponCost = objWeapon.Cost;
            frmPickVehicleMod.TotalWeaponCost = objWeapon.TotalCost;
            frmPickVehicleMod.ModMultiplier = objWeapon.ModMultiplier;
            frmPickVehicleMod.InputFile = "weapons";

            frmPickVehicleMod.ShowDialog(this);

            // Make sure the dialogue window was not canceled.
            if (frmPickVehicleMod.DialogResult == DialogResult.Cancel)
                return;

            // Locate the selected piece.
            XmlNode objXmlMod = objXmlDocument.SelectSingleNode("/chummer/mods/mod[name = \"" + frmPickVehicleMod.SelectedMod + "\"]");

            TreeNode objNode = new TreeNode();
            WeaponMod objMod = new WeaponMod(_objCharacter);
            objMod.Create(objXmlMod, objNode);
            objMod.Rating = frmPickVehicleMod.SelectedRating;
            objMod.Parent = objWeapon;

            // Do not allow the user to add a new Weapon Mod if the Weapon's Capacity has been reached.
            if (_objOptions.EnforceCapacity && objWeapon.SlotsRemaining - objMod.Slots < 0)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_CapacityReached"), LanguageManager.Instance.GetString("MessageTitle_CapacityReached"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (frmPickVehicleMod.AddAgain)
                    tsWeaponAddModification_Click(sender, e);
                return;
            }

            // Check the item's Cost and make sure the character can afford it.
            int intOriginalCost = objWeapon.TotalCost;
            objWeapon.WeaponMods.Add(objMod);

            int intCost = objWeapon.TotalCost - intOriginalCost;
            // Apply a markup if applicable.
            if (frmPickVehicleMod.Markup != 0)
            {
                double dblCost = Convert.ToDouble(intCost, GlobalOptions.Instance.CultureInfo);
                dblCost *= 1 + (Convert.ToDouble(frmPickVehicleMod.Markup, GlobalOptions.Instance.CultureInfo) / 100.0);
                intCost = Convert.ToInt32(dblCost);
            }

            // Multiply the cost if applicable.
            if (objMod.TotalAvail.EndsWith(LanguageManager.Instance.GetString("String_AvailRestricted")) && _objOptions.MultiplyRestrictedCost)
                intCost *= _objOptions.RestrictedCostMultiplier;
            if (objMod.TotalAvail.EndsWith(LanguageManager.Instance.GetString("String_AvailForbidden")) && _objOptions.MultiplyForbiddenCost)
                intCost *= _objOptions.ForbiddenCostMultiplier;

            if (!frmPickVehicleMod.FreeCost)
            {
                if (intCost > _objCharacter.Nuyen)
                {
                    objWeapon.WeaponMods.Remove(objMod);
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughNuyen"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughNuyen"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (frmPickVehicleMod.AddAgain)
                        tsWeaponAddModification_Click(sender, e);

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

示例4: tsWeaponAddModification_Click

        private void tsWeaponAddModification_Click(object sender, EventArgs e)
        {
            // Make sure a parent item is selected, then open the Select Accessory window.
            try
            {
                if (treWeapons.SelectedNode.Level == 0)
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectWeaponMod"), LanguageManager.Instance.GetString("MessageTitle_SelectWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            catch
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectWeaponMod"), LanguageManager.Instance.GetString("MessageTitle_SelectWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            // Locate the Weapon that is selected in the Tree.
            Weapon objWeapon = (Weapon)_objFunctions.FindEquipment(treWeapons.SelectedNode.Tag.ToString(), _objCharacter.Weapons, typeof(Weapon));

            frmSelectVehicleMod frmPickVehicleMod = new frmSelectVehicleMod(_objCharacter);

            // Make sure the Weapon allows Modifications to be added to it.
            // Open the Weapons XML file and locate the selected Weapon.
            XmlDocument objXmlDocument = XmlManager.Instance.Load("weapons.xml");
            XmlNode objXmlWeapon = objXmlDocument.SelectSingleNode("/chummer/weapons/weapon[id = \"" + objWeapon.ExternalId + "\"]");

            if (objXmlWeapon == null)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotModifyWeaponMod"), LanguageManager.Instance.GetString("MessageTitle_CannotModifyWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (objXmlWeapon["allowmod"] != null)
            {
                if (objXmlWeapon["allowmod"].InnerText == "false")
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotModifyWeaponMod"), LanguageManager.Instance.GetString("MessageTitle_CannotModifyWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            // Set the Weapon properties for the window.
            frmPickVehicleMod.WeaponCost = objWeapon.Cost;
            frmPickVehicleMod.TotalWeaponCost = objWeapon.TotalCost;
            frmPickVehicleMod.ModMultiplier = objWeapon.ModMultiplier;
            frmPickVehicleMod.WindowMode = frmSelectVehicleMod.Mode.WeaponMod;

            frmPickVehicleMod.ShowDialog(this);

            // Make sure the dialogue window was not canceled.
            if (frmPickVehicleMod.DialogResult == DialogResult.Cancel)
                return;

            // Locate the selected piece.
            XmlNode objXmlMod = objXmlDocument.SelectSingleNode("/chummer/mods/mod[id = \"" + frmPickVehicleMod.SelectedMod + "\"]");

            TreeNode objNode = new TreeNode();
            WeaponMod objMod = new WeaponMod(_objCharacter);
            objMod.Create(objXmlMod, objNode);
            objMod.Rating = frmPickVehicleMod.SelectedRating;
            objMod.Parent = objWeapon;

            objWeapon.WeaponMods.Add(objMod);

            objNode.Text = objMod.DisplayName;
            objNode.ContextMenuStrip = cmsWeaponMod;

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

            UpdateCharacterInfo();
            RefreshSelectedWeapon();

            if (frmPickVehicleMod.AddAgain)
                tsWeaponAddModification_Click(sender, e);
        }
开发者ID:janhelke,项目名称:chummer2,代码行数:77,代码来源:frmCreate.cs

示例5: tsVehicleAddMod_Click

        private void tsVehicleAddMod_Click(object sender, EventArgs e)
        {
            // Make sure a parent items is selected, then open the Select Vehicle Mod window.
            try
            {
                if (treVehicles.SelectedNode.Level == 0)
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectVehicle"), LanguageManager.Instance.GetString("MessageTitle_SelectVehicle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            catch
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectVehicle"), LanguageManager.Instance.GetString("MessageTitle_SelectVehicle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (treVehicles.SelectedNode.Level > 1)
                treVehicles.SelectedNode = treVehicles.SelectedNode.Parent;

            Vehicle objSelectedVehicle = _objFunctions.FindVehicle(treVehicles.SelectedNode.Tag.ToString(), _objCharacter.Vehicles);

            frmSelectVehicleMod frmPickVehicleMod = new frmSelectVehicleMod(_objCharacter, true);
            // Set the Vehicle properties for the window.
            frmPickVehicleMod.VehicleCost = Convert.ToInt32(objSelectedVehicle.Cost);
            frmPickVehicleMod.Body = objSelectedVehicle.Body;
            frmPickVehicleMod.Speed = objSelectedVehicle.Speed;
            frmPickVehicleMod.Accel = objSelectedVehicle.Accel;
            frmPickVehicleMod.DeviceRating = objSelectedVehicle.DeviceRating;
            frmPickVehicleMod.HasModularElectronics = objSelectedVehicle.HasModularElectronics();

            frmPickVehicleMod.ShowDialog(this);

            // Make sure the dialogue window was not canceled.
            if (frmPickVehicleMod.DialogResult == DialogResult.Cancel)
                return;

            // Open the Vehicles XML file and locate the selected piece.
            XmlDocument objXmlDocument = XmlManager.Instance.Load("vehicles.xml");

            XmlNode objXmlMod = objXmlDocument.SelectSingleNode("/chummer/mods/mod[name = \"" + frmPickVehicleMod.SelectedMod + "\"]");

            TreeNode objNode = new TreeNode();
            VehicleMod objMod = new VehicleMod(_objCharacter);
            objMod.Create(objXmlMod, objNode, frmPickVehicleMod.SelectedRating);

            // Make sure that the Armor Rating does not exceed the maximum allowed by the Vehicle.
            if (objMod.Name.StartsWith("Armor"))
            {
                if (objMod.Rating > objSelectedVehicle.MaxArmor)
                {
                    objMod.Rating = objSelectedVehicle.MaxArmor;
                    objNode.Text = objMod.DisplayName;
                }
            }

            // Check the item's Cost and make sure the character can afford it.
            int intOriginalCost = objSelectedVehicle.TotalCost;
            objSelectedVehicle.Mods.Add(objMod);

            // Do not allow the user to add a new Vehicle Mod if the Vehicle's Capacity has been reached.
            if (_objOptions.EnforceCapacity && objSelectedVehicle.Slots < objSelectedVehicle.SlotsUsed)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_CapacityReached"), LanguageManager.Instance.GetString("MessageTitle_CapacityReached"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                objSelectedVehicle.Mods.Remove(objMod);
                if (frmPickVehicleMod.AddAgain)
                    tsVehicleAddMod_Click(sender, e);
                return;
            }

            int intCost = objSelectedVehicle.TotalCost - intOriginalCost;
            // Apply a markup if applicable.
            if (frmPickVehicleMod.Markup != 0)
            {
                double dblCost = Convert.ToDouble(intCost, GlobalOptions.Instance.CultureInfo);
                dblCost *= 1 + (Convert.ToDouble(frmPickVehicleMod.Markup, GlobalOptions.Instance.CultureInfo) / 100.0);
                intCost = Convert.ToInt32(dblCost);
            }

            // Multiply the cost if applicable.
            if (objMod.TotalAvail.EndsWith(LanguageManager.Instance.GetString("String_AvailRestricted")) && _objOptions.MultiplyRestrictedCost)
                intCost *= _objOptions.RestrictedCostMultiplier;
            if (objMod.TotalAvail.EndsWith(LanguageManager.Instance.GetString("String_AvailForbidden")) && _objOptions.MultiplyForbiddenCost)
                intCost *= _objOptions.ForbiddenCostMultiplier;

            if (!frmPickVehicleMod.FreeCost)
            {
                if (intCost > _objCharacter.Nuyen)
                {
                    objSelectedVehicle.Mods.Remove(objMod);
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughNuyen"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughNuyen"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (frmPickVehicleMod.AddAgain)
                        tsVehicleAddMod_Click(sender, e);

                    return;
                }
                else
                {
                    // Create the Expense Log Entry.
                    ExpenseLogEntry objExpense = new ExpenseLogEntry();
//.........这里部分代码省略.........
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:101,代码来源:frmCareer.cs


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