本文整理汇总了C#中Chummer.frmSelectWeapon.ShowDialog方法的典型用法代码示例。如果您正苦于以下问题:C# frmSelectWeapon.ShowDialog方法的具体用法?C# frmSelectWeapon.ShowDialog怎么用?C# frmSelectWeapon.ShowDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chummer.frmSelectWeapon
的用法示例。
在下文中一共展示了frmSelectWeapon.ShowDialog方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: tsVehicleAddUnderbarrelWeapon_Click
private void tsVehicleAddUnderbarrelWeapon_Click(object sender, EventArgs e)
{
// Attempt to locate the selected VehicleWeapon.
bool blnWeaponFound = false;
Vehicle objFoundVehicle = new Vehicle(_objCharacter);
Weapon objSelectedWeapon = _objFunctions.FindVehicleWeapon(treVehicles.SelectedNode.Tag.ToString(), _objCharacter.Vehicles, out objFoundVehicle);
if (objSelectedWeapon != null)
blnWeaponFound = true;
if (!blnWeaponFound)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_VehicleWeaponUnderbarrel"), LanguageManager.Instance.GetString("MessageTitle_VehicleWeaponUnderbarrel"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
frmSelectWeapon frmPickWeapon = new frmSelectWeapon(_objCharacter);
frmPickWeapon.ShowDialog(this);
// Make sure the dialogue window was not canceled.
if (frmPickWeapon.DialogResult == DialogResult.Cancel)
return;
// Open the Weapons XML file and locate the selected piece.
XmlDocument objXmlDocument = XmlManager.Instance.Load("weapons.xml");
XmlNode objXmlWeapon = objXmlDocument.SelectSingleNode("/chummer/weapons/weapon[name = \"" + frmPickWeapon.SelectedWeapon + "\"]");
TreeNode objNode = new TreeNode();
Weapon objWeapon = new Weapon(_objCharacter);
objWeapon.Create(objXmlWeapon, _objCharacter, objNode, cmsVehicleWeapon, cmsVehicleWeaponAccessory, cmsVehicleWeaponMod);
objWeapon.VehicleMounted = true;
objWeapon.IsUnderbarrelWeapon = true;
objSelectedWeapon.UnderbarrelWeapons.Add(objWeapon);
objNode.ContextMenuStrip = cmsVehicleWeapon;
treVehicles.SelectedNode.Nodes.Add(objNode);
treVehicles.SelectedNode.Expand();
//treWeapons.SelectedNode = objNode;
UpdateCharacterInfo();
}
示例2: tsWeaponAddUnderbarrel_Click
private void tsWeaponAddUnderbarrel_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_SelectWeaponUnderbarrel"), LanguageManager.Instance.GetString("MessageTitle_SelectWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
catch
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectWeaponUnderbarrel"), LanguageManager.Instance.GetString("MessageTitle_SelectWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (treWeapons.SelectedNode.Level > 1)
treWeapons.SelectedNode = treWeapons.SelectedNode.Parent;
// Get the information for the currently selected Weapon.
foreach (Weapon objCharacterWeapon in _objCharacter.Weapons)
{
if (treWeapons.SelectedNode.Tag.ToString() == objCharacterWeapon.InternalId)
{
if (objCharacterWeapon.InternalId == treWeapons.SelectedNode.Tag.ToString())
{
if (objCharacterWeapon.Cyberware)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_CyberwareUnderbarrel"), LanguageManager.Instance.GetString("MessageTitle_WeaponUnderbarrel"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
}
}
// Locate the Weapon that is selected in the tree.
Weapon objSelectedWeapon = _objFunctions.FindWeapon(treWeapons.SelectedNode.Tag.ToString(), _objCharacter.Weapons);
if (objSelectedWeapon == null)
return;
frmSelectWeapon frmPickWeapon = new frmSelectWeapon(_objCharacter);
frmPickWeapon.ShowDialog(this);
// Make sure the dialogue window was not canceled.
if (frmPickWeapon.DialogResult == DialogResult.Cancel)
return;
// Open the Weapons XML file and locate the selected piece.
XmlDocument objXmlDocument = XmlManager.Instance.Load("weapons.xml");
XmlNode objXmlWeapon = objXmlDocument.SelectSingleNode("/chummer/weapons/weapon[name = \"" + frmPickWeapon.SelectedWeapon + "\"]");
TreeNode objNode = new TreeNode();
Weapon objWeapon = new Weapon(_objCharacter);
objWeapon.Create(objXmlWeapon, _objCharacter, objNode, cmsWeapon, cmsWeaponAccessory, cmsWeaponMod);
objWeapon.IsUnderbarrelWeapon = true;
objSelectedWeapon.UnderbarrelWeapons.Add(objWeapon);
objNode.ContextMenuStrip = cmsWeapon;
treWeapons.SelectedNode.Nodes.Add(objNode);
treWeapons.SelectedNode.Expand();
//treWeapons.SelectedNode = objNode;
UpdateCharacterInfo();
RefreshSelectedWeapon();
}
示例3: tsVehicleAddWeaponWeapon_Click
private void tsVehicleAddWeaponWeapon_Click(object sender, EventArgs e)
{
VehicleMod objMod = new VehicleMod(_objCharacter);
// Make sure that a Weapon Mount has been selected.
try
{
// Attempt to locate the selected VehicleMod.
Vehicle objFoundVehicle = new Vehicle(_objCharacter);
objMod = _objFunctions.FindVehicleMod(treVehicles.SelectedNode.Tag.ToString(), _objCharacter.Vehicles, out objFoundVehicle);
if (!objMod.Name.StartsWith("Weapon Mount") && !objMod.Name.StartsWith("Heavy Weapon Mount") && !objMod.Name.StartsWith("Mechanical Arm"))
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotAddWeapon"), LanguageManager.Instance.GetString("MessageTitle_CannotAddWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
catch
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotAddWeapon"), LanguageManager.Instance.GetString("MessageTitle_CannotAddWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
frmSelectWeapon frmPickWeapon = new frmSelectWeapon(_objCharacter);
frmPickWeapon.ShowDialog();
if (frmPickWeapon.DialogResult == DialogResult.Cancel)
return;
// Open the Weapons XML file and locate the selected piece.
XmlDocument objXmlDocument = XmlManager.Instance.Load("weapons.xml");
XmlNode objXmlWeapon = objXmlDocument.SelectSingleNode("/chummer/weapons/weapon[name = \"" + frmPickWeapon.SelectedWeapon + "\"]");
TreeNode objNode = new TreeNode();
Weapon objWeapon = new Weapon(_objCharacter);
objWeapon.Create(objXmlWeapon, _objCharacter, objNode, cmsVehicleWeapon, cmsVehicleWeaponAccessory, cmsVehicleWeaponMod);
objWeapon.VehicleMounted = true;
objMod.Weapons.Add(objWeapon);
objNode.ContextMenuStrip = cmsVehicleWeapon;
treVehicles.SelectedNode.Nodes.Add(objNode);
treVehicles.SelectedNode.Expand();
if (frmPickWeapon.AddAgain)
tsVehicleAddWeaponWeapon_Click(sender, e);
UpdateCharacterInfo();
}
示例4: cmdAddWeapon_Click
private void cmdAddWeapon_Click(object sender, EventArgs e)
{
frmSelectWeapon frmPickWeapon = new frmSelectWeapon(_objCharacter);
frmPickWeapon.ShowDialog(this);
// Make sure the dialogue window was not canceled.
if (frmPickWeapon.DialogResult == DialogResult.Cancel)
return;
// Open the Weapons XML file and locate the selected piece.
XmlDocument objXmlDocument = XmlManager.Instance.Load("weapons.xml");
XmlNode objXmlWeapon = objXmlDocument.SelectSingleNode("/chummer/weapons/weapon[name = \"" + frmPickWeapon.SelectedWeapon + "\"]");
TreeNode objNode = new TreeNode();
Weapon objWeapon = new Weapon(_objCharacter);
objWeapon.Create(objXmlWeapon, _objCharacter, objNode, cmsWeapon, cmsWeaponAccessory, cmsWeaponMod);
_objCharacter.Weapons.Add(objWeapon);
objNode.ContextMenuStrip = cmsWeapon;
treWeapons.Nodes[0].Nodes.Add(objNode);
treWeapons.Nodes[0].Expand();
treWeapons.SelectedNode = objNode;
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
if (frmPickWeapon.AddAgain)
cmdAddWeapon_Click(sender, e);
}
示例5: cmdAddWeapon_Click
private void cmdAddWeapon_Click(object sender, EventArgs e)
{
frmSelectWeapon frmPickWeapon = new frmSelectWeapon(_objCharacter, true);
frmPickWeapon.ShowDialog(this);
// Make sure the dialogue window was not canceled.
if (frmPickWeapon.DialogResult == DialogResult.Cancel)
return;
// Open the Weapons XML file and locate the selected piece.
XmlDocument objXmlDocument = XmlManager.Instance.Load("weapons.xml");
XmlNode objXmlWeapon = objXmlDocument.SelectSingleNode("/chummer/weapons/weapon[name = \"" + frmPickWeapon.SelectedWeapon + "\"]");
TreeNode objNode = new TreeNode();
Weapon objWeapon = new Weapon(_objCharacter);
objWeapon.Create(objXmlWeapon, _objCharacter, objNode, cmsWeapon, cmsWeaponAccessory, cmsWeaponMod);
int intCost = objWeapon.TotalCost;
// Apply a markup if applicable.
if (frmPickWeapon.Markup != 0)
{
double dblCost = Convert.ToDouble(intCost, GlobalOptions.Instance.CultureInfo);
dblCost *= 1 + (Convert.ToDouble(frmPickWeapon.Markup, GlobalOptions.Instance.CultureInfo) / 100.0);
intCost = Convert.ToInt32(dblCost);
}
// Multiply the cost if applicable.
if (objWeapon.TotalAvail.EndsWith(LanguageManager.Instance.GetString("String_AvailRestricted")) && _objOptions.MultiplyRestrictedCost)
intCost *= _objOptions.RestrictedCostMultiplier;
if (objWeapon.TotalAvail.EndsWith(LanguageManager.Instance.GetString("String_AvailForbidden")) && _objOptions.MultiplyForbiddenCost)
intCost *= _objOptions.ForbiddenCostMultiplier;
// Check the item's Cost and make sure the character can afford it.
if (!frmPickWeapon.FreeCost)
{
if (intCost > _objCharacter.Nuyen)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughNuyen"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughNuyen"), MessageBoxButtons.OK, MessageBoxIcon.Information);
if (frmPickWeapon.AddAgain)
cmdAddWeapon_Click(sender, e);
return;
}
else
{
// Create the Expense Log Entry.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intCost * -1, LanguageManager.Instance.GetString("String_ExpensePurchaseWeapon") + " " + objWeapon.DisplayNameShort, ExpenseType.Nuyen, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Nuyen -= intCost;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateNuyen(NuyenExpenseType.AddWeapon, objWeapon.InternalId);
objExpense.Undo = objUndo;
}
}
_objCharacter.Weapons.Add(objWeapon);
objNode.ContextMenuStrip = cmsWeapon;
treWeapons.Nodes[0].Nodes.Add(objNode);
treWeapons.Nodes[0].Expand();
treWeapons.SelectedNode = objNode;
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
if (frmPickWeapon.AddAgain)
cmdAddWeapon_Click(sender, e);
}
示例6: tsWeaponAddUnderbarrel_Click
private void tsWeaponAddUnderbarrel_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_SelectWeaponAccessory"), LanguageManager.Instance.GetString("MessageTitle_SelectWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
catch
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectWeaponAccessory"), LanguageManager.Instance.GetString("MessageTitle_SelectWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (treWeapons.SelectedNode.Level > 1)
treWeapons.SelectedNode = treWeapons.SelectedNode.Parent;
// Get the information for the currently selected Weapon.
foreach (Weapon objCharacterWeapon in _objCharacter.Weapons)
{
if (treWeapons.SelectedNode.Tag.ToString() == objCharacterWeapon.InternalId)
{
if (objCharacterWeapon.InternalId == treWeapons.SelectedNode.Tag.ToString())
{
if (objCharacterWeapon.Category.StartsWith("Cyberware"))
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_CyberwareUnderbarrel"), LanguageManager.Instance.GetString("MessageTitle_WeaponUnderbarrel"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
}
}
// Locate the Weapon that is selected in the tree.
Weapon objSelectedWeapon = (Weapon)_objFunctions.FindEquipment(treWeapons.SelectedNode.Tag.ToString(), _objCharacter.Weapons, typeof(Weapon));
if (objSelectedWeapon == null)
return;
frmSelectWeapon frmPickWeapon = new frmSelectWeapon(_objCharacter, true);
frmPickWeapon.ShowDialog(this);
// Make sure the dialogue window was not canceled.
if (frmPickWeapon.DialogResult == DialogResult.Cancel)
return;
// Open the Weapons XML file and locate the selected piece.
XmlDocument objXmlDocument = XmlManager.Instance.Load("weapons.xml");
XmlNode objXmlWeapon = objXmlDocument.SelectSingleNode("/chummer/weapons/weapon[id = \"" + frmPickWeapon.SelectedWeapon + "\"]");
TreeNode objNode = new TreeNode();
Weapon objWeapon = new Weapon(_objCharacter);
objWeapon.Create(objXmlWeapon, _objCharacter, objNode, cmsWeapon, cmsWeaponAccessory, cmsWeapon);
objWeapon.IsUnderbarrelWeapon = true;
int intCost = objWeapon.TotalCost;
// Apply a markup if applicable.
if (frmPickWeapon.Markup != 0)
{
double dblCost = Convert.ToDouble(intCost, GlobalOptions.Instance.CultureInfo);
dblCost *= 1 + (Convert.ToDouble(frmPickWeapon.Markup, GlobalOptions.Instance.CultureInfo) / 100.0);
intCost = Convert.ToInt32(dblCost);
}
// Check the item's Cost and make sure the character can afford it.
if (!frmPickWeapon.FreeCost)
{
if (intCost > _objCharacter.Nuyen)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughNuyen"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughNuyen"), MessageBoxButtons.OK, MessageBoxIcon.Information);
if (frmPickWeapon.AddAgain)
cmdAddWeapon_Click(sender, e);
return;
}
else
{
// Create the Expense Log Entry.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intCost * -1, LanguageManager.Instance.GetString("String_ExpensePurchaseWeapon") + " " + objWeapon.DisplayNameShort, ExpenseType.Nuyen, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Nuyen -= intCost;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateNuyen(NuyenExpenseType.AddWeapon, objWeapon.InternalId);
objExpense.Undo = objUndo;
}
}
objSelectedWeapon.Weapons.Add(objWeapon);
objNode.ContextMenuStrip = cmsWeapon;
treWeapons.SelectedNode.Nodes.Add(objNode);
treWeapons.SelectedNode.Expand();
treWeapons.SelectedNode = objNode;//
UpdateCharacterInfo();
//.........这里部分代码省略.........
示例7: tsVehicleAddWeaponWeapon_Click
private void tsVehicleAddWeaponWeapon_Click(object sender, EventArgs e)
{
VehicleMod objMod = new VehicleMod(_objCharacter);
// Make sure that a Weapon Mount has been selected.
try
{
// Attempt to locate the selected VehicleMod.
objMod = (VehicleMod)_objFunctions.FindEquipment(treVehicles.SelectedNode.Tag.ToString(), _objCharacter.Vehicles, typeof(VehicleMod));
if (!objMod.WeaponMount)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotAddWeapon"), LanguageManager.Instance.GetString("MessageTitle_CannotAddWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
catch
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotAddWeapon"), LanguageManager.Instance.GetString("MessageTitle_CannotAddWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
frmSelectWeapon frmPickWeapon = new frmSelectWeapon(_objCharacter, true);
frmPickWeapon.ShowDialog();
if (frmPickWeapon.DialogResult == DialogResult.Cancel)
return;
// Open the Weapons XML file and locate the selected piece.
XmlDocument objXmlDocument = XmlManager.Instance.Load("weapons.xml");
XmlNode objXmlWeapon = objXmlDocument.SelectSingleNode("/chummer/weapons/weapon[id = \"" + frmPickWeapon.SelectedWeapon + "\"]");
TreeNode objNode = new TreeNode();
Weapon objWeapon = new Weapon(_objCharacter);
objWeapon.Create(objXmlWeapon, _objCharacter, objNode, cmsVehicleWeapon, cmsVehicleWeaponAccessory, cmsVehicleWeaponMod);
objWeapon.VehicleMounted = true;
int intCost = objWeapon.TotalCost;
// Apply a markup if applicable.
if (frmPickWeapon.Markup != 0)
{
double dblCost = Convert.ToDouble(intCost, GlobalOptions.Instance.CultureInfo);
dblCost *= 1 + (Convert.ToDouble(frmPickWeapon.Markup, GlobalOptions.Instance.CultureInfo) / 100.0);
intCost = Convert.ToInt32(dblCost);
}
if (!frmPickWeapon.FreeCost)
{
// Check the item's Cost and make sure the character can afford it.
if (intCost > _objCharacter.Nuyen)
{
MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughNuyen"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughNuyen"), MessageBoxButtons.OK, MessageBoxIcon.Information);
if (frmPickWeapon.AddAgain)
tsVehicleAddWeaponWeapon_Click(sender, e);
return;
}
else
{
// Create the Expense Log Entry.
ExpenseLogEntry objExpense = new ExpenseLogEntry();
objExpense.Create(intCost * -1, LanguageManager.Instance.GetString("String_ExpensePurchaseVehicleWeapon") + " " + objWeapon.DisplayNameShort, ExpenseType.Nuyen, DateTime.Now);
_objCharacter.ExpenseEntries.Add(objExpense);
_objCharacter.Nuyen -= intCost;
ExpenseUndo objUndo = new ExpenseUndo();
objUndo.CreateNuyen(NuyenExpenseType.AddVehicleWeapon, objWeapon.InternalId);
objExpense.Undo = objUndo;
}
}
objMod.Weapons.Add(objWeapon);
objNode.ContextMenuStrip = cmsVehicleWeapon;
treVehicles.SelectedNode.Nodes.Add(objNode);
treVehicles.SelectedNode.Expand();
if (frmPickWeapon.AddAgain)
tsVehicleAddWeaponWeapon_Click(sender, e);
UpdateCharacterInfo();
_blnIsDirty = true;
UpdateWindowTitle();
}