-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathSelectForm.cs
42 lines (34 loc) · 1.3 KB
/
SelectForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Windows.Forms;
using System.IO;
namespace DOOMSaveManager
{
public partial class SelectForm : Form
{
public DoomEternalSavePath SelectedSave;
public SelectForm(string title = "") {
InitializeComponent();
if(!String.IsNullOrEmpty(title))
this.Text = title;
}
private void SelectForm_Load(object sender, EventArgs e) {
selectComboBox.Items.AddRange(DoomEternal.Saves.GetIdentifiers());
if (selectComboBox.Items.Count > 0) {
selectComboBox.SelectedIndex = 0;
}
}
private void selectOkBtn_Click(object sender, EventArgs e) {
if(String.IsNullOrEmpty(selectComboBox.Text)) {
MessageBox.Show("No item has been selected!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if(!DoomEternal.Saves.SaveExists(selectComboBox.Text, out SelectedSave)) {
MessageBox.Show("That item doesn't exist!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
DialogResult = DialogResult.OK;
}
private void selectCancelBtn_Click(object sender, EventArgs e) {
DialogResult = DialogResult.Cancel;
}
}
}