Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.WinForms
annotate FrmSelectSystem.cs @ 1:42cf06b8f897
Re #8 - Get a working Windows WarFoundry
* Update forms to use new package structures for API objects
* Update forms to use separate control translation
* Remove PIDB file from source control
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 27 Dec 2008 18:39:37 +0000 |
parents | 7dd160dacb60 |
children | 8935971e307c |
rev | line source |
---|---|
0 | 1 using System; |
2 using System.IO; | |
3 using System.Drawing; | |
4 using System.Collections; | |
5 using System.ComponentModel; | |
6 using System.Windows.Forms; | |
7 using IBBoard; | |
8 using IBBoard.Lang; | |
9 using IBBoard.WarFoundry.API; | |
10 using IBBoard.Windows.Forms; | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
11 using IBBoard.WarFoundry.API.Objects; |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
12 using IBBoard.Windows.Forms.I18N; |
0 | 13 |
14 namespace IBBoard.WarFoundry | |
15 { | |
16 /// <summary> | |
17 /// Summary description for FrmSelectSystem. | |
18 /// </summary> | |
19 public class FrmSelectSystem : IBBoard.Windows.Forms.IBBForm | |
20 { | |
21 private System.Windows.Forms.ListBox lstSystems; | |
22 private IBBoard.Windows.Forms.IBBLabel lblSystemList; | |
23 /// <summary> | |
24 /// Required designer variable. | |
25 /// </summary> | |
26 private System.ComponentModel.Container components = null; | |
27 private IBBoard.Windows.Forms.IBBButton bttnCancel; | |
28 private IBBoard.Windows.Forms.IBBButton bttnSelectSystem; | |
29 | |
30 private GameSystem selectedSystem; | |
31 | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
32 public FrmSelectSystem() |
0 | 33 { |
34 // | |
35 // Required for Windows Form Designer support | |
36 // | |
37 InitializeComponent(); | |
38 | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
39 ControlTranslator.TranslateControl(this); |
0 | 40 |
41 lstSystems.Items.Clear(); | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
42 |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
43 GameSystem[] systems = WarFoundryLoader.GetDefault().GetGameSystems(); |
0 | 44 |
45 lstSystems.DataSource = systems; | |
46 | |
47 /*for (int i = 0; i<systems.Length; i++) | |
48 { | |
49 lstSystems.Items.Add(systems[i].Name); | |
50 | |
51 /*if (systems[i].Matches(defaultSystem)) | |
52 { | |
53 lstSystems.SelectedIndex = i; | |
54 }* / | |
55 }*/ | |
56 } | |
57 | |
58 /// <summary> | |
59 /// Clean up any resources being used. | |
60 /// </summary> | |
61 protected override void Dispose( bool disposing ) | |
62 { | |
63 if( disposing ) | |
64 { | |
65 if(components != null) | |
66 { | |
67 components.Dispose(); | |
68 } | |
69 } | |
70 base.Dispose( disposing ); | |
71 } | |
72 | |
73 #region Windows Form Designer generated code | |
74 /// <summary> | |
75 /// Required method for Designer support - do not modify | |
76 /// the contents of this method with the code editor. | |
77 /// </summary> | |
78 private void InitializeComponent() | |
79 { | |
80 this.lstSystems = new System.Windows.Forms.ListBox(); | |
81 this.bttnSelectSystem = new IBBoard.Windows.Forms.IBBButton(); | |
82 this.lblSystemList = new IBBoard.Windows.Forms.IBBLabel(); | |
83 this.bttnCancel = new IBBoard.Windows.Forms.IBBButton(); | |
84 this.SuspendLayout(); | |
85 // | |
86 // lstSystems | |
87 // | |
88 this.lstSystems.Location = new System.Drawing.Point(80, 8); | |
89 this.lstSystems.Name = "lstSystems"; | |
90 this.lstSystems.Size = new System.Drawing.Size(216, 95); | |
91 this.lstSystems.TabIndex = 0; | |
92 this.lstSystems.SelectedIndexChanged += new System.EventHandler(this.lstSystems_SelectedIndexChanged); | |
93 // | |
94 // bttnSelectSystem | |
95 // | |
96 this.bttnSelectSystem.Enabled = false; | |
97 this.bttnSelectSystem.FlatStyle = System.Windows.Forms.FlatStyle.System; | |
98 this.bttnSelectSystem.Location = new System.Drawing.Point(192, 112); | |
99 this.bttnSelectSystem.Name = "bttnSelectSystem"; | |
100 this.bttnSelectSystem.Size = new System.Drawing.Size(104, 24); | |
101 this.bttnSelectSystem.TabIndex = 1; | |
102 this.bttnSelectSystem.Text = "Select system"; | |
103 this.bttnSelectSystem.Click += new System.EventHandler(this.bttnSelectSystem_Click); | |
104 // | |
105 // lblSystemList | |
106 // | |
107 this.lblSystemList.Location = new System.Drawing.Point(0, 8); | |
108 this.lblSystemList.Name = "lblSystemList"; | |
109 this.lblSystemList.Size = new System.Drawing.Size(80, 80); | |
110 this.lblSystemList.TabIndex = 2; | |
111 this.lblSystemList.Text = "system list"; | |
112 this.lblSystemList.TextAlign = System.Drawing.ContentAlignment.TopRight; | |
113 // | |
114 // bttnCancel | |
115 // | |
116 this.bttnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; | |
117 this.bttnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System; | |
118 this.bttnCancel.Location = new System.Drawing.Point(8, 112); | |
119 this.bttnCancel.Name = "bttnCancel"; | |
120 this.bttnCancel.Size = new System.Drawing.Size(80, 24); | |
121 this.bttnCancel.TabIndex = 3; | |
122 this.bttnCancel.Text = "Cancel"; | |
123 this.bttnCancel.Click += new System.EventHandler(this.bttnCancel_Click); | |
124 // | |
125 // FrmSelectSystem | |
126 // | |
127 this.AcceptButton = this.bttnSelectSystem; | |
128 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); | |
129 this.CancelButton = this.bttnCancel; | |
130 this.ClientSize = new System.Drawing.Size(306, 142); | |
131 this.ControlBox = false; | |
132 this.Controls.Add(this.bttnCancel); | |
133 this.Controls.Add(this.lblSystemList); | |
134 this.Controls.Add(this.bttnSelectSystem); | |
135 this.Controls.Add(this.lstSystems); | |
136 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; | |
137 this.Name = "FrmSelectSystem"; | |
138 this.ShowInTaskbar = false; | |
139 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; | |
140 this.Text = "FrmSelectSystem"; | |
141 this.ResumeLayout(false); | |
142 | |
143 } | |
144 #endregion | |
145 | |
146 private void lstSystems_SelectedIndexChanged(object sender, System.EventArgs e) | |
147 { | |
148 bttnSelectSystem.Enabled = (lstSystems.SelectedIndex>-1); | |
149 } | |
150 | |
151 private void bttnSelectSystem_Click(object sender, System.EventArgs e) | |
152 { | |
153 // selectedSystem = lstSystems. | |
154 //TODO: Set game system | |
155 | |
156 this.DialogResult = DialogResult.OK; | |
157 this.Close(); | |
158 } | |
159 | |
160 private void bttnCancel_Click(object sender, System.EventArgs e) | |
161 { | |
162 this.DialogResult = DialogResult.Cancel; | |
163 this.Close(); | |
164 } | |
165 | |
166 public GameSystem GameSystem | |
167 { | |
168 get { return selectedSystem; } | |
169 } | |
170 } | |
171 } |