Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.WinForms
annotate FrmSelectSystem.cs @ 10:19bdbb80999c
Closes #47 - Remove magic numbers
* Replace "magic number" -1s in WinForms with WarFoundryCore.INFINITY
Also:
* Code cleanup to remove warnings
* Code cleanup to replace space indentation with tabs
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 19 May 2009 18:51:32 +0000 |
parents | 9828ba4f3f36 |
children | fb55f9f0865e |
rev | line source |
---|---|
3
8935971e307c
Fixes #1 - Correctly license code
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
1 // This file (FrmSelectSystem.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2009 IBBoard. |
8935971e307c
Fixes #1 - Correctly license code
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
2 // |
8935971e307c
Fixes #1 - Correctly license code
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
3 // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. |
8935971e307c
Fixes #1 - Correctly license code
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
4 |
0 | 5 using System; |
6 using System.IO; | |
7 using System.Drawing; | |
8 using System.Collections; | |
9 using System.ComponentModel; | |
10 using System.Windows.Forms; | |
11 using IBBoard; | |
12 using IBBoard.Lang; | |
13 using IBBoard.WarFoundry.API; | |
14 using IBBoard.Windows.Forms; | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
15 using IBBoard.WarFoundry.API.Objects; |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
16 using IBBoard.Windows.Forms.I18N; |
0 | 17 |
18 namespace IBBoard.WarFoundry | |
19 { | |
20 /// <summary> | |
21 /// Summary description for FrmSelectSystem. | |
22 /// </summary> | |
23 public class FrmSelectSystem : IBBoard.Windows.Forms.IBBForm | |
24 { | |
25 private System.Windows.Forms.ListBox lstSystems; | |
26 private IBBoard.Windows.Forms.IBBLabel lblSystemList; | |
27 /// <summary> | |
28 /// Required designer variable. | |
29 /// </summary> | |
30 private System.ComponentModel.Container components = null; | |
31 private IBBoard.Windows.Forms.IBBButton bttnCancel; | |
32 private IBBoard.Windows.Forms.IBBButton bttnSelectSystem; | |
10
19bdbb80999c
Closes #47 - Remove magic numbers
IBBoard <dev@ibboard.co.uk>
parents:
7
diff
changeset
|
33 private GameSystem selectedSystem; |
0 | 34 |
35 | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
36 public FrmSelectSystem() |
0 | 37 { |
38 // | |
39 // Required for Windows Form Designer support | |
40 // | |
41 InitializeComponent(); | |
42 | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
43 ControlTranslator.TranslateControl(this); |
0 | 44 |
45 lstSystems.Items.Clear(); | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
46 GameSystem[] systems = WarFoundryLoader.GetDefault().GetGameSystems(); |
0 | 47 lstSystems.DataSource = systems; |
48 } | |
49 | |
50 /// <summary> | |
51 /// Clean up any resources being used. | |
52 /// </summary> | |
53 protected override void Dispose( bool disposing ) | |
54 { | |
55 if( disposing ) | |
56 { | |
57 if(components != null) | |
58 { | |
59 components.Dispose(); | |
60 } | |
61 } | |
62 base.Dispose( disposing ); | |
63 } | |
64 | |
65 #region Windows Form Designer generated code | |
66 /// <summary> | |
67 /// Required method for Designer support - do not modify | |
68 /// the contents of this method with the code editor. | |
69 /// </summary> | |
70 private void InitializeComponent() | |
71 { | |
72 this.lstSystems = new System.Windows.Forms.ListBox(); | |
73 this.bttnSelectSystem = new IBBoard.Windows.Forms.IBBButton(); | |
74 this.lblSystemList = new IBBoard.Windows.Forms.IBBLabel(); | |
75 this.bttnCancel = new IBBoard.Windows.Forms.IBBButton(); | |
76 this.SuspendLayout(); | |
77 // | |
78 // lstSystems | |
79 // | |
80 this.lstSystems.Location = new System.Drawing.Point(80, 8); | |
81 this.lstSystems.Name = "lstSystems"; | |
82 this.lstSystems.Size = new System.Drawing.Size(216, 95); | |
83 this.lstSystems.TabIndex = 0; | |
84 this.lstSystems.SelectedIndexChanged += new System.EventHandler(this.lstSystems_SelectedIndexChanged); | |
85 // | |
86 // bttnSelectSystem | |
87 // | |
88 this.bttnSelectSystem.Enabled = false; | |
89 this.bttnSelectSystem.FlatStyle = System.Windows.Forms.FlatStyle.System; | |
90 this.bttnSelectSystem.Location = new System.Drawing.Point(192, 112); | |
91 this.bttnSelectSystem.Name = "bttnSelectSystem"; | |
92 this.bttnSelectSystem.Size = new System.Drawing.Size(104, 24); | |
93 this.bttnSelectSystem.TabIndex = 1; | |
94 this.bttnSelectSystem.Text = "Select system"; | |
95 this.bttnSelectSystem.Click += new System.EventHandler(this.bttnSelectSystem_Click); | |
96 // | |
97 // lblSystemList | |
98 // | |
99 this.lblSystemList.Location = new System.Drawing.Point(0, 8); | |
100 this.lblSystemList.Name = "lblSystemList"; | |
101 this.lblSystemList.Size = new System.Drawing.Size(80, 80); | |
102 this.lblSystemList.TabIndex = 2; | |
103 this.lblSystemList.Text = "system list"; | |
104 this.lblSystemList.TextAlign = System.Drawing.ContentAlignment.TopRight; | |
105 // | |
106 // bttnCancel | |
107 // | |
108 this.bttnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; | |
109 this.bttnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System; | |
110 this.bttnCancel.Location = new System.Drawing.Point(8, 112); | |
111 this.bttnCancel.Name = "bttnCancel"; | |
112 this.bttnCancel.Size = new System.Drawing.Size(80, 24); | |
113 this.bttnCancel.TabIndex = 3; | |
114 this.bttnCancel.Text = "Cancel"; | |
115 this.bttnCancel.Click += new System.EventHandler(this.bttnCancel_Click); | |
116 // | |
117 // FrmSelectSystem | |
118 // | |
119 this.AcceptButton = this.bttnSelectSystem; | |
120 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); | |
121 this.CancelButton = this.bttnCancel; | |
122 this.ClientSize = new System.Drawing.Size(306, 142); | |
123 this.ControlBox = false; | |
124 this.Controls.Add(this.bttnCancel); | |
125 this.Controls.Add(this.lblSystemList); | |
126 this.Controls.Add(this.bttnSelectSystem); | |
127 this.Controls.Add(this.lstSystems); | |
128 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; | |
129 this.Name = "FrmSelectSystem"; | |
130 this.ShowInTaskbar = false; | |
131 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; | |
132 this.Text = "FrmSelectSystem"; | |
133 this.ResumeLayout(false); | |
134 | |
135 } | |
136 #endregion | |
137 | |
138 private void lstSystems_SelectedIndexChanged(object sender, System.EventArgs e) | |
139 { | |
140 bttnSelectSystem.Enabled = (lstSystems.SelectedIndex>-1); | |
141 } | |
142 | |
143 private void bttnSelectSystem_Click(object sender, System.EventArgs e) | |
144 { | |
7 | 145 selectedSystem = (GameSystem) lstSystems.SelectedItem; |
146 this.DialogResult = DialogResult.OK; | |
0 | 147 this.Close(); |
148 } | |
149 | |
150 private void bttnCancel_Click(object sender, System.EventArgs e) | |
151 { | |
152 this.DialogResult = DialogResult.Cancel; | |
153 this.Close(); | |
154 } | |
155 | |
156 public GameSystem GameSystem | |
157 { | |
158 get { return selectedSystem; } | |
159 } | |
160 } | |
161 } |