Skip to content

Commit 7c71e34

Browse files
EDIT-RUN sample modified
1 parent d839d38 commit 7c71e34

File tree

2 files changed

+31
-14
lines changed

2 files changed

+31
-14
lines changed

Samples/Build-Run/MainWindow.xaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@
1616
<!--Reset menu item to reset the layout-->
1717
<MenuItem
1818
x:Name="resetLayout"
19-
Click="OnResetLayoutClicked"
2019
Header="Reset Layout" />
2120
<!--Run menu item to load the run or stop layouts for the application-->
2221
<MenuItem Header="Run"
23-
Name="debug_option"
24-
Click="OnRunButtonClicked"/>
22+
Name="runButton"/>
2523
</Menu>
2624
</Grid>
2725
<Grid Grid.Row="1">
28-
<syncfusion:DockingManager x:Name="dockingManager" PersistState="True"
26+
<syncfusion:DockingManager x:Name="dockingManager"
27+
PersistState="True"
2928
UseDocumentContainer="True" >
3029
<!--Output docking window-->
3130
<ContentControl x:Name="Output"

Samples/Build-Run/MainWindow.xaml.cs

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ namespace Build_Run
1414
/// </summary>
1515
public partial class MainWindow : Window
1616
{
17+
//String variables that storing the default and current run and edit mode layout XML file path
1718
string currentEditLayout = @"Layouts/CurrentEditLayout.xml";
1819
string defaultEditLayout = @"Layouts/DefaultEditLayout.xml";
1920
string currentRunLayout = @"Layouts/CurrentRunLayout.xml";
@@ -34,13 +35,22 @@ public enum VisualStudioMode
3435
public VisualStudioMode CurrentMode { get; set; }
3536

3637
//Gets or sets to bool value to load the default layout
37-
// public bool IsEnableResetLayout { get; set; }
38+
// public bool IsEnableResetLayout { get; set; }
3839

3940
public MainWindow()
4041
{
4142
InitializeComponent();
43+
//Invoking the docking manager loaded event
4244
dockingManager.Loaded += OnLoading;
45+
46+
//Invoking the window closing event
4347
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;
4454
}
4555

4656
/// <summary>
@@ -128,19 +138,33 @@ private void Switch(VisualStudioMode mode)
128138

129139
if (document.ChildNodes[1].ChildNodes.Count < 1)
130140
{
131-
//Check and load the missed windows from default layout
141+
//Load the default layout
132142
Load(defaultLayoutPath);
133143

134-
//Save the current Edit mode layout
144+
//Save the default layout as current layout
135145
Save(currentLayoutPath);
136146
}
137147
else
138148
{
139-
//Check and load the missed windows from saved layout
149+
//Load currently saved layout
140150
Load(currentLayoutPath);
141151
}
142152
}
143153

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>
144168
private void Load(string loadLayoutPath)
145169
{
146170
BinaryFormatter formatter = new BinaryFormatter();
@@ -155,12 +179,6 @@ private void Load(string loadLayoutPath)
155179
this.dockingManager.LoadDockState(formatter, StorageFormat.Xml, loadLayoutPath);
156180
}
157181

158-
private void Save(string saveLayoutPath)
159-
{
160-
BinaryFormatter formatter = new BinaryFormatter();
161-
this.dockingManager.SaveDockState(formatter, StorageFormat.Xml, saveLayoutPath);
162-
}
163-
164182
//Based on the mode, set the save and load current layout file path
165183
private void OnRunButtonClicked(object sender, RoutedEventArgs e)
166184
{

0 commit comments

Comments
 (0)