Worms4Editor/W4Gui/Dialogs/CollectiveSelectionDialog.cs

59 lines
1.5 KiB
C#

using LibW4M.Data;
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 CollectiveSelectionDialog : Form
{
private bool saving = false;
private SaveDataCollective collective;
private SaveDataEntry selectedEntry;
public SaveDataEntry SelectedEntry
{
get
{
return selectedEntry;
}
}
public CollectiveSelectionDialog(SaveDataCollective collective)
{
this.collective = collective;
InitializeComponent();
this.collectiveList.LoadCollective(this.collective);
}
private void CollectiveSelectionDialog_FormClosing(object sender, FormClosingEventArgs e)
{
if (!saving)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
this.saving = true;
}
}
private void selectButton_Click(object sender, EventArgs e)
{
this.selectedEntry = collective[this.collectiveList.CurrentlySelected];
this.saving = true;
this.DialogResult = DialogResult.OK;
this.Close();
}
private void collectiveList_Selected(object sender, EventArgs e)
{
this.selectButton.Enabled = collectiveList.IsItemSelected;
}
}
}