-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathDeleteRankPopup.cs
34 lines (29 loc) · 1.16 KB
/
DeleteRankPopup.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
// Copyright 2009-2013 Matvei Stefarov <[email protected]>
using System;
using System.Windows.Forms;
namespace fCraft.ConfigGUI {
public sealed partial class DeleteRankPopup : Form {
internal Rank SubstituteRank { get; private set; }
public DeleteRankPopup( Rank deletedRank ) {
InitializeComponent();
foreach ( Rank rank in RankManager.Ranks ) {
if ( rank != deletedRank ) {
cSubstitute.Items.Add( MainForm.ToComboBoxOption( rank ) );
}
}
lWarning.Text = String.Format( lWarning.Text, deletedRank.Name );
cSubstitute.SelectedIndex = cSubstitute.Items.Count - 1;
}
private void cSubstitute_SelectedIndexChanged( object sender, EventArgs e ) {
if ( cSubstitute.SelectedIndex < 0 )
return;
foreach ( Rank rank in RankManager.Ranks ) {
if ( cSubstitute.SelectedItem.ToString() != MainForm.ToComboBoxOption( rank ) )
continue;
SubstituteRank = rank;
bDelete.Enabled = true;
break;
}
}
}
}