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