Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.WinForms
annotate FrmSelectSystem.cs @ 30:eb470dc9aaa6
Re #112: WinForms UI won't build on other machines
* Fix problems with reference to IBBoard project going up two levels
* Problems with output path are still out-standing because the available macros are limited and $(HOMEDRIVE)$(HOMEPATH) isn't recognised and interpreted
Also:
* Remove reference to removed log4net.xml file and properties
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 03 Aug 2009 20:07:23 +0000 |
parents | f72a3da5059b |
children | 67c283ea77a7 |
rev | line source |
---|---|
24 | 1 // This file (FrmSelectSystem.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2009 IBBoard. |
2 // | |
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. | |
4 | |
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; | |
15 using IBBoard.WarFoundry.API.Objects; | |
16 using IBBoard.Windows.Forms.I18N; | |
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 private GameSystem selectedSystem; | |
34 | |
35 | |
36 public FrmSelectSystem() | |
37 { | |
38 // | |
39 // Required for Windows Form Designer support | |
40 // | |
41 InitializeComponent(); | |
42 | |
43 ControlTranslator.TranslateControl(this); | |
44 | |
45 lstSystems.Items.Clear(); | |
46 GameSystem[] systems = WarFoundryLoader.GetDefault().GetGameSystems(); | |
47 lstSystems.DataSource = systems; | |
48 lstSystems.DisplayMember = "Name"; | |
49 } | |
50 | |
51 /// <summary> | |
52 /// Clean up any resources being used. | |
53 /// </summary> | |
54 protected override void Dispose( bool disposing ) | |
55 { | |
56 if( disposing ) | |
57 { | |
58 if(components != null) | |
59 { | |
60 components.Dispose(); | |
61 } | |
62 } | |
63 base.Dispose( disposing ); | |
64 } | |
65 | |
66 #region Windows Form Designer generated code | |
67 /// <summary> | |
68 /// Required method for Designer support - do not modify | |
69 /// the contents of this method with the code editor. | |
70 /// </summary> | |
71 private void InitializeComponent() | |
29
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
72 { |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
73 this.lstSystems = new System.Windows.Forms.ListBox(); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
74 this.bttnSelectSystem = new IBBoard.Windows.Forms.IBBButton(); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
75 this.lblSystemList = new IBBoard.Windows.Forms.IBBLabel(); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
76 this.bttnCancel = new IBBoard.Windows.Forms.IBBButton(); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
77 this.SuspendLayout(); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
78 // |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
79 // lstSystems |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
80 // |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
81 this.lstSystems.Location = new System.Drawing.Point(80, 8); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
82 this.lstSystems.Name = "lstSystems"; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
83 this.lstSystems.Size = new System.Drawing.Size(216, 95); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
84 this.lstSystems.TabIndex = 0; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
85 this.lstSystems.DoubleClick += new System.EventHandler(this.lstSystems_DoubleClick); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
86 this.lstSystems.SelectedIndexChanged += new System.EventHandler(this.lstSystems_SelectedIndexChanged); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
87 // |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
88 // bttnSelectSystem |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
89 // |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
90 this.bttnSelectSystem.Enabled = false; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
91 this.bttnSelectSystem.FlatStyle = System.Windows.Forms.FlatStyle.System; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
92 this.bttnSelectSystem.Location = new System.Drawing.Point(192, 112); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
93 this.bttnSelectSystem.Name = "bttnSelectSystem"; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
94 this.bttnSelectSystem.Size = new System.Drawing.Size(104, 24); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
95 this.bttnSelectSystem.TabIndex = 1; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
96 this.bttnSelectSystem.Text = "Select system"; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
97 this.bttnSelectSystem.Click += new System.EventHandler(this.bttnSelectSystem_Click); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
98 // |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
99 // lblSystemList |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
100 // |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
101 this.lblSystemList.Location = new System.Drawing.Point(0, 8); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
102 this.lblSystemList.Name = "lblSystemList"; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
103 this.lblSystemList.Size = new System.Drawing.Size(80, 80); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
104 this.lblSystemList.TabIndex = 2; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
105 this.lblSystemList.Text = "system list"; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
106 this.lblSystemList.TextAlign = System.Drawing.ContentAlignment.TopRight; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
107 // |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
108 // bttnCancel |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
109 // |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
110 this.bttnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
111 this.bttnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
112 this.bttnCancel.Location = new System.Drawing.Point(8, 112); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
113 this.bttnCancel.Name = "bttnCancel"; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
114 this.bttnCancel.Size = new System.Drawing.Size(80, 24); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
115 this.bttnCancel.TabIndex = 3; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
116 this.bttnCancel.Text = "Cancel"; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
117 this.bttnCancel.Click += new System.EventHandler(this.bttnCancel_Click); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
118 // |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
119 // FrmSelectSystem |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
120 // |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
121 this.AcceptButton = this.bttnSelectSystem; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
122 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
123 this.CancelButton = this.bttnCancel; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
124 this.ClientSize = new System.Drawing.Size(306, 142); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
125 this.ControlBox = false; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
126 this.Controls.Add(this.bttnCancel); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
127 this.Controls.Add(this.lblSystemList); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
128 this.Controls.Add(this.bttnSelectSystem); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
129 this.Controls.Add(this.lstSystems); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
130 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
131 this.Name = "FrmSelectSystem"; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
132 this.ShowInTaskbar = false; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
133 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
134 this.Text = "FrmSelectSystem"; |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
135 this.ResumeLayout(false); |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
136 |
24 | 137 } |
138 #endregion | |
139 | |
140 private void lstSystems_SelectedIndexChanged(object sender, System.EventArgs e) | |
141 { | |
142 bttnSelectSystem.Enabled = (lstSystems.SelectedIndex>-1); | |
143 } | |
144 | |
145 private void bttnSelectSystem_Click(object sender, System.EventArgs e) | |
146 { | |
147 selectedSystem = (GameSystem) lstSystems.SelectedItem; | |
148 this.DialogResult = DialogResult.OK; | |
149 this.Close(); | |
150 } | |
151 | |
152 private void bttnCancel_Click(object sender, System.EventArgs e) | |
153 { | |
154 this.DialogResult = DialogResult.Cancel; | |
155 this.Close(); | |
156 } | |
157 | |
158 public GameSystem GameSystem | |
159 { | |
160 get { return selectedSystem; } | |
29
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
161 } |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
162 |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
163 private void lstSystems_DoubleClick(object sender, EventArgs e) |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
164 { |
f72a3da5059b
Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents:
24
diff
changeset
|
165 bttnSelectSystem_Click(null, null); |
24 | 166 } |
167 } | |
168 } |