Worms4Editor/W4Gui/Dialogs/CollectiveSelectionDialog.cs

53 lines
1.4 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 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)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
private void selectButton_Click(object sender, EventArgs e)
{
this.selectedEntry = collective[this.collectiveList.CurrentlySelected];
this.DialogResult = DialogResult.OK;
this.Close();
}
private void collectiveList_Selected(object sender, EventArgs e)
{
this.selectButton.Enabled = collectiveList.IsItemSelected;
}
}
}