2023-01-13 12:28:44 +00:00
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 )
{
2023-01-13 14:24:53 +00:00
if ( MessageBox . Show ( "Are you sure you want to exit?\nyou'll lose any changes you've made to the weapon." , "Are you sure?" , MessageBoxButtons . YesNo , MessageBoxIcon . Question ) = = DialogResult . Yes )
2023-01-13 12:28:44 +00:00
{
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 ( ) ;
}
}
}