Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.WinForms
annotate FrmMain.cs @ 3:8935971e307c
Fixes #1 - Correctly license code
* Add license header to all WinForms code
* Add COPYING.GPL and COPYING.LGPL to WinForms project
Also:
* Rename .csproj file to match project name
* Remove unused .mdp file
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 01 Mar 2009 15:21:07 +0000 |
parents | 74df258710fe |
children | 26fc79eeda37 |
rev | line source |
---|---|
3
8935971e307c
Fixes #1 - Correctly license code
IBBoard <dev@ibboard.co.uk>
parents:
2
diff
changeset
|
1 // This file (FrmMain.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:
2
diff
changeset
|
2 // |
8935971e307c
Fixes #1 - Correctly license code
IBBoard <dev@ibboard.co.uk>
parents:
2
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:
2
diff
changeset
|
4 |
0 | 5 using System; |
6 using System.Drawing; | |
7 using System.Drawing.Drawing2D; | |
8 using System.Collections; | |
9 using System.ComponentModel; | |
10 using System.Windows.Forms; | |
11 using System.Data; | |
12 using System.IO; | |
13 using System.Threading; | |
14 using IBBoard; | |
15 using IBBoard.CustomMath; | |
16 using IBBoard.Commands; | |
17 using IBBoard.IO; | |
18 using IBBoard.Lang; | |
19 using IBBoard.WarFoundry.API; | |
20 using IBBoard.WarFoundry.API.Commands; | |
21 using IBBoard.Windows.Forms; | |
22 using IBBoard.Xml; | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
23 using log4net; |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
24 using IBBoard.WarFoundry.API.Objects; |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
25 using IBBoard.Windows.Forms.I18N; |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
26 using IBBoard.WarFoundry.API.Savers; |
0 | 27 |
28 namespace IBBoard.WarFoundry | |
29 { | |
30 /// <summary> | |
31 /// Summary description for Form1. | |
32 /// </summary> | |
33 public class FrmMain : System.Windows.Forms.Form | |
34 { | |
35 private static readonly string AppTitle = "WarFoundry"; | |
36 | |
37 private Preferences preferences; | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
38 protected readonly ILog logger = LogManager.GetLogger(typeof(FrmMain)); |
0 | 39 |
40 private CommandStack commandStack; | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
41 private ToolBarButton[] categoryButtons; |
0 | 42 |
43 public ObjectAddDelegate UnitAddedMethod; | |
44 public ObjectRemoveDelegate UnitRemovedMethod; | |
45 public DoubleValChangedDelegate PointsValueChangedMethod; | |
46 //public FailedUnitRequirementDelegate FailedUnitRequirementMethod; | |
47 | |
48 private FrmArmyTree armyTree; | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
49 private FrmDebugOutput debugWindow; |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
50 private string loadedFilePath; |
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
51 |
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
52 private System.ComponentModel.IContainer components; |
0 | 53 private System.Windows.Forms.ToolBar toolBar; |
54 private IBBoard.Windows.Forms.IBBToolBarButton bttnNewArmy; | |
55 private System.Windows.Forms.ImageList buttonIcons; | |
56 private IBBoard.Windows.Forms.IBBToolBarButton bttnSaveArmy; | |
57 private System.Windows.Forms.OpenFileDialog openArmyDialog; | |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
58 private System.Windows.Forms.SaveFileDialog saveArmyDialog; |
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
59 private IBBoard.Windows.Forms.IBBToolBarButton bttnOpenArmy; |
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
60 private IBBoard.Windows.Forms.IBBToolBarButton bttnSep1; |
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
61 private IBBoard.Windows.Forms.IBBToolBarButton bttnUndo; |
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
62 private IBBoard.Windows.Forms.IBBToolBarButton bttnRedo; |
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
63 private System.Windows.Forms.MainMenu mainMenu; |
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
64 private IBBoard.Windows.Forms.IBBMenuItem menuFile; |
0 | 65 private IBBoard.Windows.Forms.IBBMenuItem miNewArmy; |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
66 private IBBoard.Windows.Forms.IBBMenuItem miOpenArmy; |
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
67 private IBBoard.Windows.Forms.IBBMenuItem miCloseArmy; |
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
68 private IBBoard.Windows.Forms.IBBMenuItem miSaveArmy; |
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
69 private IBBoard.Windows.Forms.IBBMenuItem miSaveArmyAs; |
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
70 private System.Windows.Forms.MenuItem miSep2; |
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
71 private IBBoard.Windows.Forms.IBBMenuItem miChangeSystem; |
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
72 private System.Windows.Forms.MenuItem miSep1; |
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
73 private IBBoard.Windows.Forms.IBBMenuItem miReloadFiles; |
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
74 private System.Windows.Forms.MenuItem miSep3; |
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
75 private IBBoard.Windows.Forms.IBBMenuItem miExit; |
0 | 76 private IBBoard.Windows.Forms.IBBMenuItem menuEdit; |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
77 private IBBoard.Windows.Forms.IBBMenuItem miUndo; |
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
78 private IBBoard.Windows.Forms.IBBMenuItem miRedo; |
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
79 private IBBoard.Windows.Forms.IBBMenuItem menuHelp; |
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
80 private IBBoard.Windows.Forms.IBBMenuItem miDebugWindow; |
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
81 private IBBoard.Windows.Forms.IBBMenuItem miAbout; |
0 | 82 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbMainPanel; |
83 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbErrorPanel; | |
84 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbPointsPanel; | |
85 private System.Windows.Forms.ContextMenu undoMenu; | |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
86 private System.Windows.Forms.ContextMenu redoMenu; |
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
87 private IBBoard.Windows.Forms.ColorableStatusBar statusBar; |
0 | 88 private System.Windows.Forms.Timer statusBarTimer; |
89 private System.Windows.Forms.Panel pnlRight; | |
90 | |
91 public FrmMain(string[] args) | |
92 { | |
93 this.Closing+=new CancelEventHandler(FrmMain_Closing); | |
94 CommandStack.CommandStackUpdated+=new MethodInvoker(commandStack_CommandStackUpdated); | |
95 | |
96 InitializeComponent(); | |
97 | |
98 Preferences = new Preferences("WarFoundry"); | |
99 Translation.InitialiseTranslations(Constants.ExecutablePath, Preferences["language"].ToString()); | |
100 | |
101 //pnlRight.Left = ClientSize.Width - pnlRight.Width - 2; | |
102 //pnlRight.Top = toolBar.Height + 5; | |
103 //pnlRight.Height = ClientRectangle.Bottom - statusBar.Height - pnlRight.Top - 3; | |
104 | |
105 foreach (Control ctrl in Controls) | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
106 { |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
107 ControlTranslator.TranslateControl(ctrl); |
0 | 108 } |
109 | |
110 foreach(Component comp in components.Components) | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
111 { |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
112 ControlTranslator.TranslateComponent(comp); |
0 | 113 } |
114 | |
115 foreach (IBBMenuItem mi in Menu.MenuItems) | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
116 { |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
117 ControlTranslator.TranslateComponent(mi); |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
118 } |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
119 |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
120 ControlTranslator.TranslateComponent(openArmyDialog); |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
121 ControlTranslator.TranslateComponent(saveArmyDialog); |
0 | 122 |
123 WarFoundryCore.GameSystemChanged+= new GameSystemChangedDelegate(FrmMain_GameSystemChanged); | |
124 WarFoundryCore.ArmyChanged += new ArmyChangedDelegate(FrmMain_ArmyChanged); | |
125 UnitAddedMethod = new ObjectAddDelegate(FrmMain_UnitAddedMethod); | |
126 UnitRemovedMethod = new ObjectRemoveDelegate(FrmMain_UnitRemovedMethod); | |
127 PointsValueChangedMethod = new DoubleValChangedDelegate(FrmMain_PointsValueChangedMethod); | |
128 //FailedUnitRequirementMethod = new FailedUnitRequirementDelegate(FrmMain_FailedUnitRequirement); | |
129 | |
130 sbErrorPanel.Color = Color.Red; | |
131 | |
132 armyTree = new FrmArmyTree(CommandStack); | |
133 armyTree.MdiParent = this; | |
134 armyTree.Show(); | |
135 armyTree.StartPosition = FormStartPosition.Manual; | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
136 armyTree.Location = new Point(this.DisplayRectangle.Width - armyTree.Width - 10, 10); |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
137 ControlTranslator.TranslateControl(armyTree); |
0 | 138 |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
139 /* |
0 | 140 if (args.Length == 1) |
141 { | |
142 logger.Debug("Attempting to load from file"); | |
143 FileInfo file = new FileInfo(args[0]); | |
144 | |
145 try | |
146 { | |
147 if (file.Extension.Equals("."+Factory.GetArmyFileExtension())) | |
148 { | |
149 WarFoundryCore.CurrentArmy = Factory.CreateArmyFromFile(file); | |
150 logger.InfoFormat("Loaded army from {0}", file.FullName); | |
151 } | |
152 else if (file.Extension.Equals("."+Factory.GetSystemFileExtension())) | |
153 { | |
154 WarFoundryCore.CurrentGameSystem = Factory.CreateGameSystemFromFile(file); | |
155 logger.InfoFormat("Loaded game system from {0}", file.FullName); | |
156 } | |
157 } | |
158 catch (InvalidFileException ex) | |
159 { | |
160 MessageBox.Show(Translation.GetTranslation("InvalidFileLoadError", "The file loaded ({0}) was not a valid WarFoundry file", file.FullName), Translation.GetTranslation("InvalidFileLoadTitle", "Invalid data file", null), MessageBoxButtons.OK, MessageBoxIcon.Error); | |
161 logger.Error(ex); | |
162 } | |
163 } | |
164 else | |
165 { | |
166 string gameSystemID = Preferences.GetStringProperty("currSystem"); | |
167 | |
168 if (gameSystemID!=null && !"".Equals(gameSystemID)) | |
169 { | |
170 logger.Debug("Attempting to load current game system from properties"); | |
171 GameSystem sys = Factory.GetGameSystem(gameSystemID); | |
172 | |
173 if (sys!=null) | |
174 { | |
175 WarFoundryCore.CurrentGameSystem = sys; | |
176 logger.InfoFormat("Loaded game system {0} from properties", gameSystemID); | |
177 } | |
178 } | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
179 }*/ |
0 | 180 } |
181 | |
182 public static string DataPath | |
183 { | |
184 get { return Constants.ExecutablePath+Constants.DirectoryChar+"data"; } | |
185 } | |
186 | |
187 public static String ArmiesPath | |
188 { | |
189 get { return Constants.UserDataPath+Constants.DirectoryChar+"armies"; } | |
190 } | |
191 | |
192 public Preferences Preferences | |
193 { | |
194 get { return preferences; } | |
195 set { preferences = value; } | |
196 } | |
197 | |
198 public CommandStack CommandStack | |
199 { | |
200 get | |
201 { | |
202 if (commandStack == null) | |
203 { | |
204 commandStack = new CommandStack(); | |
205 } | |
206 | |
207 return commandStack; | |
208 } | |
209 } | |
210 | |
211 /// <summary> | |
212 /// Clean up any resources being used. | |
213 /// </summary> | |
214 protected override void Dispose( bool disposing ) | |
215 { | |
216 if( disposing ) | |
217 { | |
218 if (components != null) | |
219 { | |
220 components.Dispose(); | |
221 } | |
222 } | |
223 base.Dispose( disposing ); | |
224 } | |
225 | |
226 #region Windows Form Designer generated code | |
227 /// <summary> | |
228 /// Required method for Designer support - do not modify | |
229 /// the contents of this method with the code editor. | |
230 /// </summary> | |
231 private void InitializeComponent() | |
232 { | |
233 this.components = new System.ComponentModel.Container(); | |
234 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain)); | |
235 this.statusBar = new IBBoard.Windows.Forms.ColorableStatusBar(); | |
236 this.sbMainPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); | |
237 this.sbErrorPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); | |
238 this.sbPointsPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel(); | |
239 this.toolBar = new System.Windows.Forms.ToolBar(); | |
240 this.bttnNewArmy = new IBBoard.Windows.Forms.IBBToolBarButton(); | |
241 this.bttnOpenArmy = new IBBoard.Windows.Forms.IBBToolBarButton(); | |
242 this.bttnSaveArmy = new IBBoard.Windows.Forms.IBBToolBarButton(); | |
243 this.bttnSep1 = new IBBoard.Windows.Forms.IBBToolBarButton(); | |
244 this.bttnUndo = new IBBoard.Windows.Forms.IBBToolBarButton(); | |
245 this.undoMenu = new System.Windows.Forms.ContextMenu(); | |
246 this.bttnRedo = new IBBoard.Windows.Forms.IBBToolBarButton(); | |
247 this.redoMenu = new System.Windows.Forms.ContextMenu(); | |
248 this.buttonIcons = new System.Windows.Forms.ImageList(this.components); | |
249 this.mainMenu = new System.Windows.Forms.MainMenu(this.components); | |
250 this.menuFile = new IBBoard.Windows.Forms.IBBMenuItem(); | |
251 this.miNewArmy = new IBBoard.Windows.Forms.IBBMenuItem(); | |
252 this.miOpenArmy = new IBBoard.Windows.Forms.IBBMenuItem(); | |
253 this.miSaveArmy = new IBBoard.Windows.Forms.IBBMenuItem(); | |
254 this.miSaveArmyAs = new IBBoard.Windows.Forms.IBBMenuItem(); | |
255 this.miCloseArmy = new IBBoard.Windows.Forms.IBBMenuItem(); | |
256 this.miSep1 = new System.Windows.Forms.MenuItem(); | |
257 this.miChangeSystem = new IBBoard.Windows.Forms.IBBMenuItem(); | |
258 this.miSep2 = new System.Windows.Forms.MenuItem(); | |
259 this.miReloadFiles = new IBBoard.Windows.Forms.IBBMenuItem(); | |
260 this.miSep3 = new System.Windows.Forms.MenuItem(); | |
261 this.miExit = new IBBoard.Windows.Forms.IBBMenuItem(); | |
262 this.menuEdit = new IBBoard.Windows.Forms.IBBMenuItem(); | |
263 this.miUndo = new IBBoard.Windows.Forms.IBBMenuItem(); | |
264 this.miRedo = new IBBoard.Windows.Forms.IBBMenuItem(); | |
265 this.menuHelp = new IBBoard.Windows.Forms.IBBMenuItem(); | |
266 this.miAbout = new IBBoard.Windows.Forms.IBBMenuItem(); | |
267 this.miDebugWindow = new IBBoard.Windows.Forms.IBBMenuItem(); | |
268 this.openArmyDialog = new System.Windows.Forms.OpenFileDialog(); | |
269 this.saveArmyDialog = new System.Windows.Forms.SaveFileDialog(); | |
270 this.pnlRight = new System.Windows.Forms.Panel(); | |
271 this.statusBarTimer = new System.Windows.Forms.Timer(this.components); | |
272 ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).BeginInit(); | |
273 ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).BeginInit(); | |
274 ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).BeginInit(); | |
275 this.SuspendLayout(); | |
276 // | |
277 // statusBar | |
278 // | |
279 this.statusBar.Location = new System.Drawing.Point(0, 548); | |
280 this.statusBar.Name = "statusBar"; | |
281 this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] { | |
282 this.sbMainPanel, | |
283 this.sbErrorPanel, | |
284 this.sbPointsPanel}); | |
285 this.statusBar.ShowPanels = true; | |
286 this.statusBar.Size = new System.Drawing.Size(792, 22); | |
287 this.statusBar.TabIndex = 1; | |
288 this.statusBar.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.statusBar_PanelClick); | |
289 this.statusBar.DrawItem += new System.Windows.Forms.StatusBarDrawItemEventHandler(this.statusBar_DrawItem); | |
290 // | |
291 // sbMainPanel | |
292 // | |
293 this.sbMainPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring; | |
294 this.sbMainPanel.Color = System.Drawing.SystemColors.WindowText; | |
295 this.sbMainPanel.Name = "sbMainPanel"; | |
296 this.sbMainPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; | |
297 this.sbMainPanel.Width = 475; | |
298 // | |
299 // sbErrorPanel | |
300 // | |
301 this.sbErrorPanel.Color = System.Drawing.SystemColors.WindowText; | |
302 this.sbErrorPanel.Name = "sbErrorPanel"; | |
303 this.sbErrorPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; | |
304 this.sbErrorPanel.Width = 150; | |
305 // | |
306 // sbPointsPanel | |
307 // | |
308 this.sbPointsPanel.Color = System.Drawing.SystemColors.WindowText; | |
309 this.sbPointsPanel.Name = "sbPointsPanel"; | |
310 this.sbPointsPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw; | |
311 this.sbPointsPanel.ToolTipText = "Current Points Total"; | |
312 this.sbPointsPanel.Width = 150; | |
313 // | |
314 // toolBar | |
315 // | |
316 this.toolBar.Appearance = System.Windows.Forms.ToolBarAppearance.Flat; | |
317 this.toolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] { | |
318 this.bttnNewArmy, | |
319 this.bttnOpenArmy, | |
320 this.bttnSaveArmy, | |
321 this.bttnSep1, | |
322 this.bttnUndo, | |
323 this.bttnRedo}); | |
324 this.toolBar.ButtonSize = new System.Drawing.Size(16, 16); | |
325 this.toolBar.DropDownArrows = true; | |
326 this.toolBar.ImageList = this.buttonIcons; | |
327 this.toolBar.Location = new System.Drawing.Point(0, 0); | |
328 this.toolBar.Name = "toolBar"; | |
329 this.toolBar.ShowToolTips = true; | |
330 this.toolBar.Size = new System.Drawing.Size(792, 28); | |
331 this.toolBar.TabIndex = 2; | |
332 this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick); | |
333 // | |
334 // bttnNewArmy | |
335 // | |
336 this.bttnNewArmy.Enabled = false; | |
337 this.bttnNewArmy.ImageIndex = 0; | |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
338 this.bttnNewArmy.Name = "bttnNewArmy"; |
0 | 339 // |
340 // bttnOpenArmy | |
341 // | |
342 this.bttnOpenArmy.ImageIndex = 2; | |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
343 this.bttnOpenArmy.Name = "bttnOpenArmy"; |
0 | 344 // |
345 // bttnSaveArmy | |
346 // | |
347 this.bttnSaveArmy.Enabled = false; | |
348 this.bttnSaveArmy.ImageIndex = 1; | |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
349 this.bttnSaveArmy.Name = "bttnSaveArmy"; |
0 | 350 // |
351 // bttnSep1 | |
352 // | |
353 this.bttnSep1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator; | |
354 // | |
355 // bttnUndo | |
356 // | |
357 this.bttnUndo.DropDownMenu = this.undoMenu; | |
358 this.bttnUndo.Enabled = false; | |
359 this.bttnUndo.ImageIndex = 3; | |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
360 this.bttnUndo.Name = "bttnUndo"; |
0 | 361 this.bttnUndo.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton; |
362 // | |
363 // bttnRedo | |
364 // | |
365 this.bttnRedo.DropDownMenu = this.redoMenu; | |
366 this.bttnRedo.Enabled = false; | |
367 this.bttnRedo.ImageIndex = 4; | |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
368 this.bttnRedo.Name = "bttnRedo"; |
0 | 369 this.bttnRedo.Style = System.Windows.Forms.ToolBarButtonStyle.DropDownButton; |
370 // | |
371 // buttonIcons | |
372 // | |
373 this.buttonIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("buttonIcons.ImageStream"))); | |
374 this.buttonIcons.TransparentColor = System.Drawing.Color.Transparent; | |
375 this.buttonIcons.Images.SetKeyName(0, ""); | |
376 this.buttonIcons.Images.SetKeyName(1, ""); | |
377 this.buttonIcons.Images.SetKeyName(2, ""); | |
378 this.buttonIcons.Images.SetKeyName(3, ""); | |
379 this.buttonIcons.Images.SetKeyName(4, ""); | |
380 this.buttonIcons.Images.SetKeyName(5, ""); | |
381 this.buttonIcons.Images.SetKeyName(6, ""); | |
382 // | |
383 // mainMenu | |
384 // | |
385 this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { | |
386 this.menuFile, | |
387 this.menuEdit, | |
388 this.menuHelp}); | |
389 // | |
390 // menuFile | |
391 // | |
392 this.menuFile.Index = 0; | |
393 this.menuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { | |
394 this.miNewArmy, | |
395 this.miOpenArmy, | |
396 this.miSaveArmy, | |
397 this.miSaveArmyAs, | |
398 this.miCloseArmy, | |
399 this.miSep1, | |
400 this.miChangeSystem, | |
401 this.miSep2, | |
402 this.miReloadFiles, | |
403 this.miSep3, | |
404 this.miExit}); | |
405 this.menuFile.Text = "&file"; | |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
406 this.menuFile.Name = "menuFile"; |
0 | 407 // |
408 // miNewArmy | |
409 // | |
410 this.miNewArmy.Index = 0; | |
411 this.miNewArmy.Text = "&new army"; | |
412 this.miNewArmy.Click += new System.EventHandler(this.miNewArmy_Click); | |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
413 this.miNewArmy.Name = "miNewArmy"; |
0 | 414 // |
415 // miOpenArmy | |
416 // | |
417 this.miOpenArmy.Index = 1; | |
418 this.miOpenArmy.Text = "&open army"; | |
419 this.miOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click); | |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
420 this.miOpenArmy.Name = "miOpenArmy"; |
0 | 421 // |
422 // miSaveArmy | |
423 // | |
424 this.miSaveArmy.Enabled = false; | |
425 this.miSaveArmy.Index = 2; | |
426 this.miSaveArmy.Text = "&save army"; | |
427 this.miSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click); | |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
428 this.miSaveArmy.Name = "miSaveArmy"; |
0 | 429 // |
430 // miSaveArmyAs | |
431 // | |
432 this.miSaveArmyAs.Enabled = false; | |
433 this.miSaveArmyAs.Index = 3; | |
434 this.miSaveArmyAs.Text = "save army &as..."; | |
435 this.miSaveArmyAs.Click += new System.EventHandler(this.miSaveArmyAs_Click); | |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
436 this.miSaveArmyAs.Name = "miSaveArmyAs"; |
0 | 437 // |
438 // miCloseArmy | |
439 // | |
440 this.miCloseArmy.Enabled = false; | |
441 this.miCloseArmy.Index = 4; | |
442 this.miCloseArmy.Text = "&close army"; | |
443 this.miCloseArmy.Click += new System.EventHandler(this.miCloseArmy_Click); | |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
444 this.miCloseArmy.Name = "miCloseArmy"; |
0 | 445 // |
446 // miSep1 | |
447 // | |
448 this.miSep1.Index = 5; | |
449 this.miSep1.Text = "-"; | |
450 // | |
451 // miChangeSystem | |
452 // | |
453 this.miChangeSystem.Index = 6; | |
454 this.miChangeSystem.Text = "change &game system"; | |
455 this.miChangeSystem.Click += new System.EventHandler(this.miChangeSystem_Click); | |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
456 this.miChangeSystem.Name = "miChangeSystem"; |
0 | 457 // |
458 // miSep2 | |
459 // | |
460 this.miSep2.Index = 7; | |
461 this.miSep2.Text = "-"; | |
462 // | |
463 // miReloadFiles | |
464 // | |
465 this.miReloadFiles.Index = 8; | |
466 this.miReloadFiles.Text = "&reload files"; | |
467 this.miReloadFiles.Click += new System.EventHandler(this.miReloadFiles_Click); | |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
468 this.miReloadFiles.Name = "miReloadFiles"; |
0 | 469 // |
470 // miSep3 | |
471 // | |
472 this.miSep3.Index = 9; | |
473 this.miSep3.Text = "-"; | |
474 // | |
475 // miExit | |
476 // | |
477 this.miExit.Index = 10; | |
478 this.miExit.Text = "e&xit"; | |
479 this.miExit.Click += new System.EventHandler(this.miExit_Click); | |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
480 this.miExit.Name = "miExit"; |
0 | 481 // |
482 // menuEdit | |
483 // | |
484 this.menuEdit.Index = 1; | |
485 this.menuEdit.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { | |
486 this.miUndo, | |
487 this.miRedo}); | |
488 this.menuEdit.Text = "&edit"; | |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
489 this.menuEdit.Name = "menuEdit"; |
0 | 490 // |
491 // miUndo | |
492 // | |
493 this.miUndo.Enabled = false; | |
494 this.miUndo.Index = 0; | |
495 this.miUndo.Text = "&undo"; | |
496 this.miUndo.Click += new System.EventHandler(this.miUndo_Click); | |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
497 this.miUndo.Name = "miUndo"; |
0 | 498 // |
499 // miRedo | |
500 // | |
501 this.miRedo.Enabled = false; | |
502 this.miRedo.Index = 1; | |
503 this.miRedo.Text = "&redo"; | |
504 this.miRedo.Click += new System.EventHandler(this.miRedo_Click); | |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
505 this.miRedo.Name = "miRedo"; |
0 | 506 // |
507 // menuHelp | |
508 // | |
509 this.menuHelp.Index = 2; | |
510 this.menuHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { | |
511 this.miAbout, | |
512 this.miDebugWindow}); | |
513 this.menuHelp.Text = "&help"; | |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
514 this.menuHelp.Name = "menuHelp"; |
0 | 515 // |
516 // miAbout | |
517 // | |
518 this.miAbout.Enabled = false; | |
519 this.miAbout.Index = 0; | |
520 this.miAbout.Text = "&about"; | |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
521 this.miAbout.Name = "miAbout"; |
0 | 522 // |
523 // miDebugWindow | |
524 // | |
525 this.miDebugWindow.Index = 1; | |
526 this.miDebugWindow.Text = "&debug"; | |
527 this.miDebugWindow.Click += new System.EventHandler(this.miDebugWindow_Click); | |
2
74df258710fe
Fixes #8 - Update SWF version of WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
528 this.miDebugWindow.Name = "miDebugWindow"; |
0 | 529 // |
530 // saveArmyDialog | |
531 // | |
532 this.saveArmyDialog.Title = "Translatable:saveArmyDialog"; | |
533 // | |
534 // pnlRight | |
535 // | |
536 this.pnlRight.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | |
537 | System.Windows.Forms.AnchorStyles.Right))); | |
538 this.pnlRight.BackColor = System.Drawing.SystemColors.AppWorkspace; | |
539 this.pnlRight.Location = new System.Drawing.Point(726, 30); | |
540 this.pnlRight.Name = "pnlRight"; | |
541 this.pnlRight.Size = new System.Drawing.Size(64, 516); | |
542 this.pnlRight.TabIndex = 4; | |
543 this.pnlRight.Visible = false; | |
544 this.pnlRight.Paint += new System.Windows.Forms.PaintEventHandler(this.pnlRight_Paint); | |
545 // | |
546 // statusBarTimer | |
547 // | |
548 this.statusBarTimer.Interval = 5000; | |
549 this.statusBarTimer.Tick += new System.EventHandler(this.statusBarTimer_Tick); | |
550 // | |
551 // FrmMain | |
552 // | |
553 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); | |
554 this.ClientSize = new System.Drawing.Size(792, 570); | |
555 this.Controls.Add(this.pnlRight); | |
556 this.Controls.Add(this.toolBar); | |
557 this.Controls.Add(this.statusBar); | |
558 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); | |
559 this.IsMdiContainer = true; | |
560 this.Menu = this.mainMenu; | |
561 this.Name = "FrmMain"; | |
562 this.Text = "WarFoundry"; | |
563 ((System.ComponentModel.ISupportInitialize)(this.sbMainPanel)).EndInit(); | |
564 ((System.ComponentModel.ISupportInitialize)(this.sbErrorPanel)).EndInit(); | |
565 ((System.ComponentModel.ISupportInitialize)(this.sbPointsPanel)).EndInit(); | |
566 this.ResumeLayout(false); | |
567 this.PerformLayout(); | |
568 | |
569 } | |
570 #endregion | |
571 | |
572 /// <summary> | |
573 /// The main entry point for the application. | |
574 /// </summary> | |
575 [STAThread] | |
576 static void Main(string[] args) | |
577 { | |
578 try | |
579 { | |
580 ///TODO: Work out how to auto-embed the Manifest file so that we can have visual styles without having a .manifest file floating around | |
581 //and without using the line below, which causes the toolbar buttons to lose their icons | |
582 //Application.EnableVisualStyles(); | |
583 Application.Run(new FrmMain(args)); | |
584 } | |
585 catch(Exception ex) | |
586 { | |
587 LogManager.GetLogger(typeof(FrmMain)).Fatal(ex); | |
588 MessageBox.Show(null, "A major, unexpected and fatal error ocurred while starting the application: \r\n\r\n"+ex.Message+"\r\n\r\n"+ex.StackTrace, "Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Error); | |
589 } | |
590 } | |
591 | |
592 private void miExit_Click(object sender, System.EventArgs e) | |
593 { | |
594 Application.Exit(); | |
595 } | |
596 | |
597 private void miNewArmy_Click(object sender, System.EventArgs e) | |
598 { | |
599 createNewArmy(); | |
600 } | |
601 | |
602 private void createNewArmy() | |
603 { | |
604 if (closeCurrentArmy()) | |
605 { | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
606 FrmNewArmy newArmy = new FrmNewArmy(CurrentGameSystem); |
0 | 607 DialogResult dr = newArmy.ShowDialog(); |
608 | |
609 if (dr == DialogResult.OK) | |
610 { | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
611 CurrentArmy = new Army(newArmy.SelectedRace, newArmy.ArmyName, newArmy.ArmySize); |
0 | 612 } |
613 } | |
614 } | |
615 | |
616 private bool openArmy() | |
617 { | |
618 if (closeCurrentArmy()) | |
619 { | |
620 if (openArmyDialog.Filter=="") | |
621 { | |
622 string savePath = ArmiesPath; | |
623 | |
624 if (!Directory.Exists(savePath)) | |
625 { | |
626 Directory.CreateDirectory(savePath); | |
627 } | |
628 | |
629 openArmyDialog.InitialDirectory = savePath; | |
630 openArmyDialog.Filter = Translation.GetTranslation("armyFileFilter")+"|*.army"; | |
631 openArmyDialog.Title = Translation.GetTranslation("openArmyDialog"); | |
632 | |
633 } | |
634 | |
635 DialogResult dr = openArmyDialog.ShowDialog(this); | |
636 | |
637 if (dr == DialogResult.OK) | |
638 { | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
639 /* |
0 | 640 try |
641 { | |
642 CurrentArmy = Factory.LoadArmy(openArmyDialog.FileName); | |
643 return true; | |
644 } | |
645 catch (InvalidFileException ex) | |
646 { | |
647 logger.Error(ex); | |
648 MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidFileBoxTitle", "Invalid data file"), MessageBoxButtons.OK, MessageBoxIcon.Error); | |
649 return false; | |
650 } | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
651 * */ |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
652 return false; |
0 | 653 } |
654 else | |
655 { | |
656 return false; | |
657 } | |
658 } | |
659 else | |
660 { | |
661 return false; | |
662 } | |
663 } | |
664 | |
665 private bool closeCurrentArmy() | |
666 { | |
667 if (CurrentArmy!=null) | |
668 { | |
669 bool canClose = false; | |
670 | |
671 if (CommandStack.IsDirty()) | |
672 { | |
673 DialogResult dr = MessageBox.Show(this, "The army \""+CurrentArmy.Name+"\" has been modified.\r\nSave changes before closing army?", "Unsaved changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button3); | |
674 | |
675 if (dr == DialogResult.Yes) | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
676 { |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
677 canClose = SaveCurrentArmy(); |
0 | 678 } |
679 else if (dr == DialogResult.No) | |
680 { | |
681 canClose = true; | |
682 } | |
683 //else they said cancel and we default to "canClose = false" so do nothing | |
684 } | |
685 else | |
686 { | |
687 canClose = true; | |
688 } | |
689 | |
690 if (canClose) | |
691 { | |
692 //do close | |
693 disableCategoryButtons(); | |
694 CurrentArmy = null; | |
695 return true; | |
696 } | |
697 else | |
698 { | |
699 return false; | |
700 } | |
701 } | |
702 else | |
703 { | |
704 disableCategoryButtons(); | |
705 //pretend we succeeded | |
706 return true; | |
707 } | |
708 } | |
709 | |
710 private void undoLastAction() | |
711 { | |
712 if (commandStack.CanUndo()) | |
713 { | |
714 commandStack.Undo(); | |
715 } | |
716 } | |
717 | |
718 private void redoAction() | |
719 { | |
720 if (commandStack.CanRedo()) | |
721 { | |
722 commandStack.Redo(); | |
723 } | |
724 } | |
725 | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
726 private bool SaveCurrentArmy() |
0 | 727 { |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
728 bool saved = false; |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
729 |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
730 if (loadedFilePath != null || PromptForFilePath()) |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
731 { |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
732 saved = SaveCurrentArmyToFile(); |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
733 } |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
734 |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
735 return saved; |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
736 } |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
737 |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
738 private bool SaveCurrentArmyAs() |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
739 { |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
740 bool saved = false; |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
741 |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
742 if (PromptForFilePath()) |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
743 { |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
744 saved = SaveCurrentArmyToFile(); |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
745 } |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
746 |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
747 return saved; |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
748 } |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
749 |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
750 private bool SaveCurrentArmyToFile() |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
751 { |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
752 if (WarFoundrySaver.GetSaver().Save(CurrentArmy, loadedFilePath)) |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
753 { |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
754 miSaveArmy.Enabled = false; |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
755 bttnSaveArmy.Enabled = false; |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
756 CommandStack.setCleanMark(); |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
757 return true; |
0 | 758 } |
759 else | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
760 { |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
761 loadedFilePath = null; |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
762 MessageBox.Show(this, Translation.GetTranslation("SaveFailed"), Translation.GetTranslation("SaveFailedTitle"), MessageBoxButtons.OK, MessageBoxIcon.Error); |
0 | 763 return false; |
764 } | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
765 } |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
766 |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
767 private bool PromptForFilePath() |
0 | 768 { |
769 if (saveArmyDialog.Filter == "") | |
770 { | |
771 string savePath = ArmiesPath; | |
772 | |
773 if (!Directory.Exists(savePath)) | |
774 { | |
775 Directory.CreateDirectory(savePath); | |
776 } | |
777 | |
778 saveArmyDialog.InitialDirectory = savePath; | |
779 saveArmyDialog.Filter = Translation.GetTranslation("armyFileFilter")+"|*.army"; | |
780 saveArmyDialog.Title = Translation.GetTranslation("saveArmyDialog"); | |
781 } | |
782 | |
783 DialogResult dr = saveArmyDialog.ShowDialog(this); | |
784 | |
785 if (dr == DialogResult.OK) | |
786 { | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
787 loadedFilePath = saveArmyDialog.FileName; |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
788 return true; |
0 | 789 } |
790 else | |
791 { | |
792 return false; | |
793 } | |
794 } | |
795 | |
796 private void toolBar_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e) | |
797 { | |
798 if (e.Button == bttnUndo) | |
799 { | |
800 undoLastAction(); | |
801 } | |
802 else if (e.Button == bttnRedo) | |
803 { | |
804 redoAction(); | |
805 } | |
806 else if (e.Button == bttnNewArmy) | |
807 { | |
808 createNewArmy(); | |
809 } | |
810 else if (e.Button == bttnOpenArmy) | |
811 { | |
812 openArmy(); | |
813 } | |
814 else if (e.Button == bttnSaveArmy) | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
815 { |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
816 SaveCurrentArmy(); |
0 | 817 } |
818 else | |
819 { | |
820 //it must be one of our extra buttons for the categories | |
821 addUnitFromCategory((Category)e.Button.Tag); | |
822 } | |
823 } | |
824 | |
825 private GameSystem CurrentGameSystem | |
826 { | |
827 get { return WarFoundryCore.CurrentGameSystem; } | |
828 set { WarFoundryCore.CurrentGameSystem = value; } | |
829 } | |
830 | |
831 private static Army CurrentArmy | |
832 { | |
833 get { return WarFoundryCore.CurrentArmy; } | |
834 set { WarFoundryCore.CurrentArmy = value; } | |
835 } | |
836 | |
837 private void SelectGameSystem() | |
838 { | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
839 FrmSelectSystem selectSystem = new FrmSelectSystem(); |
0 | 840 DialogResult dr = selectSystem.ShowDialog(this); |
841 | |
842 if (dr==DialogResult.OK) | |
843 { | |
844 closeCurrentArmy(); | |
845 CurrentGameSystem = selectSystem.GameSystem; | |
846 } | |
847 } | |
848 | |
849 private void miChangeSystem_Click(object sender, System.EventArgs e) | |
850 { | |
851 SelectGameSystem(); | |
852 } | |
853 | |
854 private void FrmMain_GameSystemChanged(GameSystem oldSystem, GameSystem newSystem) | |
855 { | |
856 miNewArmy.Enabled = newSystem != null; | |
857 bttnNewArmy.Enabled = newSystem != null; | |
858 setAppTitle(); | |
859 removeCategoryButtons(); | |
860 addCategoryButtons(); | |
861 } | |
862 | |
863 private void FrmMain_ArmyChanged(Army oldArmy, Army newArmy) | |
864 { | |
865 setAppTitle(); | |
866 | |
867 if (oldArmy != null) | |
868 { | |
869 oldArmy.UnitAdded += UnitAddedMethod; | |
870 oldArmy.UnitRemoved += UnitRemovedMethod; | |
871 oldArmy.PointsValueChanged += PointsValueChangedMethod; | |
872 } | |
873 | |
874 if (CurrentArmy==null) | |
875 { | |
876 miSaveArmyAs.Enabled = false; | |
877 miCloseArmy.Enabled = false; | |
878 disableCategoryButtons(); | |
879 } | |
880 else | |
881 { | |
882 newArmy.UnitAdded += UnitAddedMethod; | |
883 newArmy.UnitRemoved += UnitRemovedMethod; | |
884 newArmy.PointsValueChanged += PointsValueChangedMethod; | |
885 //TODO: Clear all buttons | |
886 miSaveArmyAs.Enabled = true; | |
887 miCloseArmy.Enabled = true; | |
888 enableCategoryButtons(); | |
889 | |
890 if (newArmy.Race.HasCategoryOverrides()) | |
891 { | |
892 removeCategoryButtons(); | |
893 addCategoryButtons(newArmy.Race.Categories); | |
894 } | |
895 } | |
896 | |
897 CommandStack.Reset(); | |
898 | |
899 miSaveArmy.Enabled = false; | |
900 bttnSaveArmy.Enabled = false; | |
901 | |
902 setPointsPanelText(); | |
903 } | |
904 | |
905 private void addCategoryButtons() | |
906 { | |
907 if (CurrentGameSystem!=null) | |
908 { | |
909 addCategoryButtons(CurrentGameSystem.Categories); | |
910 } | |
911 } | |
912 | |
913 private void addCategoryButtons(Category[] cats) | |
914 { | |
915 int catCount = cats.Length; | |
916 Category cat; | |
917 categoryButtons = new ToolBarButton[catCount+1]; | |
918 | |
919 ToolBarButton sep = new ToolBarButton(); | |
920 sep.Style = ToolBarButtonStyle.Separator; | |
921 categoryButtons[0] = sep; | |
922 | |
923 IBBToolBarButton button; | |
924 | |
925 for (int i = 0; i<catCount; i++) | |
926 { | |
927 cat = cats[i]; | |
928 button = new IBBToolBarButton(); | |
929 ///button.Name = "bttnAddCategory" + cat.Name[0].ToString(); | |
930 button.Text = cat.Name.ToString();//String.Format(Translation.GetTranslation("bttnAddCategory"), cat.Name); | |
931 button.Tag = cat; | |
932 button.ImageIndex = 6; | |
933 button.Enabled = false; | |
934 categoryButtons[i+1] = button; | |
935 } | |
936 | |
937 this.Invoke(new ToolBarButtonRangeDelegate(toolBar.Buttons.AddRange), new object[]{categoryButtons}); | |
938 } | |
939 | |
940 private void removeCategoryButtons() | |
941 { | |
942 if (categoryButtons!=null) | |
943 { | |
944 for (int i = 0; i<categoryButtons.Length; i++) | |
945 { | |
946 this.Invoke(new ToolBarButtonDelegate(toolBar.Buttons.Remove), new object[]{categoryButtons[i]}); | |
947 } | |
948 } | |
949 } | |
950 | |
951 private void enableCategoryButtons() | |
952 { | |
953 setCategoryButtonState(true); | |
954 } | |
955 | |
956 private void disableCategoryButtons() | |
957 { | |
958 setCategoryButtonState(false); | |
959 } | |
960 | |
961 private void setCategoryButtonState(bool state) | |
962 { | |
963 if (categoryButtons!=null) | |
964 { | |
965 for (int i = 0; i<categoryButtons.Length; i++) | |
966 { | |
967 categoryButtons[i].Enabled = state; | |
968 } | |
969 } | |
970 } | |
971 | |
972 private void miSaveArmyAs_Click(object sender, System.EventArgs e) | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
973 { |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
974 SaveCurrentArmyAs(); |
0 | 975 } |
976 | |
977 private void commandStack_CommandStackUpdated() | |
978 { | |
979 bttnUndo.Enabled = commandStack.CanUndo(); | |
980 miUndo.Enabled = bttnUndo.Enabled; | |
981 bttnRedo.Enabled = commandStack.CanRedo(); | |
982 miRedo.Enabled = bttnRedo.Enabled; | |
983 MenuItem[] menuItems = null; | |
984 int redoLength = commandStack.RedoLength; | |
985 int maxRedo = Math.Min(10, redoLength); | |
986 | |
987 if (redoLength > 0) | |
988 { | |
989 menuItems = new MenuItem[maxRedo]; | |
990 Command com; | |
991 MenuItem mi; | |
992 | |
993 for (int i = 0; i < maxRedo; i++) | |
994 { | |
995 com = commandStack.PeekRedoCommand(i+1); | |
996 | |
997 if (com == null) | |
998 { | |
999 break; | |
1000 } | |
1001 | |
1002 mi = new MenuItem(com.Description); | |
1003 mi.Click+=new EventHandler(redoMenu_Click); | |
1004 menuItems[i] = mi; | |
1005 } | |
1006 } | |
1007 | |
1008 redoMenu.MenuItems.Clear(); | |
1009 | |
1010 if (menuItems!=null && menuItems[0]!=null) | |
1011 { | |
1012 bttnRedo.ToolTipText = menuItems[0].Text; | |
1013 redoMenu.MenuItems.AddRange(menuItems); | |
1014 } | |
1015 | |
1016 int undoLength = commandStack.UndoLength; | |
1017 int maxUndo = Math.Min(10, undoLength); | |
1018 MenuItem[] menuItemsUndo = null; | |
1019 | |
1020 if (undoLength > 0) | |
1021 { | |
1022 menuItemsUndo = new MenuItem[maxUndo]; | |
1023 Command com; | |
1024 MenuItem mi; | |
1025 | |
1026 for (int i = 0; i < maxUndo; i++) | |
1027 { | |
1028 com = commandStack.PeekUndoCommand(i+1); | |
1029 | |
1030 if (com == null) | |
1031 { | |
1032 break; | |
1033 } | |
1034 | |
1035 mi = new MenuItem(com.UndoDescription); | |
1036 mi.Click+=new EventHandler(undoMenu_Click); | |
1037 menuItemsUndo[i] = mi; | |
1038 } | |
1039 } | |
1040 | |
1041 undoMenu.MenuItems.Clear(); | |
1042 | |
1043 if (menuItemsUndo!=null && menuItemsUndo[0]!=null) | |
1044 { | |
1045 bttnUndo.ToolTipText = menuItemsUndo[0].Text; | |
1046 undoMenu.MenuItems.AddRange(menuItemsUndo); | |
1047 } | |
1048 | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
1049 bool canSave = loadedFilePath != null; |
0 | 1050 bttnSaveArmy.Enabled = commandStack.IsDirty() && CurrentArmy!=null && canSave; |
1051 miSaveArmy.Enabled = commandStack.IsDirty() && CurrentArmy!=null && canSave; | |
1052 } | |
1053 | |
1054 private void miSaveArmy_Click(object sender, System.EventArgs e) | |
1055 { | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
1056 SaveCurrentArmy(); |
0 | 1057 } |
1058 | |
1059 private void setAppTitle() | |
1060 { | |
1061 string str = AppTitle; | |
1062 | |
1063 if (CurrentGameSystem!=null) | |
1064 { | |
1065 str+= " - "+CurrentGameSystem.Name; | |
1066 } | |
1067 | |
1068 if (CurrentArmy!=null) | |
1069 { | |
1070 str+= " - "+CurrentArmy.Name; | |
1071 } | |
1072 | |
1073 this.Text = str; | |
1074 } | |
1075 | |
1076 private void addUnitFromCategory(Category cat) | |
1077 { | |
1078 FrmNewUnit newUnit = new FrmNewUnit(CurrentArmy.Race, cat, CurrentArmy); | |
1079 DialogResult dr = newUnit.ShowDialog(this); | |
1080 | |
1081 if (dr == DialogResult.OK) | |
1082 { | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
1083 CreateAndAddUnitCommand cmd = new CreateAndAddUnitCommand(newUnit.SelectedUnit, cat, CurrentArmy); |
0 | 1084 commandStack.Execute(cmd); |
1085 } | |
1086 } | |
1087 | |
1088 private void FrmMain_UnitAddedMethod(object unitObj) | |
1089 { | |
1090 if (unitObj is Unit) | |
1091 { | |
1092 Unit unit = (Unit)unitObj; | |
1093 sbErrorPanel.Text = ""; | |
1094 } | |
1095 } | |
1096 | |
1097 private void FrmMain_UnitRemovedMethod(object unitObj) | |
1098 { | |
1099 if (unitObj is Unit) | |
1100 { | |
1101 Unit unit = (Unit)unitObj; | |
1102 sbErrorPanel.Text = ""; | |
1103 | |
1104 //check if window is open, and close it if it is | |
1105 foreach (Form frm in this.MdiChildren) | |
1106 { | |
1107 if (frm is FrmUnit) | |
1108 { | |
1109 if (((FrmUnit)frm).Unit == unit) | |
1110 { | |
1111 frm.Close(); | |
1112 break; | |
1113 } | |
1114 } | |
1115 } | |
1116 } | |
1117 } | |
1118 | |
1119 /*private void FrmMain_FailedUnitRequirement(FailedUnitRequirement failedRequirement) | |
1120 { | |
1121 sbErrorPanel.Text = Translation.GetTranslation("UnitRequirementFailed", "Unit Requirement Failed"); | |
1122 sbErrorPanel.Tag = failedRequirement.Description; | |
1123 }*/ | |
1124 | |
1125 /*public void MdiChildMoved() | |
1126 { | |
1127 Point mouseAt = PointToClient(ActiveMdiChild.Location); | |
1128 | |
1129 if (Comparisons.ValueWithinAmount(pnlRight.Right, ActiveMdiChild.Right, 10)) | |
1130 { | |
1131 pnlRight.Visible = true; | |
1132 //pnlRight.Container.Add(ActiveMdiChild); | |
1133 } | |
1134 else | |
1135 { | |
1136 pnlRight.Visible = false; | |
1137 } | |
1138 }*/ | |
1139 | |
1140 public void pnlRight_Paint(object sender, System.Windows.Forms.PaintEventArgs e) | |
1141 { | |
1142 HatchBrush dockCueBrush = new HatchBrush(HatchStyle.LightDownwardDiagonal, Color.White, Color.Gray); | |
1143 Pen dockCuePen = new Pen(dockCueBrush, 10); | |
1144 e.Graphics.DrawRectangle(dockCuePen, new Rectangle(pnlRight.Left, pnlRight.Top, pnlRight.Width, pnlRight.Height)); | |
1145 } | |
1146 | |
1147 private void miUndo_Click(object sender, System.EventArgs e) | |
1148 { | |
1149 undoLastAction(); | |
1150 } | |
1151 | |
1152 private void miRedo_Click(object sender, System.EventArgs e) | |
1153 { | |
1154 redoAction(); | |
1155 } | |
1156 | |
1157 private void miCloseArmy_Click(object sender, EventArgs e) | |
1158 { | |
1159 closeCurrentArmy(); | |
1160 } | |
1161 | |
1162 private void miOpenArmy_Click(object sender, EventArgs e) | |
1163 { | |
1164 openArmy(); | |
1165 } | |
1166 | |
1167 private void FrmMain_PointsValueChangedMethod(WarFoundryObject obj, double oldVal, double newVal) | |
1168 { | |
1169 if (obj is Army) | |
1170 { | |
1171 setPointsPanelText(); | |
1172 } | |
1173 } | |
1174 | |
1175 private void setPointsPanelText() | |
1176 { | |
1177 if (CurrentArmy==null) | |
1178 { | |
1179 sbPointsPanel.Text = ""; | |
1180 sbPointsPanel.ResetColor(); | |
1181 } | |
1182 else | |
1183 { | |
1184 sbPointsPanel.Text = String.Format(Translation.GetTranslation("statusPanelPoints"), CurrentArmy.PointsTotal, CurrentArmy.MaxPoints); | |
1185 | |
1186 if (CurrentArmy.PointsTotal>CurrentArmy.MaxPoints) | |
1187 { | |
1188 sbPointsPanel.Color = Color.Red; | |
1189 } | |
1190 else | |
1191 { | |
1192 sbPointsPanel.ResetColor(); | |
1193 } | |
1194 } | |
1195 } | |
1196 | |
1197 private void redoMenu_Click(object sender, EventArgs e) | |
1198 { | |
1199 if (sender is MenuItem) | |
1200 { | |
1201 MenuItem mi = (MenuItem)sender; | |
1202 | |
1203 if (mi.Parent == redoMenu) | |
1204 { | |
1205 //we know it's an redo menu item so find it's index and redo everything | |
1206 int max = mi.Index; | |
1207 | |
1208 for (int i = 0; i <= max; i++) | |
1209 { | |
1210 commandStack.Redo(); | |
1211 } | |
1212 } | |
1213 } | |
1214 } | |
1215 | |
1216 private void undoMenu_Click(object sender, EventArgs e) | |
1217 { | |
1218 if (sender is MenuItem) | |
1219 { | |
1220 MenuItem mi = (MenuItem)sender; | |
1221 | |
1222 if (mi.Parent == undoMenu) | |
1223 { | |
1224 //we know it's an undo menu item so find it's index and undo everything | |
1225 int max = mi.Index; | |
1226 for (int i = 0; i <= max; i++) | |
1227 { | |
1228 commandStack.Undo(); | |
1229 } | |
1230 } | |
1231 } | |
1232 } | |
1233 | |
1234 private void statusBar_DrawItem(object sender, System.Windows.Forms.StatusBarDrawItemEventArgs sbdevent) | |
1235 { | |
1236 statusBar.ColorableStatusBarDrawItem(sender, sbdevent); | |
1237 } | |
1238 | |
1239 private void miDebugWindow_Click(object sender, EventArgs e) | |
1240 { | |
1241 if (debugWindow == null || debugWindow.IsDisposed) | |
1242 { | |
1243 debugWindow = new FrmDebugOutput(); | |
1244 } | |
1245 | |
1246 debugWindow.Show(); | |
1247 debugWindow.Focus(); | |
1248 } | |
1249 | |
1250 private void FrmMain_Closing(object sender, CancelEventArgs e) | |
1251 { | |
1252 if (!closeCurrentArmy()) | |
1253 { | |
1254 e.Cancel = true; | |
1255 } | |
1256 } | |
1257 | |
1258 private void miReloadFiles_Click(object sender, System.EventArgs e) | |
1259 { | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
1260 WarFoundryLoader.GetDefault().LoadFiles(); |
0 | 1261 sbMainPanel.Text = Translation.GetTranslation("GameSystemFilesReloaded", "Game system and race files reloaded"); |
1262 statusBarTimer.Enabled = true; | |
1263 } | |
1264 | |
1265 private void statusBarTimer_Tick(object sender, System.EventArgs e) | |
1266 { | |
1267 sbMainPanel.Text = ""; | |
1268 statusBarTimer.Enabled = false; | |
1269 } | |
1270 | |
1271 private void statusBar_PanelClick(object sender, StatusBarPanelClickEventArgs e) | |
1272 { | |
1273 if (e.StatusBarPanel == sbErrorPanel && sbErrorPanel.Text!="") | |
1274 { | |
1275 MessageBox.Show(this, sbErrorPanel.TagString, Translation.GetTranslation("FailedRequirementMessage"), MessageBoxButtons.OK, MessageBoxIcon.Warning); | |
1276 } | |
1277 } | |
1278 } | |
1279 } |