annotate FrmMain.cs @ 135:c095c57a56f9

* Update version number to 0.1b8pre - all other work so far was a dud no-open-ticket
author IBBoard <dev@ibboard.co.uk>
date Sat, 03 Apr 2010 15:51:22 +0000
parents e381ec627d14
children ce63500e0ec1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
134
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1 // This file (FrmMain.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2007, 2008, 2009 IBBoard.
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
2 //
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license.
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
4
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
5 using System;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
6 using System.Collections.Generic;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
7 using System.Drawing;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
8 using System.Drawing.Drawing2D;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
9 using System.ComponentModel;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
10 using System.Windows.Forms;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
11 using System.Data;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
12 using System.IO;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
13 using System.Threading;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
14 using log4net;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
15 using IBBoard;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
16 using IBBoard.CustomMath;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
17 using IBBoard.Commands;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
18 using IBBoard.IO;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
19 using IBBoard.Lang;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
20 using IBBoard.Windows.Forms;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
21 using IBBoard.Windows.Forms.I18N;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
22 using IBBoard.Xml;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
23 using IBBoard.WarFoundry.API;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
24 using IBBoard.WarFoundry.API.Commands;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
25 using IBBoard.WarFoundry.API.Exporters;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
26 using IBBoard.WarFoundry.API.Objects;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
27 using IBBoard.WarFoundry.API.Savers;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
28 using IBBoard.WarFoundry.API.Factories;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
29 using IBBoard.WarFoundry.API.Factories.Xml;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
30
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
31 namespace IBBoard.WarFoundry.GUI.WinForms
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
32 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
33 /// <summary>
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
34 /// Summary description for Form1.
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
35 /// </summary>
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
36 public class FrmMain : System.Windows.Forms.Form
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
37 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
38 private static readonly string AppTitle = "WarFoundry";
135
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
39 internal static readonly string VERSION = "0.1b8pre";
134
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
40 const string DefaultDataDir = "data";
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
41
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
42 private Preferences preferences;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
43 private readonly ILog log = LogManager.GetLogger(typeof(FrmMain));
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
44
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
45 private CommandStack commandStack;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
46
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
47 public ObjectAddDelegate UnitAddedMethod;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
48 public ObjectRemoveDelegate UnitRemovedMethod;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
49 public DoubleValChangedDelegate PointsValueChangedMethod;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
50 //public FailedUnitRequirementDelegate FailedUnitRequirementMethod;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
51
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
52 private FrmArmyTree armyTree;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
53 private string loadedFilePath;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
54 private Dictionary<string, FrmUnit> unitWindows;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
55
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
56 private System.ComponentModel.IContainer components;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
57 private System.Windows.Forms.OpenFileDialog openArmyDialog;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
58 private System.Windows.Forms.SaveFileDialog saveArmyDialog;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
59 private System.Windows.Forms.MainMenu mainMenu;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
60 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbMainPanel;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
61 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbErrorPanel;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
62 private IBBoard.Windows.Forms.ColorableStatusBarPanel sbPointsPanel;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
63 private System.Windows.Forms.ContextMenu undoMenu;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
64 private System.Windows.Forms.ContextMenu redoMenu;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
65 private IBBoard.Windows.Forms.ColorableStatusBar statusBar;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
66 private System.Windows.Forms.Timer statusBarTimer;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
67 private MenuStrip menuStrip;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
68 private IBBToolStripMenuItem menuFile;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
69 private IBBToolStripMenuItem miNewArmy;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
70 private IBBToolStripMenuItem miOpenArmy;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
71 private IBBToolStripMenuItem miSaveArmy;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
72 private IBBToolStripMenuItem miSaveArmyAs;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
73 private IBBToolStripMenuItem miExportArmyAs;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
74 private IBBToolStripMenuItem miExportArmyAsBasicHTML;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
75 private IBBToolStripMenuItem miCloseArmy;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
76 private ToolStripSeparator toolStripSeparator1;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
77 private IBBToolStripMenuItem miReloadFiles;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
78 private ToolStripSeparator toolStripSeparator2;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
79 private IBBToolStripMenuItem miExit;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
80 private IBBToolStripMenuItem menuEdit;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
81 private IBBToolStripMenuItem miUndo;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
82 private IBBToolStripMenuItem miRedo;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
83 private IBBToolStripMenuItem menuHelp;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
84 private ToolStrip mainToolStrip;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
85 private IBBToolStripButton bttnNewArmy;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
86 private IBBToolStripButton bttnOpenArmy;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
87 private IBBToolStripButton bttnSaveArmy;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
88 private ToolStripSeparator toolStripSeparator3;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
89 private IBBToolStripSplitButton bttnUndo;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
90 private IBBToolStripSplitButton bttnRedo;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
91 private ToolStrip catToolStrip;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
92 private ToolStripPanel toolStripPanel;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
93 private IBBToolStripMenuItem miAbout;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
94
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
95 /// <summary>
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
96 /// The main entry point for the application.
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
97 /// </summary>
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
98 [STAThread]
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
99 static void Main(string[] args)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
100 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
101 try
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
102 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
103 LogManager.GetLogger(typeof(FrmMain)).Info("Starting WarFoundry WinForms");
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
104 Application.EnableVisualStyles();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
105 Application.Run(new FrmMain(args));
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
106 LogManager.GetLogger(typeof(FrmMain)).Info("Closing WarFoundry WinForms");
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
107 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
108 catch (Exception ex)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
109 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
110 LogManager.GetLogger(typeof(FrmMain)).Fatal(ex);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
111 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);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
112 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
113 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
114
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
115 public FrmMain(string[] args)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
116 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
117 this.Closing+=new CancelEventHandler(FrmMain_Closing);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
118 CommandStack.CommandStackUpdated += new MethodInvoker(commandStack_CommandStackUpdated);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
119
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
120 InitializeComponent();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
121 toolStripPanel.Join(mainToolStrip, 0, 0);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
122 toolStripPanel.Join(catToolStrip, mainToolStrip.Right, 0);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
123
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
124 Preferences = new Preferences("WarFoundry");
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
125 try
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
126 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
127 Translation.InitialiseTranslations(Constants.ExecutablePath, Preferences["language"].ToString());
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
128 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
129 catch (TranslationLoadException ex)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
130 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
131 log.Error("Translation loading failed for language " + Preferences["language"].ToString(), ex);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
132 MessageBox.Show(this, "Translation loading failed for language " + Preferences["language"].ToString(), "Translation failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
133 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
134
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
135 ControlTranslator.TranslateControls(Controls);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
136 ControlTranslator.TranslateComponents(components.Components);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
137 ControlTranslator.TranslateComponent(openArmyDialog);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
138 ControlTranslator.TranslateComponent(saveArmyDialog);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
139 unitWindows = new Dictionary<string, FrmUnit>();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
140
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
141 WarFoundryCore.GameSystemChanged+= new GameSystemChangedDelegate(FrmMain_GameSystemChanged);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
142 WarFoundryCore.ArmyChanged += new ArmyChangedDelegate(FrmMain_ArmyChanged);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
143 UnitAddedMethod = new ObjectAddDelegate(FrmMain_UnitAddedMethod);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
144 UnitRemovedMethod = new ObjectRemoveDelegate(FrmMain_UnitRemovedMethod);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
145 PointsValueChangedMethod = new DoubleValChangedDelegate(FrmMain_PointsValueChangedMethod);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
146 //FailedUnitRequirementMethod = new FailedUnitRequirementDelegate(FrmMain_FailedUnitRequirement);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
147
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
148 sbErrorPanel.Color = Color.Red;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
149 sbPointsPanel.ToolTipText = Translation.GetTranslation("statusPanelPointsToolTip", "total points value");
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
150
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
151 armyTree = new FrmArmyTree(CommandStack);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
152 armyTree.MdiParent = this;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
153 armyTree.StartPosition = FormStartPosition.Manual;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
154 armyTree.Location = new Point(this.DisplayRectangle.Width - armyTree.Width - 10, 10);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
155 ControlTranslator.TranslateControl(armyTree);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
156
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
157 // hack to load default files
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
158 WarFoundryLoader.GetDefault().AddLoadDirectory(new DirectoryInfo(Constants.ExecutablePath + Constants.DirectoryString + DefaultDataDir));
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
159 WarFoundryLoader.GetDefault().RegisterFactory(WarFoundryXmlFactory.GetFactory());
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
160 WarFoundryLoader.GetDefault().FileLoadingFinished += FileLoadingFinished;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
161 WarFoundrySaver.SetFileSaver(new WarFoundryXmlSaver());
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
162 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
163
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
164 public static string DataPath
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
165 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
166 get { return Constants.ExecutablePath+Constants.DirectoryChar+"data"; }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
167 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
168
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
169 public static String ArmiesPath
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
170 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
171 get { return Environment.GetFolderPath(Environment.SpecialFolder.Personal); }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
172 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
173
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
174 public Preferences Preferences
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
175 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
176 get { return preferences; }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
177 set { preferences = value; }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
178 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
179
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
180 public CommandStack CommandStack
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
181 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
182 get
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
183 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
184 if (commandStack == null)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
185 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
186 commandStack = new CommandStack();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
187 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
188
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
189 return commandStack;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
190 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
191 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
192
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
193 /// <summary>
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
194 /// Clean up any resources being used.
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
195 /// </summary>
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
196 protected override void Dispose( bool disposing )
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
197 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
198 if( disposing )
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
199 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
200 if (components != null)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
201 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
202 components.Dispose();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
203 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
204 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
205 base.Dispose( disposing );
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
206 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
207
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
208 #region Windows Form Designer generated code
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
209 /// <summary>
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
210 /// Required method for Designer support - do not modify
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
211 /// the contents of this method with the code editor.
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
212 /// </summary>
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
213 private void InitializeComponent()
135
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
214 {
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
215 this.components = new System.ComponentModel.Container();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
216 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain));
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
217 this.undoMenu = new System.Windows.Forms.ContextMenu();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
218 this.redoMenu = new System.Windows.Forms.ContextMenu();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
219 this.mainMenu = new System.Windows.Forms.MainMenu(this.components);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
220 this.openArmyDialog = new System.Windows.Forms.OpenFileDialog();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
221 this.saveArmyDialog = new System.Windows.Forms.SaveFileDialog();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
222 this.statusBarTimer = new System.Windows.Forms.Timer(this.components);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
223 this.menuStrip = new System.Windows.Forms.MenuStrip();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
224 this.menuFile = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
225 this.miNewArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
226 this.miOpenArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
227 this.miSaveArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
228 this.miSaveArmyAs = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
229 this.miExportArmyAs = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
230 this.miExportArmyAsBasicHTML = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
231 this.miCloseArmy = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
232 this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
233 this.miReloadFiles = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
234 this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
235 this.miExit = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
236 this.menuEdit = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
237 this.miUndo = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
238 this.miRedo = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
239 this.menuHelp = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
240 this.miAbout = new IBBoard.Windows.Forms.IBBToolStripMenuItem();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
241 this.mainToolStrip = new System.Windows.Forms.ToolStrip();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
242 this.bttnNewArmy = new IBBoard.Windows.Forms.IBBToolStripButton();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
243 this.bttnOpenArmy = new IBBoard.Windows.Forms.IBBToolStripButton();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
244 this.bttnSaveArmy = new IBBoard.Windows.Forms.IBBToolStripButton();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
245 this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
246 this.bttnUndo = new IBBoard.Windows.Forms.IBBToolStripSplitButton();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
247 this.bttnRedo = new IBBoard.Windows.Forms.IBBToolStripSplitButton();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
248 this.catToolStrip = new System.Windows.Forms.ToolStrip();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
249 this.statusBar = new IBBoard.Windows.Forms.ColorableStatusBar();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
250 this.sbMainPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
251 this.sbErrorPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
252 this.sbPointsPanel = new IBBoard.Windows.Forms.ColorableStatusBarPanel();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
253 this.toolStripPanel = new System.Windows.Forms.ToolStripPanel();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
254 this.menuStrip.SuspendLayout();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
255 this.mainToolStrip.SuspendLayout();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
256 ((System.ComponentModel.ISupportInitialize) (this.sbMainPanel)).BeginInit();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
257 ((System.ComponentModel.ISupportInitialize) (this.sbErrorPanel)).BeginInit();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
258 ((System.ComponentModel.ISupportInitialize) (this.sbPointsPanel)).BeginInit();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
259 this.SuspendLayout();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
260 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
261 // saveArmyDialog
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
262 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
263 this.saveArmyDialog.Title = "Translatable:saveArmyDialog";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
264 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
265 // statusBarTimer
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
266 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
267 this.statusBarTimer.Interval = 5000;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
268 this.statusBarTimer.Tick += new System.EventHandler(this.statusBarTimer_Tick);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
269 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
270 // menuStrip
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
271 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
272 this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
273 this.menuFile,
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
274 this.menuEdit,
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
275 this.menuHelp});
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
276 this.menuStrip.Location = new System.Drawing.Point(0, 0);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
277 this.menuStrip.Name = "menuStrip";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
278 this.menuStrip.Size = new System.Drawing.Size(790, 24);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
279 this.menuStrip.TabIndex = 6;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
280 this.menuStrip.Text = "menuStrip1";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
281 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
282 // menuFile
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
283 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
284 this.menuFile.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
285 this.miNewArmy,
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
286 this.miOpenArmy,
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
287 this.miSaveArmy,
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
288 this.miSaveArmyAs,
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
289 this.miExportArmyAs,
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
290 this.miCloseArmy,
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
291 this.toolStripSeparator1,
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
292 this.miReloadFiles,
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
293 this.toolStripSeparator2,
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
294 this.miExit});
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
295 this.menuFile.Name = "menuFile";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
296 this.menuFile.Size = new System.Drawing.Size(33, 20);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
297 this.menuFile.Text = "&file";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
298 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
299 // miNewArmy
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
300 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
301 this.miNewArmy.Name = "miNewArmy";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
302 this.miNewArmy.Size = new System.Drawing.Size(164, 22);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
303 this.miNewArmy.Text = "&new army";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
304 this.miNewArmy.Click += new System.EventHandler(this.miNewArmy_Click);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
305 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
306 // miOpenArmy
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
307 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
308 this.miOpenArmy.Name = "miOpenArmy";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
309 this.miOpenArmy.Size = new System.Drawing.Size(164, 22);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
310 this.miOpenArmy.Text = "&open army";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
311 this.miOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
312 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
313 // miSaveArmy
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
314 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
315 this.miSaveArmy.Enabled = false;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
316 this.miSaveArmy.Name = "miSaveArmy";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
317 this.miSaveArmy.Size = new System.Drawing.Size(164, 22);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
318 this.miSaveArmy.Text = "&save army";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
319 this.miSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
320 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
321 // miSaveArmyAs
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
322 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
323 this.miSaveArmyAs.Enabled = false;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
324 this.miSaveArmyAs.Name = "miSaveArmyAs";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
325 this.miSaveArmyAs.Size = new System.Drawing.Size(164, 22);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
326 this.miSaveArmyAs.Text = "save army &as...";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
327 this.miSaveArmyAs.Click += new System.EventHandler(this.miSaveArmyAs_Click);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
328 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
329 // miExportArmyAs
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
330 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
331 this.miExportArmyAs.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
332 this.miExportArmyAsBasicHTML});
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
333 this.miExportArmyAs.Enabled = false;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
334 this.miExportArmyAs.Name = "miExportArmyAs";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
335 this.miExportArmyAs.Size = new System.Drawing.Size(164, 22);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
336 this.miExportArmyAs.Text = "export army as...";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
337 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
338 // miExportArmyAsBasicHTML
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
339 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
340 this.miExportArmyAsBasicHTML.Name = "miExportArmyAsBasicHTML";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
341 this.miExportArmyAsBasicHTML.Size = new System.Drawing.Size(130, 22);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
342 this.miExportArmyAsBasicHTML.Text = "&basic html";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
343 this.miExportArmyAsBasicHTML.Click += new System.EventHandler(this.miExportArmyAsBasicHTML_Click);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
344 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
345 // miCloseArmy
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
346 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
347 this.miCloseArmy.Enabled = false;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
348 this.miCloseArmy.Name = "miCloseArmy";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
349 this.miCloseArmy.Size = new System.Drawing.Size(164, 22);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
350 this.miCloseArmy.Text = "&close army";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
351 this.miCloseArmy.Click += new System.EventHandler(this.miCloseArmy_Click);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
352 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
353 // toolStripSeparator1
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
354 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
355 this.toolStripSeparator1.Name = "toolStripSeparator1";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
356 this.toolStripSeparator1.Size = new System.Drawing.Size(161, 6);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
357 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
358 // miReloadFiles
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
359 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
360 this.miReloadFiles.Name = "miReloadFiles";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
361 this.miReloadFiles.Size = new System.Drawing.Size(164, 22);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
362 this.miReloadFiles.Text = "&reload files";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
363 this.miReloadFiles.Click += new System.EventHandler(this.miReloadFiles_Click);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
364 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
365 // toolStripSeparator2
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
366 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
367 this.toolStripSeparator2.Name = "toolStripSeparator2";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
368 this.toolStripSeparator2.Size = new System.Drawing.Size(161, 6);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
369 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
370 // miExit
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
371 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
372 this.miExit.Name = "miExit";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
373 this.miExit.Size = new System.Drawing.Size(164, 22);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
374 this.miExit.Text = "e&xit";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
375 this.miExit.Click += new System.EventHandler(this.miExit_Click);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
376 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
377 // menuEdit
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
378 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
379 this.menuEdit.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
380 this.miUndo,
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
381 this.miRedo});
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
382 this.menuEdit.Name = "menuEdit";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
383 this.menuEdit.Size = new System.Drawing.Size(36, 20);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
384 this.menuEdit.Text = "&edit";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
385 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
386 // miUndo
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
387 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
388 this.miUndo.Enabled = false;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
389 this.miUndo.Name = "miUndo";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
390 this.miUndo.Size = new System.Drawing.Size(106, 22);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
391 this.miUndo.Text = "&undo";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
392 this.miUndo.Click += new System.EventHandler(this.miUndo_Click);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
393 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
394 // miRedo
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
395 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
396 this.miRedo.Enabled = false;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
397 this.miRedo.Name = "miRedo";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
398 this.miRedo.Size = new System.Drawing.Size(106, 22);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
399 this.miRedo.Text = "&redo";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
400 this.miRedo.Click += new System.EventHandler(this.miRedo_Click);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
401 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
402 // menuHelp
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
403 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
404 this.menuHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
405 this.miAbout});
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
406 this.menuHelp.Name = "menuHelp";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
407 this.menuHelp.Size = new System.Drawing.Size(39, 20);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
408 this.menuHelp.Text = "&help";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
409 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
410 // miAbout
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
411 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
412 this.miAbout.Name = "miAbout";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
413 this.miAbout.Size = new System.Drawing.Size(109, 22);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
414 this.miAbout.Text = "&about";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
415 this.miAbout.Click += new System.EventHandler(this.miAbout_Click);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
416 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
417 // mainToolStrip
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
418 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
419 this.mainToolStrip.Dock = System.Windows.Forms.DockStyle.None;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
420 this.mainToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
421 this.bttnNewArmy,
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
422 this.bttnOpenArmy,
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
423 this.bttnSaveArmy,
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
424 this.toolStripSeparator3,
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
425 this.bttnUndo,
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
426 this.bttnRedo});
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
427 this.mainToolStrip.Location = new System.Drawing.Point(0, 24);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
428 this.mainToolStrip.Name = "mainToolStrip";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
429 this.mainToolStrip.Size = new System.Drawing.Size(151, 25);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
430 this.mainToolStrip.TabIndex = 8;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
431 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
432 // bttnNewArmy
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
433 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
434 this.bttnNewArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
435 this.bttnNewArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_new;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
436 this.bttnNewArmy.ImageTransparentColor = System.Drawing.Color.Magenta;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
437 this.bttnNewArmy.Name = "bttnNewArmy";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
438 this.bttnNewArmy.Size = new System.Drawing.Size(23, 22);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
439 this.bttnNewArmy.Text = "new army";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
440 this.bttnNewArmy.Click += new System.EventHandler(this.miNewArmy_Click);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
441 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
442 // bttnOpenArmy
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
443 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
444 this.bttnOpenArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
445 this.bttnOpenArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_open;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
446 this.bttnOpenArmy.ImageTransparentColor = System.Drawing.Color.Magenta;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
447 this.bttnOpenArmy.Name = "bttnOpenArmy";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
448 this.bttnOpenArmy.Size = new System.Drawing.Size(23, 22);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
449 this.bttnOpenArmy.Text = "open army";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
450 this.bttnOpenArmy.Click += new System.EventHandler(this.miOpenArmy_Click);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
451 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
452 // bttnSaveArmy
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
453 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
454 this.bttnSaveArmy.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
455 this.bttnSaveArmy.Enabled = false;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
456 this.bttnSaveArmy.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.document_save;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
457 this.bttnSaveArmy.ImageTransparentColor = System.Drawing.Color.Magenta;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
458 this.bttnSaveArmy.Name = "bttnSaveArmy";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
459 this.bttnSaveArmy.Size = new System.Drawing.Size(23, 22);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
460 this.bttnSaveArmy.Text = "save army";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
461 this.bttnSaveArmy.Click += new System.EventHandler(this.miSaveArmy_Click);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
462 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
463 // toolStripSeparator3
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
464 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
465 this.toolStripSeparator3.Name = "toolStripSeparator3";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
466 this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
467 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
468 // bttnUndo
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
469 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
470 this.bttnUndo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
471 this.bttnUndo.Enabled = false;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
472 this.bttnUndo.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_undo;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
473 this.bttnUndo.ImageTransparentColor = System.Drawing.Color.Magenta;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
474 this.bttnUndo.Name = "bttnUndo";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
475 this.bttnUndo.Size = new System.Drawing.Size(32, 22);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
476 this.bttnUndo.Text = "undo";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
477 this.bttnUndo.ButtonClick += new System.EventHandler(this.miUndo_Click);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
478 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
479 // bttnRedo
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
480 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
481 this.bttnRedo.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
482 this.bttnRedo.Enabled = false;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
483 this.bttnRedo.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.edit_redo;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
484 this.bttnRedo.ImageTransparentColor = System.Drawing.Color.Magenta;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
485 this.bttnRedo.Name = "bttnRedo";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
486 this.bttnRedo.Size = new System.Drawing.Size(32, 22);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
487 this.bttnRedo.Text = "redo";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
488 this.bttnRedo.ButtonClick += new System.EventHandler(this.miRedo_Click);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
489 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
490 // catToolStrip
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
491 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
492 this.catToolStrip.Dock = System.Windows.Forms.DockStyle.None;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
493 this.catToolStrip.Location = new System.Drawing.Point(161, 24);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
494 this.catToolStrip.Name = "catToolStrip";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
495 this.catToolStrip.Size = new System.Drawing.Size(111, 25);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
496 this.catToolStrip.TabIndex = 9;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
497 this.catToolStrip.Visible = false;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
498 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
499 // statusBar
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
500 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
501 this.statusBar.Location = new System.Drawing.Point(0, 586);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
502 this.statusBar.Name = "statusBar";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
503 this.statusBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
504 this.sbMainPanel,
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
505 this.sbErrorPanel,
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
506 this.sbPointsPanel});
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
507 this.statusBar.ShowPanels = true;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
508 this.statusBar.Size = new System.Drawing.Size(790, 22);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
509 this.statusBar.TabIndex = 1;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
510 this.statusBar.PanelClick += new System.Windows.Forms.StatusBarPanelClickEventHandler(this.statusBar_PanelClick);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
511 this.statusBar.DrawItem += new System.Windows.Forms.StatusBarDrawItemEventHandler(this.statusBar_DrawItem);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
512 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
513 // sbMainPanel
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
514 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
515 this.sbMainPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
516 this.sbMainPanel.Color = System.Drawing.SystemColors.WindowText;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
517 this.sbMainPanel.Name = "sbMainPanel";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
518 this.sbMainPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
519 this.sbMainPanel.Width = 473;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
520 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
521 // sbErrorPanel
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
522 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
523 this.sbErrorPanel.Color = System.Drawing.SystemColors.WindowText;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
524 this.sbErrorPanel.Name = "sbErrorPanel";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
525 this.sbErrorPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
526 this.sbErrorPanel.Width = 150;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
527 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
528 // sbPointsPanel
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
529 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
530 this.sbPointsPanel.Color = System.Drawing.SystemColors.WindowText;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
531 this.sbPointsPanel.Name = "sbPointsPanel";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
532 this.sbPointsPanel.Style = System.Windows.Forms.StatusBarPanelStyle.OwnerDraw;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
533 this.sbPointsPanel.ToolTipText = "current points total";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
534 this.sbPointsPanel.Width = 150;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
535 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
536 // toolStripPanel
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
537 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
538 this.toolStripPanel.Dock = System.Windows.Forms.DockStyle.Top;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
539 this.toolStripPanel.Location = new System.Drawing.Point(0, 24);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
540 this.toolStripPanel.Name = "toolStripPanel";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
541 this.toolStripPanel.Orientation = System.Windows.Forms.Orientation.Horizontal;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
542 this.toolStripPanel.RowMargin = new System.Windows.Forms.Padding(3, 0, 0, 0);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
543 this.toolStripPanel.Size = new System.Drawing.Size(790, 0);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
544 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
545 // FrmMain
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
546 //
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
547 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
548 this.ClientSize = new System.Drawing.Size(790, 608);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
549 this.Controls.Add(this.mainToolStrip);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
550 this.Controls.Add(this.toolStripPanel);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
551 this.Controls.Add(this.statusBar);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
552 this.Controls.Add(this.catToolStrip);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
553 this.Controls.Add(this.menuStrip);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
554 this.Icon = ((System.Drawing.Icon) (resources.GetObject("$this.Icon")));
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
555 this.IsMdiContainer = true;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
556 this.MainMenuStrip = this.menuStrip;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
557 this.Menu = this.mainMenu;
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
558 this.Name = "FrmMain";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
559 this.Text = "WarFoundry";
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
560 this.Load += new System.EventHandler(this.FrmMain_Load);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
561 this.menuStrip.ResumeLayout(false);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
562 this.menuStrip.PerformLayout();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
563 this.mainToolStrip.ResumeLayout(false);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
564 this.mainToolStrip.PerformLayout();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
565 ((System.ComponentModel.ISupportInitialize) (this.sbMainPanel)).EndInit();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
566 ((System.ComponentModel.ISupportInitialize) (this.sbErrorPanel)).EndInit();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
567 ((System.ComponentModel.ISupportInitialize) (this.sbPointsPanel)).EndInit();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
568 this.ResumeLayout(false);
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
569 this.PerformLayout();
c095c57a56f9 * Update version number to 0.1b8pre - all other work so far was a dud
IBBoard <dev@ibboard.co.uk>
parents: 134
diff changeset
570
134
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
571 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
572 #endregion
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
573
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
574 private void FileLoadingFinished(List<FileLoadFailure> failures)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
575 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
576 foreach (FileLoadFailure failure in failures)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
577 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
578 log.Warn("Failed to load " + failure.FailedFile.FullName + ": " + failure.Message);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
579 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
580 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
581
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
582 private void miExit_Click(object sender, System.EventArgs e)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
583 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
584 Application.Exit();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
585 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
586
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
587 private void miNewArmy_Click(object sender, System.EventArgs e)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
588 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
589 CreateNewArmy();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
590 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
591
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
592 private void CreateNewArmy()
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
593 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
594 if (CloseCurrentArmy())
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
595 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
596 FrmNewArmy newArmy = new FrmNewArmy(CurrentGameSystem);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
597 DialogResult dr = newArmy.ShowDialog();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
598
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
599 if (dr == DialogResult.OK)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
600 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
601 try
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
602 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
603 CurrentArmy = new Army(newArmy.SelectedRace, newArmy.ArmyName, newArmy.ArmySize);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
604 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
605 catch (RequiredDataMissingException ex)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
606 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
607 log.Error("Required data missing from race file", ex);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
608 MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidRaceFileBoxTitle", "invalid race file"), MessageBoxButtons.OK, MessageBoxIcon.Error);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
609 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
610 catch (InvalidFileException ex)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
611 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
612 log.Error("Race file was invalid", ex);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
613 MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidRaceFileBoxTitle", "invalid race file"), MessageBoxButtons.OK, MessageBoxIcon.Error);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
614 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
615 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
616 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
617 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
618
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
619 private bool OpenArmy()
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
620 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
621 if (openArmyDialog.Filter=="")
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
622 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
623 string savePath = ArmiesPath;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
624
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
625 if (!Directory.Exists(savePath))
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
626 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
627 Directory.CreateDirectory(savePath);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
628 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
629
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
630 openArmyDialog.InitialDirectory = savePath;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
631 openArmyDialog.Filter = Translation.GetTranslation("armyFileFilter")+"|*.army";
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
632 openArmyDialog.Title = Translation.GetTranslation("openArmyDialog");
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
633
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
634 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
635
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
636 DialogResult dr = openArmyDialog.ShowDialog(this);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
637
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
638 if (dr == DialogResult.OK)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
639 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
640 if (CloseCurrentArmy())
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
641 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
642 try
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
643 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
644 string newFilePath = openArmyDialog.FileName;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
645 CurrentArmy = WarFoundryLoader.GetDefault().LoadArmy(new FileInfo(newFilePath));
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
646 loadedFilePath = newFilePath;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
647 return true;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
648 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
649 catch (RequiredDataMissingException ex)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
650 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
651 log.Error(ex);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
652 MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidArmyFileBoxTitle", "invalid army file"), MessageBoxButtons.OK, MessageBoxIcon.Error);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
653 return false;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
654 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
655 catch (InvalidFileException ex)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
656 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
657 log.Error(ex);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
658 MessageBox.Show(this, ex.Message, Translation.GetTranslation("InvalidArmyFileBoxTitle", "invalid army file"), MessageBoxButtons.OK, MessageBoxIcon.Error);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
659 return false;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
660 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
661 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
662 else
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
663 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
664 return false;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
665 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
666 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
667 else
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
668 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
669 return false;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
670 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
671 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
672
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
673 private bool CloseCurrentArmy()
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
674 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
675 if (CurrentArmy!=null)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
676 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
677 bool canClose = false;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
678
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
679 if (CommandStack.IsDirty())
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
680 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
681 string saveChanges = Translation.GetTranslation("SaveChangesQuestion", "the army \"{0}\" has been modified\r\nsave changes before closing army?", CurrentArmy.Name);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
682 string saveChangesTitle = Translation.GetTranslation("SaveChangesTitle", "unsaved changes");
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
683 DialogResult dr = MessageBox.Show(this, saveChanges, saveChangesTitle, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button3);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
684
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
685 if (dr == DialogResult.Yes)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
686 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
687 canClose = SaveCurrentArmy();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
688 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
689 else if (dr == DialogResult.No)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
690 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
691 canClose = true;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
692 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
693 //else they said cancel and we default to "canClose = false" so do nothing
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
694 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
695 else
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
696 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
697 canClose = true;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
698 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
699
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
700 if (canClose)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
701 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
702 //do close
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
703 DisableCategoryButtons();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
704 CurrentArmy = null;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
705 return true;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
706 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
707 else
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
708 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
709 return false;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
710 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
711 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
712 else
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
713 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
714 DisableCategoryButtons();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
715 //pretend we succeeded
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
716 return true;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
717 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
718 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
719
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
720 private void UndoLastAction()
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
721 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
722 if (commandStack.CanUndo())
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
723 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
724 commandStack.Undo();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
725 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
726 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
727
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
728 private void RedoAction()
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
729 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
730 if (commandStack.CanRedo())
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
731 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
732 commandStack.Redo();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
733 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
734 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
735
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
736 private bool SaveCurrentArmy()
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
737 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
738 bool saved = false;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
739
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
740 string filePath = loadedFilePath;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
741
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
742 if (filePath == null)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
743 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
744 filePath = PromptForArmyFilePath();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
745 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
746
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
747 if (filePath != null)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
748 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
749 saved = SaveCurrentArmyToFile(filePath);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
750 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
751
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
752 return saved;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
753 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
754
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
755 private bool SaveCurrentArmyAs()
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
756 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
757 bool saved = false;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
758 string filePath = PromptForArmyFilePath();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
759
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
760 if (filePath != null)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
761 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
762 saved = SaveCurrentArmyToFile(filePath);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
763 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
764
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
765 return saved;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
766 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
767
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
768 private bool SaveCurrentArmyToFile(string filePath)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
769 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
770 if (WarFoundrySaver.GetSaver().Save(CurrentArmy, filePath))
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
771 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
772 loadedFilePath = filePath;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
773 miSaveArmy.Enabled = false;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
774 bttnSaveArmy.Enabled = false;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
775 CommandStack.setCleanMark();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
776 return true;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
777 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
778 else
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
779 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
780 MessageBox.Show(this, Translation.GetTranslation("SaveFailed", "file save failed - check log for details"), Translation.GetTranslation("SaveFailedTitle", "file save failed"), MessageBoxButtons.OK, MessageBoxIcon.Error);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
781 return false;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
782 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
783 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
784
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
785 private string PromptForArmyFilePath()
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
786 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
787 if (saveArmyDialog.Filter == "")
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
788 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
789 string savePath = ArmiesPath;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
790
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
791 if (!Directory.Exists(savePath))
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
792 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
793 Directory.CreateDirectory(savePath);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
794 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
795
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
796 saveArmyDialog.InitialDirectory = savePath;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
797 saveArmyDialog.Filter = Translation.GetTranslation("armyFileFilter")+"|*.army";
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
798 saveArmyDialog.Title = Translation.GetTranslation("saveArmyDialog");
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
799 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
800
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
801 DialogResult dr = saveArmyDialog.ShowDialog(this);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
802
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
803 if (dr == DialogResult.OK)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
804 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
805 return saveArmyDialog.FileName;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
806 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
807 else
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
808 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
809 return null;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
810 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
811 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
812
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
813 public GameSystem CurrentGameSystem
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
814 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
815 get { return WarFoundryCore.CurrentGameSystem; }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
816 set { WarFoundryCore.CurrentGameSystem = value; }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
817 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
818
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
819 public Army CurrentArmy
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
820 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
821 get { return WarFoundryCore.CurrentArmy; }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
822 set { SetArmy(value); }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
823 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
824
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
825 private void FrmMain_GameSystemChanged(GameSystem oldSystem, GameSystem newSystem)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
826 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
827 SetAppTitle();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
828 RemoveCategoryButtons();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
829 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
830
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
831 private void FrmMain_ArmyChanged(Army oldArmy, Army newArmy)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
832 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
833 CommandStack.Reset();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
834 loadedFilePath = null;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
835 miSaveArmy.Enabled = false;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
836 bttnSaveArmy.Enabled = false;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
837 SetPointsPanelText();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
838 SetAppTitle();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
839 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
840
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
841 private void SetArmy(Army newArmy)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
842 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
843 IgnoreArmy(CurrentArmy);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
844 CloseAllUnitWindows();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
845
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
846 if (newArmy == null)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
847 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
848 SetNullArmyState();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
849 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
850 else
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
851 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
852 WarFoundryCore.CurrentGameSystem = newArmy.GameSystem;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
853 ListenToArmy(newArmy);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
854 SetNonNullArmyState(newArmy);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
855 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
856
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
857 WarFoundryCore.CurrentArmy = newArmy;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
858 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
859
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
860 private void IgnoreArmy(Army oldArmy)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
861 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
862 if (oldArmy != null)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
863 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
864 oldArmy.UnitAdded -= UnitAddedMethod;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
865 oldArmy.UnitRemoved -= UnitRemovedMethod;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
866 oldArmy.PointsValueChanged -= PointsValueChangedMethod;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
867 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
868 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
869
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
870 private void CloseAllUnitWindows()
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
871 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
872 FrmUnit[] unitForms = DictionaryUtils.ToArray(unitWindows);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
873
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
874 foreach (FrmUnit window in unitForms)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
875 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
876 window.Close();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
877 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
878
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
879 unitWindows.Clear();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
880 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
881
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
882 private void ListenToArmy(Army newArmy)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
883 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
884 if (newArmy != null)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
885 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
886 newArmy.UnitAdded += UnitAddedMethod;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
887 newArmy.UnitRemoved += UnitRemovedMethod;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
888 newArmy.PointsValueChanged += PointsValueChangedMethod;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
889 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
890 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
891
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
892 private void SetNullArmyState()
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
893 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
894 miSaveArmyAs.Enabled = false;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
895 miCloseArmy.Enabled = false;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
896 miExportArmyAs.Enabled = false;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
897 DisableCategoryButtons();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
898 armyTree.Hide();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
899 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
900
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
901 private void SetNonNullArmyState(Army newArmy)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
902 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
903 SetCategoryButtons(newArmy.Race.Categories);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
904 EnableCategoryButtons();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
905 miSaveArmyAs.Enabled = true;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
906 miCloseArmy.Enabled = true;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
907 miExportArmyAs.Enabled = true;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
908 armyTree.Show();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
909 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
910
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
911 private void SetCategoryButtons(Category[] cats)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
912 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
913 if (CategoryButtonsHaveChanged(cats))
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
914 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
915 RemoveCategoryButtons();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
916 AddCategoryButtons(cats);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
917 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
918 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
919
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
920 private bool CategoryButtonsHaveChanged(Category[] cats)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
921 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
922 int catCount = cats.Length;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
923 ToolStripItemCollection items = catToolStrip.Items;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
924 bool haveChanged = (!catToolStrip.Visible || catCount != items.Count);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
925
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
926 if (!haveChanged)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
927 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
928 for (int i = 0; i < catCount; i++)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
929 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
930 if (cats[i].Equals(items[i+1].Tag))
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
931 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
932 haveChanged = true;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
933 break;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
934 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
935 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
936 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
937
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
938 return haveChanged;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
939 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
940
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
941 private void RemoveCategoryButtons()
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
942 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
943 this.Invoke(new MethodInvoker(catToolStrip.Items.Clear));
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
944 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
945
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
946 private void AddCategoryButtons(Category[] cats)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
947 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
948 int catCount = cats.Length;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
949 Category cat;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
950 IBBToolStripButton[] categoryButtons = new IBBToolStripButton[catCount];
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
951
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
952 for (int i = 0; i < catCount; i++)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
953 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
954 cat = cats[i];
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
955 IBBToolStripButton button = new IBBToolStripButton();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
956 button.Text = cat.Name;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
957 button.Tag = cat;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
958 button.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.list_add;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
959 button.Enabled = false;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
960 button.Click += new EventHandler(CreateUnitForCategoryButtonClick);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
961 categoryButtons[i] = button;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
962 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
963
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
964 this.Invoke(new ArrayMethodInvoker<IBBToolStripButton>(catToolStrip.Items.AddRange), new object[]{ categoryButtons });
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
965 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
966
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
967 private void CreateUnitForCategoryButtonClick(object sender, EventArgs e)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
968 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
969 if (sender is IBBToolStripButton)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
970 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
971 IBBToolStripButton button = (IBBToolStripButton)sender;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
972 object tag = button.Tag;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
973
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
974 if (tag is Category)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
975 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
976 AddUnitFromCategory((Category)tag);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
977 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
978 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
979 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
980
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
981 private void EnableCategoryButtons()
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
982 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
983 catToolStrip.Visible = true;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
984 SetCategoryButtonState(true);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
985 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
986
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
987 private void DisableCategoryButtons()
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
988 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
989 catToolStrip.Visible = false;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
990 SetCategoryButtonState(false);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
991 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
992
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
993 private void SetCategoryButtonState(bool state)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
994 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
995 foreach (IBBToolStripButton button in catToolStrip.Items)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
996 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
997 button.Enabled = state;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
998 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
999 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1000
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1001 private void miSaveArmyAs_Click(object sender, System.EventArgs e)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1002 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1003 SaveCurrentArmyAs();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1004 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1005
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1006 private void commandStack_CommandStackUpdated()
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1007 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1008 bttnUndo.Enabled = commandStack.CanUndo();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1009 miUndo.Enabled = bttnUndo.Enabled;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1010 bttnRedo.Enabled = commandStack.CanRedo();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1011 miRedo.Enabled = bttnRedo.Enabled;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1012
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1013 PopulateRedoMenu();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1014 PopulateUndoMenu();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1015
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1016 bttnSaveArmy.Enabled = commandStack.IsDirty() && CurrentArmy!=null;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1017 miSaveArmy.Enabled = commandStack.IsDirty() && CurrentArmy!=null;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1018 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1019
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1020 private void PopulateRedoMenu()
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1021 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1022 int redoLength = commandStack.RedoLength;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1023 int maxRedo = Math.Min(10, redoLength);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1024 ToolStripItemCollection dropDownItems = bttnRedo.DropDownItems;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1025 dropDownItems.Clear();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1026
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1027 for (int i = 1; i <= maxRedo; i++)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1028 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1029 Command cmd = commandStack.PeekRedoCommand(i);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1030
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1031 if (cmd == null)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1032 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1033 break;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1034 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1035
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1036 dropDownItems.Add(cmd.Description, null, redoMenu_Click);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1037 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1038
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1039 if (redoLength > 0)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1040 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1041 bttnRedo.Text = commandStack.PeekRedoCommand(1).Description;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1042 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1043 else
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1044 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1045 bttnRedo.Text = Translation.GetTranslation("bttnRedo");
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1046 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1047 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1048
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1049 private void PopulateUndoMenu()
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1050 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1051 int undoLength = commandStack.UndoLength;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1052 int maxUndo = Math.Min(10, undoLength);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1053 ToolStripItemCollection dropDownItems = bttnUndo.DropDownItems;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1054 dropDownItems.Clear();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1055
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1056 for (int i = 1; i <= maxUndo; i++)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1057 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1058 Command cmd = commandStack.PeekUndoCommand(i);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1059
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1060 if (cmd == null)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1061 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1062 break;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1063 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1064
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1065 dropDownItems.Add(cmd.UndoDescription, null, undoMenu_Click);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1066 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1067
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1068 if (undoLength > 0)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1069 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1070 bttnUndo.Text = commandStack.PeekUndoCommand(1).UndoDescription;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1071 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1072 else
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1073 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1074 bttnUndo.Text = Translation.GetTranslation("bttnUndo");
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1075 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1076 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1077
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1078 private void miSaveArmy_Click(object sender, System.EventArgs e)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1079 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1080 SaveCurrentArmy();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1081 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1082
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1083 private void SetAppTitle()
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1084 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1085 string str = AppTitle;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1086
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1087 if (CurrentGameSystem!=null)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1088 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1089 str+= " - "+CurrentGameSystem.Name;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1090 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1091
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1092 if (CurrentArmy!=null)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1093 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1094 str+= " - "+CurrentArmy.Name;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1095 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1096
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1097 this.Text = str;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1098 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1099
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1100 private void AddUnitFromCategory(Category cat)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1101 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1102 FrmNewUnit newUnit = new FrmNewUnit(CurrentArmy.Race, cat, CurrentArmy);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1103 DialogResult dr = newUnit.ShowDialog(this);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1104
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1105 if (dr == DialogResult.OK)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1106 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1107 CreateAndAddUnitCommand cmd = new CreateAndAddUnitCommand(newUnit.SelectedUnit, CurrentArmy.GetCategory(cat));
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1108 commandStack.Execute(cmd);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1109 OpenUnitDialog(cmd.Unit);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1110 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1111 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1112
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1113 internal void OpenUnitDialog(Unit unit)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1114 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1115 string unitID = unit.ID;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1116
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1117 if (unitWindows.ContainsKey(unitID))
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1118 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1119 unitWindows[unitID].Focus();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1120 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1121 else
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1122 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1123 FrmUnit unitForm = new FrmUnit(unit, commandStack);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1124 unitWindows.Add(unitID, unitForm);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1125 unitForm.MdiParent = this;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1126 unitForm.Closing += new CancelEventHandler(unitForm_Closing);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1127 unitForm.Show();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1128 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1129 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1130
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1131 private void unitForm_Closing(object sender, CancelEventArgs e)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1132 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1133 if (sender is FrmUnit)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1134 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1135 FrmUnit unitForm = (FrmUnit) sender;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1136 unitWindows.Remove(unitForm.Unit.ID);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1137 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1138 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1139
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1140 private void FrmMain_UnitAddedMethod(object unitObj)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1141 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1142 if (unitObj is Unit)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1143 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1144 Unit unit = (Unit)unitObj;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1145 sbErrorPanel.Text = "";
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1146 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1147 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1148
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1149 private void FrmMain_UnitRemovedMethod(object unitObj)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1150 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1151 if (unitObj is Unit)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1152 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1153 Unit unit = (Unit)unitObj;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1154 sbErrorPanel.Text = "";
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1155
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1156 //check if window is open, and close it if it is
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1157 foreach (Form frm in this.MdiChildren)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1158 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1159 if (frm is FrmUnit)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1160 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1161 if (((FrmUnit)frm).Unit == unit)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1162 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1163 frm.Close();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1164 break;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1165 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1166 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1167 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1168 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1169 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1170
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1171 /*private void FrmMain_FailedUnitRequirement(FailedUnitRequirement failedRequirement)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1172 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1173 sbErrorPanel.Text = Translation.GetTranslation("UnitRequirementFailed", "Unit Requirement Failed");
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1174 sbErrorPanel.Tag = failedRequirement.Description;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1175 }*/
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1176
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1177 /*public void MdiChildMoved()
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1178 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1179 Point mouseAt = PointToClient(ActiveMdiChild.Location);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1180
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1181 if (Comparisons.ValueWithinAmount(pnlRight.Right, ActiveMdiChild.Right, 10))
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1182 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1183 pnlRight.Visible = true;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1184 //pnlRight.Container.Add(ActiveMdiChild);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1185 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1186 else
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1187 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1188 pnlRight.Visible = false;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1189 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1190 }*/
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1191
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1192 private void miUndo_Click(object sender, System.EventArgs e)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1193 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1194 UndoLastAction();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1195 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1196
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1197 private void miRedo_Click(object sender, System.EventArgs e)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1198 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1199 RedoAction();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1200 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1201
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1202 private void miCloseArmy_Click(object sender, EventArgs e)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1203 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1204 CloseCurrentArmy();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1205 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1206
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1207 private void miOpenArmy_Click(object sender, EventArgs e)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1208 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1209 OpenArmy();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1210 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1211
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1212 private void FrmMain_PointsValueChangedMethod(WarFoundryObject obj, double oldVal, double newVal)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1213 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1214 if (obj is Army)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1215 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1216 SetPointsPanelText();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1217 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1218 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1219
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1220 private void SetPointsPanelText()
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1221 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1222 if (CurrentArmy==null)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1223 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1224 sbPointsPanel.Text = "";
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1225 sbPointsPanel.ResetColor();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1226 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1227 else
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1228 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1229 sbPointsPanel.Text = String.Format(Translation.GetTranslation("statusPanelPoints"), CurrentArmy.Points, CurrentArmy.MaxPoints);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1230
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1231 if (CurrentArmy.Points>CurrentArmy.MaxPoints)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1232 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1233 sbPointsPanel.Color = Color.Red;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1234 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1235 else
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1236 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1237 sbPointsPanel.ResetColor();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1238 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1239 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1240 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1241
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1242 private void redoMenu_Click(object sender, EventArgs e)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1243 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1244 if (sender is ToolStripDropDownItem)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1245 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1246 ToolStripDropDownItem item = (ToolStripDropDownItem)sender;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1247 //we know it's an redo menu item so find it's index and redo everything
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1248 int max = bttnRedo.DropDownItems.IndexOf(item);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1249
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1250 if (max >= 0)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1251 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1252 for (int i = 0; i <= max; i++)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1253 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1254 commandStack.Redo();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1255 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1256 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1257 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1258 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1259
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1260 private void undoMenu_Click(object sender, EventArgs e)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1261 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1262 if (sender is ToolStripDropDownItem)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1263 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1264 ToolStripDropDownItem item = (ToolStripDropDownItem)sender;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1265 //we know it's an redo menu item so find it's index and redo everything
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1266 int max = bttnUndo.DropDownItems.IndexOf(item);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1267
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1268 if (max >= 0)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1269 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1270 for (int i = 0; i <= max; i++)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1271 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1272 commandStack.Undo();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1273 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1274 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1275 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1276 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1277
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1278 private void statusBar_DrawItem(object sender, System.Windows.Forms.StatusBarDrawItemEventArgs sbdevent)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1279 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1280 statusBar.ColorableStatusBarDrawItem(sender, sbdevent);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1281 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1282
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1283 private void FrmMain_Closing(object sender, CancelEventArgs e)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1284 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1285 if (!CloseCurrentArmy())
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1286 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1287 e.Cancel = true;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1288 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1289 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1290
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1291 private void miReloadFiles_Click(object sender, System.EventArgs e)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1292 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1293 WarFoundryLoader.GetDefault().LoadFiles();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1294 sbMainPanel.Text = Translation.GetTranslation("GameSystemFilesReloaded", "Game system and race files reloaded");
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1295 statusBarTimer.Enabled = true;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1296 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1297
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1298 private void statusBarTimer_Tick(object sender, System.EventArgs e)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1299 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1300 sbMainPanel.Text = "";
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1301 statusBarTimer.Enabled = false;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1302 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1303
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1304 private void statusBar_PanelClick(object sender, StatusBarPanelClickEventArgs e)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1305 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1306 if (e.StatusBarPanel == sbErrorPanel && sbErrorPanel.Text!="")
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1307 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1308 MessageBox.Show(this, sbErrorPanel.TagString, Translation.GetTranslation("FailedRequirementMessage"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1309 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1310 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1311
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1312 private void miExportArmyAsBasicHTML_Click(object sender, EventArgs e)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1313 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1314 SaveFileDialog dialog = new SaveFileDialog();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1315 dialog.Filter = Translation.GetTranslation("armyExportBasicHtmlFilter", "HTML pages") + "|*.html";
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1316 dialog.Title = Translation.GetTranslation("exportArmyDialog", "Export army");
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1317
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1318 DialogResult dr = dialog.ShowDialog(this);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1319
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1320 if (dr == DialogResult.OK)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1321 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1322 Army army = CurrentArmy;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1323 string filePath = dialog.FileName;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1324 log.DebugFormat("Exporting {0} to {1} as basic HTML", army.Name, filePath);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1325 WarFoundryHtmlExporter.GetDefault().ExportArmy(army, filePath);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1326 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1327 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1328
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1329 private void FrmMain_Load(object sender, EventArgs e)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1330 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1331 string gameSystemID = Preferences.GetStringProperty("currSystem");
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1332
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1333 if (gameSystemID != null && !"".Equals(gameSystemID))
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1334 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1335 log.Debug("Attempting to load current game system from properties");
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1336 GameSystem sys = WarFoundryLoader.GetDefault().GetGameSystem(gameSystemID);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1337
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1338 if (sys != null)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1339 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1340 WarFoundryCore.CurrentGameSystem = sys;
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1341 log.InfoFormat("Loaded game system {0} from properties", gameSystemID);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1342 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1343 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1344 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1345
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1346 private void miAbout_Click(object sender, EventArgs e)
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1347 {
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1348 FrmAbout about = new FrmAbout();
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1349 about.ShowDialog(this);
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1350 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1351 }
e381ec627d14 Re #88: Complete initial WinForms UI
IBBoard <dev@ibboard.co.uk>
parents: 133
diff changeset
1352 }