45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
|
using LibW4M.Data.WeaponFactory;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Data;
|
|||
|
using System.Drawing;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using System.Windows.Forms;
|
|||
|
|
|||
|
namespace W4Gui.Dialogs
|
|||
|
{
|
|||
|
public partial class EditWeaponDialog : Form
|
|||
|
{
|
|||
|
WeaponData weapon;
|
|||
|
public EditWeaponDialog(ref WeaponData weapon)
|
|||
|
{
|
|||
|
this.weapon = weapon;
|
|||
|
InitializeComponent();
|
|||
|
weaponsPanel.LoadWeaponData(weapon);
|
|||
|
}
|
|||
|
|
|||
|
private void EditWeaponDialog_FormClosing(object sender, FormClosingEventArgs e)
|
|||
|
{
|
|||
|
if(MessageBox.Show("Are you sure you want to exit?\nyou'll loose any changes you've made to the weapon.", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|||
|
{
|
|||
|
this.DialogResult = DialogResult.None;
|
|||
|
this.Close();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
e.Cancel = true;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void btnSave_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
weaponsPanel.SaveWeaponData(ref weapon);
|
|||
|
this.DialogResult = DialogResult.OK;
|
|||
|
this.Close();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|