diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/App.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/App.xaml.cs
index d9fed48e1f..72e529c85d 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/App.xaml.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/App.xaml.cs
@@ -13,14 +13,13 @@ namespace FancyZonesEditor
///
public partial class App : Application
{
- public Settings ZoneSettings { get { return _settings; } }
+ public Settings ZoneSettings { get; }
- private Settings _settings;
private ushort _idInitial = 0;
public App()
{
- _settings = new Settings();
+ ZoneSettings = new Settings();
}
private void OnStartup(object sender, StartupEventArgs e)
@@ -34,7 +33,7 @@ namespace FancyZonesEditor
if (_idInitial != 0)
{
- foreach (LayoutModel model in _settings.DefaultModels)
+ foreach (LayoutModel model in ZoneSettings.DefaultModels)
{
if (model.Id == _idInitial)
{
@@ -46,7 +45,7 @@ namespace FancyZonesEditor
if (foundModel == null)
{
- foreach (LayoutModel model in _settings.CustomModels)
+ foreach (LayoutModel model in ZoneSettings.CustomModels)
{
if (model.Id == _idInitial)
{
@@ -60,7 +59,7 @@ namespace FancyZonesEditor
if (foundModel == null)
{
- foundModel = _settings.DefaultModels[0];
+ foundModel = ZoneSettings.DefaultModels[0];
}
foundModel.IsSelected = true;
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj b/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj
index 3a323f8564..530431dd62 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/FancyZonesEditor.csproj
@@ -91,6 +91,7 @@
GridEditorWindow.xaml
+
WindowLayout.xaml
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/GridEditor.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/GridEditor.xaml.cs
index 84ddd69052..6aae43956b 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/GridEditor.xaml.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/GridEditor.xaml.cs
@@ -85,7 +85,10 @@ namespace FancyZonesEditor
set { SetValue(ModelProperty, value); }
}
- public Panel PreviewPanel { get { return Preview; } }
+ public Panel PreviewPanel
+ {
+ get { return Preview; }
+ }
private void OnFullSplit(object o, SplitEventArgs e)
{
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/GridZone.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/GridZone.xaml.cs
index 8650b58a9f..3bdc968bc3 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/GridZone.xaml.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/GridZone.xaml.cs
@@ -84,7 +84,10 @@ namespace FancyZonesEditor
}
}
- private int SplitterThickness { get { return Math.Max(((App)Application.Current).ZoneSettings.Spacing, 5); } }
+ private int SplitterThickness
+ {
+ get { return Math.Max(((App)Application.Current).ZoneSettings.Spacing, 5); }
+ }
private void UpdateSplitter()
{
@@ -238,8 +241,11 @@ namespace FancyZonesEditor
}
public event SplitEventHandler Split;
+
public event SplitEventHandler FullSplit;
+
public event MouseEventHandler MergeDrag;
+
public event MouseButtonEventHandler MergeComplete;
private Rectangle _splitter;
@@ -286,22 +292,4 @@ namespace FancyZonesEditor
}
}
}
-
- public class SplitEventArgs : EventArgs
- {
- public SplitEventArgs() { }
- public SplitEventArgs(Orientation orientation, double offset)
- {
- _orientation = orientation;
- _offset = offset;
- }
-
- public Orientation Orientation { get { return _orientation; } }
- public double Offset { get { return _offset; } }
-
- private Orientation _orientation;
- private double _offset;
- }
-
- public delegate void SplitEventHandler(object sender, SplitEventArgs args);
}
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/LayoutPreview.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/LayoutPreview.xaml.cs
index 5caf3d9bec..b98af7ad1e 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/LayoutPreview.xaml.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/LayoutPreview.xaml.cs
@@ -61,7 +61,10 @@ namespace FancyZonesEditor
}
}
- public Panel PreviewPanel { get { return Body; } }
+ public Panel PreviewPanel
+ {
+ get { return Body; }
+ }
private void OnLoaded(object sender, RoutedEventArgs e)
{
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Models/CanvasLayoutModel.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Models/CanvasLayoutModel.cs
index e0bba1a312..eb6244042c 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/Models/CanvasLayoutModel.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/Models/CanvasLayoutModel.cs
@@ -11,7 +11,8 @@ namespace FancyZonesEditor.Models
// Free form Layout Model, which specifies independent zone rects
public class CanvasLayoutModel : LayoutModel
{
- public CanvasLayoutModel(ushort version, string name, ushort id, byte[] data) : base(name, id)
+ public CanvasLayoutModel(ushort version, string name, ushort id, byte[] data)
+ : base(name, id)
{
if (version == _latestVersion)
{
@@ -19,23 +20,37 @@ namespace FancyZonesEditor.Models
}
}
- public CanvasLayoutModel(string name, ushort id, int referenceWidth, int referenceHeight) : base(name, id)
+ public CanvasLayoutModel(string name, ushort id, int referenceWidth, int referenceHeight)
+ : base(name, id)
{
// Initialize Reference Size
_referenceWidth = referenceWidth;
_referenceHeight = referenceHeight;
}
- public CanvasLayoutModel(string name, ushort id) : base(name, id) { }
+ public CanvasLayoutModel(string name, ushort id)
+ : base(name, id)
+ {
+ }
- public CanvasLayoutModel(string name) : base(name) { }
+ public CanvasLayoutModel(string name)
+ : base(name)
+ {
+ }
- public CanvasLayoutModel() : base() { }
+ public CanvasLayoutModel()
+ : base()
+ {
+ }
// ReferenceWidth - the reference width for the layout rect that all Zones are relative to
public int ReferenceWidth
{
- get { return _referenceWidth; }
+ get
+ {
+ return _referenceWidth;
+ }
+
set
{
if (_referenceWidth != value)
@@ -69,8 +84,7 @@ namespace FancyZonesEditor.Models
private int _referenceHeight;
// Zones - the list of all zones in this layout, described as independent rectangles
- public IList Zones { get { return _zones; } }
- private IList _zones = new List();
+ public IList Zones { get; } = new List();
// RemoveZoneAt
// Removes the specified index from the Zones list, and fires a property changed notification for the Zones property
@@ -100,7 +114,7 @@ namespace FancyZonesEditor.Models
while (count-- > 0)
{
- _zones.Add(new Int32Rect(
+ Zones.Add(new Int32Rect(
data[i++] * 256 + data[i++],
data[i++] * 256 + data[i++],
data[i++] * 256 + data[i++],
@@ -130,7 +144,7 @@ namespace FancyZonesEditor.Models
// Returns the state of this GridLayoutModel in persisted format
protected override byte[] GetPersistData()
{
- byte[] data = new byte[10 + (_zones.Count * 8)];
+ byte[] data = new byte[10 + (Zones.Count * 8)];
int i = 0;
// Common persisted values between all layout types
@@ -146,9 +160,9 @@ namespace FancyZonesEditor.Models
data[i++] = (byte)(_referenceWidth % 256);
data[i++] = (byte)(_referenceHeight / 256);
data[i++] = (byte)(_referenceHeight % 256);
- data[i++] = (byte)_zones.Count;
+ data[i++] = (byte)Zones.Count;
- foreach (Int32Rect rect in _zones)
+ foreach (Int32Rect rect in Zones)
{
data[i++] = (byte)(rect.X / 256);
data[i++] = (byte)(rect.X % 256);
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Models/GridLayoutModel.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Models/GridLayoutModel.cs
index e71657e390..d5e1e80ab6 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/Models/GridLayoutModel.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/Models/GridLayoutModel.cs
@@ -10,10 +10,23 @@ namespace FancyZonesEditor.Models
// Grid-styled Layout Model, which specifies rows, columns, percentage sizes, and row/column spans
public class GridLayoutModel : LayoutModel
{
- public GridLayoutModel() : base() { }
- public GridLayoutModel(string name) : base(name) { }
- public GridLayoutModel(string name, ushort id) : base(name, id) { }
- public GridLayoutModel(ushort version, string name, ushort id, byte[] data) : base(name, id)
+ public GridLayoutModel()
+ : base()
+ {
+ }
+
+ public GridLayoutModel(string name)
+ : base(name)
+ {
+ }
+
+ public GridLayoutModel(string name, ushort id)
+ : base(name, id)
+ {
+ }
+
+ public GridLayoutModel(ushort version, string name, ushort id, byte[] data)
+ : base(name, id)
{
if (version == c_latestVersion)
{
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Models/LayoutModel.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Models/LayoutModel.cs
index 10fff472d2..0bb5e2f352 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/Models/LayoutModel.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/Models/LayoutModel.cs
@@ -14,14 +14,18 @@ namespace FancyZonesEditor.Models
// Manages common properties and base persistence
public abstract class LayoutModel : INotifyPropertyChanged
{
- protected LayoutModel() { }
+ protected LayoutModel()
+ {
+ }
- protected LayoutModel(string name) : this()
+ protected LayoutModel(string name)
+ : this()
{
Name = name;
}
- protected LayoutModel(string name, ushort id) : this(name)
+ protected LayoutModel(string name, ushort id)
+ : this(name)
{
_id = id;
}
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Models/Settings.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Models/Settings.cs
index f4155fa1cb..a94aa41415 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/Models/Settings.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/Models/Settings.cs
@@ -340,8 +340,7 @@ namespace FancyZonesEditor
_workArea = new Rect(x, y, width, height);
- uint monitor = 0;
- if (uint.TryParse(args[4], out monitor))
+ if (uint.TryParse(args[4], out uint monitor))
{
Monitor = monitor;
}
@@ -349,7 +348,10 @@ namespace FancyZonesEditor
}
- public IList DefaultModels { get { return _defaultModels; } }
+ public IList DefaultModels
+ {
+ get { return _defaultModels; }
+ }
public ObservableCollection CustomModels
{
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/SplitEventArgs.cs b/src/modules/fancyzones/editor/FancyZonesEditor/SplitEventArgs.cs
new file mode 100644
index 0000000000..a8b2ef0bd2
--- /dev/null
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/SplitEventArgs.cs
@@ -0,0 +1,28 @@
+// Copyright (c) Microsoft Corporation
+// The Microsoft Corporation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Windows.Controls;
+
+namespace FancyZonesEditor
+{
+ public class SplitEventArgs : EventArgs
+ {
+ public SplitEventArgs()
+ {
+ }
+
+ public SplitEventArgs(Orientation orientation, double offset)
+ {
+ Orientation = orientation;
+ Offset = offset;
+ }
+
+ public Orientation Orientation { get; }
+
+ public double Offset { get; }
+ }
+
+ public delegate void SplitEventHandler(object sender, SplitEventArgs args);
+}