@@ -14,6 +14,7 @@ namespace Build_Run
14
14
/// </summary>
15
15
public partial class MainWindow : Window
16
16
{
17
+ //String variables that storing the default and current run and edit mode layout XML file path
17
18
string currentEditLayout = @"Layouts/CurrentEditLayout.xml" ;
18
19
string defaultEditLayout = @"Layouts/DefaultEditLayout.xml" ;
19
20
string currentRunLayout = @"Layouts/CurrentRunLayout.xml" ;
@@ -34,13 +35,22 @@ public enum VisualStudioMode
34
35
public VisualStudioMode CurrentMode { get ; set ; }
35
36
36
37
//Gets or sets to bool value to load the default layout
37
- // public bool IsEnableResetLayout { get; set; }
38
+ // public bool IsEnableResetLayout { get; set; }
38
39
39
40
public MainWindow ( )
40
41
{
41
42
InitializeComponent ( ) ;
43
+ //Invoking the docking manager loaded event
42
44
dockingManager . Loaded += OnLoading ;
45
+
46
+ //Invoking the window closing event
43
47
this . Closing += OnClosing ;
48
+
49
+ //Invoking the reset layout button click event
50
+ resetLayout . Click += OnResetLayoutClicked ;
51
+
52
+ //Invoking the Stop and Run mode switch button click event
53
+ runButton . Click += OnRunButtonClicked ;
44
54
}
45
55
46
56
/// <summary>
@@ -128,19 +138,33 @@ private void Switch(VisualStudioMode mode)
128
138
129
139
if ( document . ChildNodes [ 1 ] . ChildNodes . Count < 1 )
130
140
{
131
- //Check and load the missed windows from default layout
141
+ //Load the default layout
132
142
Load ( defaultLayoutPath ) ;
133
143
134
- //Save the current Edit mode layout
144
+ //Save the default layout as current layout
135
145
Save ( currentLayoutPath ) ;
136
146
}
137
147
else
138
148
{
139
- //Check and load the missed windows from saved layout
149
+ //Load currently saved layout
140
150
Load ( currentLayoutPath ) ;
141
151
}
142
152
}
143
153
154
+ /// <summary>
155
+ /// To save the previous mode layout
156
+ /// </summary>
157
+ /// <param name="saveLayoutPath">Path of the saving layout file</param>
158
+ private void Save ( string saveLayoutPath )
159
+ {
160
+ BinaryFormatter formatter = new BinaryFormatter ( ) ;
161
+ this . dockingManager . SaveDockState ( formatter , StorageFormat . Xml , saveLayoutPath ) ;
162
+ }
163
+
164
+ /// <summary>
165
+ /// Load the current mode layout
166
+ /// </summary>
167
+ /// <param name="loadLayoutPath">Path of the loading layout path</param>
144
168
private void Load ( string loadLayoutPath )
145
169
{
146
170
BinaryFormatter formatter = new BinaryFormatter ( ) ;
@@ -155,12 +179,6 @@ private void Load(string loadLayoutPath)
155
179
this . dockingManager . LoadDockState ( formatter , StorageFormat . Xml , loadLayoutPath ) ;
156
180
}
157
181
158
- private void Save ( string saveLayoutPath )
159
- {
160
- BinaryFormatter formatter = new BinaryFormatter ( ) ;
161
- this . dockingManager . SaveDockState ( formatter , StorageFormat . Xml , saveLayoutPath ) ;
162
- }
163
-
164
182
//Based on the mode, set the save and load current layout file path
165
183
private void OnRunButtonClicked ( object sender , RoutedEventArgs e )
166
184
{
0 commit comments