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