Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.WinForms
annotate FrmSelectSystem.cs @ 7:9828ba4f3f36
Closes #43 - Test Ticket for checking into SVN
* First Check-in!
* Did some code changes to allow the app to load default race and system files from the "data" directory.
* Also changed select system dialog so you can actually select a game system.
author | gregmita |
---|---|
date | Sat, 07 Mar 2009 21:08:31 +0000 |
parents | 8935971e307c |
children | 19bdbb80999c |
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; | |
33 | |
34 private GameSystem selectedSystem; | |
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 |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
47 GameSystem[] systems = WarFoundryLoader.GetDefault().GetGameSystems(); |
0 | 48 |
49 lstSystems.DataSource = systems; | |
50 | |
51 /*for (int i = 0; i<systems.Length; i++) | |
52 { | |
53 lstSystems.Items.Add(systems[i].Name); | |
54 | |
55 /*if (systems[i].Matches(defaultSystem)) | |
56 { | |
57 lstSystems.SelectedIndex = i; | |
58 }* / | |
59 }*/ | |
60 } | |
61 | |
62 /// <summary> | |
63 /// Clean up any resources being used. | |
64 /// </summary> | |
65 protected override void Dispose( bool disposing ) | |
66 { | |
67 if( disposing ) | |
68 { | |
69 if(components != null) | |
70 { | |
71 components.Dispose(); | |
72 } | |
73 } | |
74 base.Dispose( disposing ); | |
75 } | |
76 | |
77 #region Windows Form Designer generated code | |
78 /// <summary> | |
79 /// Required method for Designer support - do not modify | |
80 /// the contents of this method with the code editor. | |
81 /// </summary> | |
82 private void InitializeComponent() | |
83 { | |
84 this.lstSystems = new System.Windows.Forms.ListBox(); | |
85 this.bttnSelectSystem = new IBBoard.Windows.Forms.IBBButton(); | |
86 this.lblSystemList = new IBBoard.Windows.Forms.IBBLabel(); | |
87 this.bttnCancel = new IBBoard.Windows.Forms.IBBButton(); | |
88 this.SuspendLayout(); | |
89 // | |
90 // lstSystems | |
91 // | |
92 this.lstSystems.Location = new System.Drawing.Point(80, 8); | |
93 this.lstSystems.Name = "lstSystems"; | |
94 this.lstSystems.Size = new System.Drawing.Size(216, 95); | |
95 this.lstSystems.TabIndex = 0; | |
96 this.lstSystems.SelectedIndexChanged += new System.EventHandler(this.lstSystems_SelectedIndexChanged); | |
97 // | |
98 // bttnSelectSystem | |
99 // | |
100 this.bttnSelectSystem.Enabled = false; | |
101 this.bttnSelectSystem.FlatStyle = System.Windows.Forms.FlatStyle.System; | |
102 this.bttnSelectSystem.Location = new System.Drawing.Point(192, 112); | |
103 this.bttnSelectSystem.Name = "bttnSelectSystem"; | |
104 this.bttnSelectSystem.Size = new System.Drawing.Size(104, 24); | |
105 this.bttnSelectSystem.TabIndex = 1; | |
106 this.bttnSelectSystem.Text = "Select system"; | |
107 this.bttnSelectSystem.Click += new System.EventHandler(this.bttnSelectSystem_Click); | |
108 // | |
109 // lblSystemList | |
110 // | |
111 this.lblSystemList.Location = new System.Drawing.Point(0, 8); | |
112 this.lblSystemList.Name = "lblSystemList"; | |
113 this.lblSystemList.Size = new System.Drawing.Size(80, 80); | |
114 this.lblSystemList.TabIndex = 2; | |
115 this.lblSystemList.Text = "system list"; | |
116 this.lblSystemList.TextAlign = System.Drawing.ContentAlignment.TopRight; | |
117 // | |
118 // bttnCancel | |
119 // | |
120 this.bttnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; | |
121 this.bttnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System; | |
122 this.bttnCancel.Location = new System.Drawing.Point(8, 112); | |
123 this.bttnCancel.Name = "bttnCancel"; | |
124 this.bttnCancel.Size = new System.Drawing.Size(80, 24); | |
125 this.bttnCancel.TabIndex = 3; | |
126 this.bttnCancel.Text = "Cancel"; | |
127 this.bttnCancel.Click += new System.EventHandler(this.bttnCancel_Click); | |
128 // | |
129 // FrmSelectSystem | |
130 // | |
131 this.AcceptButton = this.bttnSelectSystem; | |
132 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); | |
133 this.CancelButton = this.bttnCancel; | |
134 this.ClientSize = new System.Drawing.Size(306, 142); | |
135 this.ControlBox = false; | |
136 this.Controls.Add(this.bttnCancel); | |
137 this.Controls.Add(this.lblSystemList); | |
138 this.Controls.Add(this.bttnSelectSystem); | |
139 this.Controls.Add(this.lstSystems); | |
140 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; | |
141 this.Name = "FrmSelectSystem"; | |
142 this.ShowInTaskbar = false; | |
143 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; | |
144 this.Text = "FrmSelectSystem"; | |
145 this.ResumeLayout(false); | |
146 | |
147 } | |
148 #endregion | |
149 | |
150 private void lstSystems_SelectedIndexChanged(object sender, System.EventArgs e) | |
151 { | |
152 bttnSelectSystem.Enabled = (lstSystems.SelectedIndex>-1); | |
153 } | |
154 | |
155 private void bttnSelectSystem_Click(object sender, System.EventArgs e) | |
156 { | |
7 | 157 // set the selected system |
158 selectedSystem = (GameSystem) lstSystems.SelectedItem; | |
0 | 159 |
7 | 160 this.DialogResult = DialogResult.OK; |
0 | 161 this.Close(); |
162 } | |
163 | |
164 private void bttnCancel_Click(object sender, System.EventArgs e) | |
165 { | |
166 this.DialogResult = DialogResult.Cancel; | |
167 this.Close(); | |
168 } | |
169 | |
170 public GameSystem GameSystem | |
171 { | |
172 get { return selectedSystem; } | |
173 } | |
174 } | |
175 } |