diff --git a/src/modules/fancyzones/editor/FancyZonesEditor.sln b/src/modules/fancyzones/editor/FancyZonesEditor.sln
index 3d1c110860..421bb54260 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor.sln
+++ b/src/modules/fancyzones/editor/FancyZonesEditor.sln
@@ -12,7 +12,9 @@ Global
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5CCC8468-DEC8-4D36-99D4-5C891BEBD481}.Debug|Any CPU.ActiveCfg = Debug|x64
- {5CCC8468-DEC8-4D36-99D4-5C891BEBD481}.Release|Any CPU.ActiveCfg = Release|x64
+ {5CCC8468-DEC8-4D36-99D4-5C891BEBD481}.Debug|Any CPU.Build.0 = Debug|x64
+ {5CCC8468-DEC8-4D36-99D4-5C891BEBD481}.Release|Any CPU.ActiveCfg = Debug|x64
+ {5CCC8468-DEC8-4D36-99D4-5C891BEBD481}.Release|Any CPU.Build.0 = Debug|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/App.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/App.xaml.cs
index 9d2b719cad..dae6aed895 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/App.xaml.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/App.xaml.cs
@@ -1,10 +1,8 @@
-using FancyZonesEditor;
+// 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.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Threading.Tasks;
using System.Windows;
using FancyZonesEditor.Models;
@@ -16,8 +14,10 @@ namespace FancyZonesEditor
public partial class App : Application
{
public Settings ZoneSettings { get { return _settings; } }
+
private Settings _settings;
private ushort _idInitial = 0;
+
public App()
{
_settings = new Settings();
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/CanvasEditor.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/CanvasEditor.xaml.cs
index ed6a0f0bd0..57996ac6fc 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/CanvasEditor.xaml.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/CanvasEditor.xaml.cs
@@ -1,17 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// 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.Windows;
using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
using FancyZonesEditor.Models;
namespace FancyZonesEditor
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/CanvasEditorWindow.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/CanvasEditorWindow.xaml.cs
index d652dd1b18..26b3f786a8 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/CanvasEditorWindow.xaml.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/CanvasEditorWindow.xaml.cs
@@ -1,17 +1,8 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// 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.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-using MahApps.Metro.Controls;
using FancyZonesEditor.Models;
namespace FancyZonesEditor
@@ -24,16 +15,16 @@ namespace FancyZonesEditor
public CanvasEditorWindow()
{
InitializeComponent();
- Model = EditorOverlay.Current.DataContext as CanvasLayoutModel;
+ _model = EditorOverlay.Current.DataContext as CanvasLayoutModel;
}
private void OnAddZone(object sender, RoutedEventArgs e)
{
- Model.AddZone(new Int32Rect(_offset, _offset, (int) (Model.ReferenceWidth * 0.6), (int) (Model.ReferenceHeight * 0.6)));
+ _model.AddZone(new Int32Rect(_offset, _offset, (int)(_model.ReferenceWidth * 0.6), (int)(_model.ReferenceHeight * 0.6)));
_offset += 100;
}
private int _offset = 100;
- private CanvasLayoutModel Model;
+ private CanvasLayoutModel _model;
}
}
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/CanvasZone.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/CanvasZone.xaml.cs
index d55b36bc45..7e088ca85f 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/CanvasZone.xaml.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/CanvasZone.xaml.cs
@@ -1,26 +1,19 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// 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;
using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
using FancyZonesEditor.Models;
namespace FancyZonesEditor
{
///
- /// Once you've "Committ"ed the starter grid, then the Zones within the grid come to life for you to be able to further subdivide them
+ /// Once you've "Committ"ed the starter grid, then the Zones within the grid come to life for you to be able to further subdivide them
/// using splitters
///
-
public partial class CanvasZone : UserControl
{
public CanvasZone()
@@ -53,8 +46,8 @@ namespace FancyZonesEditor
yDelta = Math.Min(yDelta, _settings.WorkArea.Height - rect.Height - rect.Y);
}
- rect.X += (int) xDelta;
- rect.Y += (int) yDelta;
+ rect.X += (int)xDelta;
+ rect.Y += (int)yDelta;
Canvas.SetLeft(this, rect.X);
Canvas.SetTop(this, rect.Y);
@@ -112,7 +105,7 @@ namespace FancyZonesEditor
Int32Rect rect = Model.Zones[ZoneIndex];
if (xDelta != 0)
{
- int newWidth = rect.Width + (int) xDelta;
+ int newWidth = rect.Width + (int)xDelta;
if (newWidth < c_minZoneWidth)
{
@@ -120,7 +113,7 @@ namespace FancyZonesEditor
}
else if (newWidth > (_settings.WorkArea.Width - rect.X))
{
- newWidth = (int) _settings.WorkArea.Width - rect.X;
+ newWidth = (int)_settings.WorkArea.Width - rect.X;
}
MinWidth = rect.Width = newWidth;
}
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/EditorOverlay.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/EditorOverlay.xaml.cs
index 020ded7462..71ead97d1e 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/EditorOverlay.xaml.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/EditorOverlay.xaml.cs
@@ -1,4 +1,8 @@
-using FancyZonesEditor.Models;
+// 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 FancyZonesEditor.Models;
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/EditorWindow.cs b/src/modules/fancyzones/editor/FancyZonesEditor/EditorWindow.cs
index 17b3c3ac76..ae679f0262 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/EditorWindow.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/EditorWindow.cs
@@ -1,16 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// 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;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
using FancyZonesEditor.Models;
using MahApps.Metro.Controls;
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/GridEditor.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/GridEditor.xaml.cs
index d4f382e58a..8828c9f40b 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/GridEditor.xaml.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/GridEditor.xaml.cs
@@ -1,20 +1,14 @@
-using System;
+// 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.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
using FancyZonesEditor.Models;
-
namespace FancyZonesEditor
{
///
@@ -639,9 +633,11 @@ namespace FancyZonesEditor
break;
}
}
+
if (startCol != -1)
{
- Canvas.SetTop(resizer, _rowInfo[row].End + (spacing / 2) - 24); // hard coding this as (resizer.ActualHeight / 2) will still evaluate to 0 here ... a layout hasn't yet happened
+ // hard coding this as (resizer.ActualHeight / 2) will still evaluate to 0 here ... a layout hasn't yet happened
+ Canvas.SetTop(resizer, _rowInfo[row].End + (spacing / 2) - 24);
Canvas.SetLeft(resizer, (_colInfo[endCol].End + _colInfo[startCol].Start) / 2);
}
else
@@ -842,6 +838,7 @@ namespace FancyZonesEditor
e.Handled = true;
}
+
base.OnPreviewMouseMove(e);
}
@@ -849,7 +846,7 @@ namespace FancyZonesEditor
{
foreach (UIElement zone in Preview.Children)
{
- ((GridZone) zone).IsSelected = false;
+ ((GridZone)zone).IsSelected = false;
}
}
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/GridEditorWindow.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/GridEditorWindow.xaml.cs
index 2263a6091d..32d5b7781e 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/GridEditorWindow.xaml.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/GridEditorWindow.xaml.cs
@@ -1,18 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-using FancyZonesEditor.Models;
-using MahApps.Metro.Controls;
+// 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.
namespace FancyZonesEditor
{
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/GridResizer.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/GridResizer.xaml.cs
index 6762e5fdb3..ae4985fa1c 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/GridResizer.xaml.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/GridResizer.xaml.cs
@@ -1,18 +1,11 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
+// 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.Windows.Controls;
using System.Windows.Controls.Primitives;
-using System.Windows.Data;
-using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
using FancyZonesEditor.Models;
namespace FancyZonesEditor
@@ -45,18 +38,17 @@ namespace FancyZonesEditor
}
else
{
- body.RenderTransform = c_rotateTransform;
+ body.RenderTransform = _rotateTransform;
body.Cursor = Cursors.SizeNS;
}
}
}
- private static RotateTransform c_rotateTransform = new RotateTransform(90, 24, 24);
-
+ private static RotateTransform _rotateTransform = new RotateTransform(90, 24, 24);
+
public int Index;
public LayoutModel Model;
private Orientation _orientation;
-
}
}
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/GridZone.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/GridZone.xaml.cs
index b7e4a4c872..5da90c659f 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/GridZone.xaml.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/GridZone.xaml.cs
@@ -1,25 +1,20 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// 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;
using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
using System.Windows.Shapes;
namespace FancyZonesEditor
{
///
- /// Once you've "Committ"ed the starter grid, then the Zones within the grid come to life for you to be able to further subdivide them
+ /// Once you've "Committ"ed the starter grid, then the Zones within the grid come to life for you to be able to further subdivide them
/// using splitters
///
-
public partial class GridZone : UserControl
{
public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register("IsSelected", typeof(bool), typeof(GridZone), new PropertyMetadata(false, OnSelectionChanged));
@@ -28,6 +23,7 @@ namespace FancyZonesEditor
{
((GridZone)d).OnSelectionChanged();
}
+
private void OnSelectionChanged()
{
Background = IsSelected ? Brushes.SteelBlue : Brushes.LightGray;
@@ -53,7 +49,7 @@ namespace FancyZonesEditor
_splitter.Fill = Brushes.DarkGray;
Body.Children.Add(_splitter);
- ((App) Application.Current).ZoneSettings.PropertyChanged += ZoneSettings_PropertyChanged;
+ ((App)Application.Current).ZoneSettings.PropertyChanged += ZoneSettings_PropertyChanged;
}
private void ZoneSettings_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
@@ -67,7 +63,8 @@ namespace FancyZonesEditor
}
}
}
- protected override Size ArrangeOverride(Size size)
+
+ protected override Size ArrangeOverride(Size size)
{
_splitOrientation = (size.Width > size.Height) ? Orientation.Vertical : Orientation.Horizontal;
return base.ArrangeOverride(size);
@@ -89,43 +86,41 @@ namespace FancyZonesEditor
private int SplitterThickness { get { return Math.Max(((App)Application.Current).ZoneSettings.Spacing, 5); } }
private void UpdateSplitter()
- {
- int thickness = SplitterThickness;
-
+ {
if (IsVerticalSplit)
{
double bodyWidth = Body.ActualWidth;
- double pos = _lastPos.X - thickness/2;
+ double pos = _lastPos.X - (SplitterThickness / 2);
if (pos < 0)
{
pos = 0;
}
- else if (pos > (bodyWidth - thickness))
+ else if (pos > (bodyWidth - SplitterThickness))
{
- pos = bodyWidth - thickness;
+ pos = bodyWidth - SplitterThickness;
}
Canvas.SetLeft(_splitter, pos);
Canvas.SetTop(_splitter, 0);
- _splitter.MinWidth = thickness;
+ _splitter.MinWidth = SplitterThickness;
_splitter.MinHeight = Body.ActualHeight;
}
else
{
double bodyHeight = Body.ActualHeight;
- double pos = _lastPos.Y - thickness / 2;
+ double pos = _lastPos.Y - (SplitterThickness / 2);
if (pos < 0)
{
pos = 0;
}
- else if (pos > (bodyHeight - thickness))
+ else if (pos > (bodyHeight - SplitterThickness))
{
- pos = bodyHeight - thickness;
+ pos = bodyHeight - SplitterThickness;
}
Canvas.SetLeft(_splitter, 0);
Canvas.SetTop(_splitter, pos);
_splitter.MinWidth = Body.ActualWidth;
- _splitter.MinHeight = thickness;
+ _splitter.MinHeight = SplitterThickness;
}
}
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/LayoutPreview.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/LayoutPreview.xaml.cs
index efca6d58cc..7e1a6c8a53 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/LayoutPreview.xaml.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/LayoutPreview.xaml.cs
@@ -1,18 +1,13 @@
-using FancyZonesEditor.Models;
-using System;
+// 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.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
using System.Windows.Shapes;
+using FancyZonesEditor.Models;
namespace FancyZonesEditor
{
@@ -75,7 +70,7 @@ namespace FancyZonesEditor
}
private void RenderPreview()
- {
+ {
if (_model == null)
{
return;
@@ -116,7 +111,7 @@ namespace FancyZonesEditor
Body.ColumnDefinitions.Add(def);
}
- Settings settings = ((App) Application.Current).ZoneSettings;
+ Settings settings = ((App)Application.Current).ZoneSettings;
int divisor = IsActualSize ? 2 : 20;
Thickness margin = new Thickness(settings.ShowSpacing ? settings.Spacing / divisor : 0);
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml.cs
index 0c0e8a74e5..6468a82f05 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/MainWindow.xaml.cs
@@ -1,18 +1,14 @@
+// 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.Collections.Generic;
using System.Linq;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
-using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
using FancyZonesEditor.Models;
using MahApps.Metro.Controls;
@@ -25,7 +21,10 @@ namespace FancyZonesEditor
{
// TODO: share the constants b/w C# Editor and FancyZoneLib
public static int MAX_ZONES = 40;
-
+ private static string _defaultNamePrefix = "Custom Layout ";
+ private bool _editing = false;
+ private int _WrapPanelItemSize = 262;
+
public MainWindow()
{
InitializeComponent();
@@ -37,7 +36,6 @@ namespace FancyZonesEditor
}
}
- private int _WrapPanelItemSize = 262;
public int WrapPanelItemSize
{
get
@@ -82,7 +80,7 @@ namespace FancyZonesEditor
}
private void Select(LayoutModel newSelection)
- {
+ {
LayoutModel currentSelection = EditorOverlay.Current.DataContext as LayoutModel;
if (currentSelection != null)
@@ -95,9 +93,6 @@ namespace FancyZonesEditor
EditorOverlay.Current.DataContext = newSelection;
}
- private static string c_defaultNamePrefix = "Custom Layout ";
- private bool _editing = false;
-
private void EditLayout_Click(object sender, RoutedEventArgs e)
{
EditorOverlay mainEditor = EditorOverlay.Current;
@@ -125,10 +120,10 @@ namespace FancyZonesEditor
foreach (LayoutModel customModel in _settings.CustomModels)
{
string name = customModel.Name;
- if (name.StartsWith(c_defaultNamePrefix))
+ if (name.StartsWith(_defaultNamePrefix))
{
int i;
- if (Int32.TryParse(name.Substring(c_defaultNamePrefix.Length), out i))
+ if (Int32.TryParse(name.Substring(_defaultNamePrefix.Length), out i))
{
if (maxCustomIndex < i)
{
@@ -137,7 +132,7 @@ namespace FancyZonesEditor
}
}
}
- model.Name = c_defaultNamePrefix + (++maxCustomIndex);
+ model.Name = _defaultNamePrefix + (++maxCustomIndex);
}
mainEditor.Edit();
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Models/CanvasLayoutModel.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Models/CanvasLayoutModel.cs
index c9eeba4d69..6c72159b4d 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/Models/CanvasLayoutModel.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/Models/CanvasLayoutModel.cs
@@ -1,16 +1,13 @@
-using System;
-using System.Collections;
+// 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.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows;
-using System.Windows.Converters;
-using System.Windows.Documents;
namespace FancyZonesEditor.Models
{
- // CanvasLayoutModel
+ // CanvasLayoutModel
// Free form Layout Model, which specifies independent zone rects
public class CanvasLayoutModel : LayoutModel
{
@@ -30,7 +27,9 @@ namespace FancyZonesEditor.Models
}
public CanvasLayoutModel(string name, ushort id) : base(name, id) { }
+
public CanvasLayoutModel(string name) : base(name) { }
+
public CanvasLayoutModel() : base() { }
// ReferenceWidth - the reference width for the layout rect that all Zones are relative to
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Models/GridLayoutModel.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Models/GridLayoutModel.cs
index 23b659f0bb..15fb4882b0 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/Models/GridLayoutModel.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/Models/GridLayoutModel.cs
@@ -1,14 +1,12 @@
-using System;
-using System.Collections;
+// 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.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Documents;
namespace FancyZonesEditor.Models
{
- // GridLayoutModel
+ // GridLayoutModel
// Grid-styled Layout Model, which specifies rows, columns, percentage sizes, and row/column spans
public class GridLayoutModel : LayoutModel
{
@@ -52,26 +50,22 @@ namespace FancyZonesEditor.Models
}
private int _cols = 1;
- // CellChildMap - represents which "children" belong in which grid cells;
+ // CellChildMap - represents which "children" belong in which grid cells;
// shows spanning children by the same index appearing in adjacent cells
// TODO: ideally no setter here - this means moving logic like "split" over to model
- public int[,] CellChildMap { get { return _cellChildMap; } set { _cellChildMap = value; } }
- private int[,] _cellChildMap;
-
- // RowPercents - represents the %age height of each row in the grid
- public int[] RowPercents { get { return _rowPercents; } set { _rowPercents = value; } }
- private int[] _rowPercents;
-
- // ColumnPercents - represents the %age width of each column in the grid
- public int[] ColumnPercents { get { return _colPercents; } set { _colPercents = value; } }
- private int[] _colPercents;
-
- // FreeZones (not persisted) - used to keep track of child indices that are no longer in use in the CellChildMap,
- // making them candidates for re-use when it's needed to add another child
- // TODO: do I need FreeZones on the data model? - I think I do
- public IList FreeZones { get { return _freeZones; } }
- private IList _freeZones = new List();
-
+ public int[,] CellChildMap { get; set; }
+
+ // RowPercents - represents the %age height of each row in the grid
+ public int[] RowPercents { get; set; }
+
+ // ColumnPercents - represents the %age width of each column in the grid
+ public int[] ColumnPercents { get; set; }
+
+ // FreeZones (not persisted) - used to keep track of child indices that are no longer in use in the CellChildMap,
+ // making them candidates for re-use when it's needed to add another child
+ // TODO: do I need FreeZones on the data model? - I think I do
+ public IList FreeZones { get; } = new List();
+
public void Reload(byte[] data)
{
// Skip version (2 bytes), id (2 bytes), and type (1 bytes)
@@ -80,24 +74,24 @@ namespace FancyZonesEditor.Models
Rows = data[i++];
Columns = data[i++];
- _rowPercents = new int[Rows];
+ RowPercents = new int[Rows];
for (int row = 0; row < Rows; row++)
{
- _rowPercents[row] = data[i++]*256 + data[i++];
+ RowPercents[row] = (data[i++] * 256) + data[i++];
}
- _colPercents = new int[Columns];
+ ColumnPercents = new int[Columns];
for (int col = 0; col < Columns; col++)
{
- _colPercents[col] = data[i++]*256 + data[i++];
+ ColumnPercents[col] = (data[i++] * 256) + data[i++];
}
- _cellChildMap = new int[Rows, Columns];
+ CellChildMap = new int[Rows, Columns];
for (int row = 0; row < Rows; row++)
{
for (int col = 0; col < Columns; col++)
{
- _cellChildMap[row, col] = data[i++];
+ CellChildMap[row, col] = data[i++];
}
}
}
@@ -151,10 +145,10 @@ namespace FancyZonesEditor.Models
int[,] cellChildMap;
- if (_freeZones.Count == 0)
+ if (FreeZones.Count == 0)
{
// no unused indices -- so we can just use the _cellChildMap as is
- cellChildMap = _cellChildMap;
+ cellChildMap = CellChildMap;
}
else
{
@@ -167,7 +161,7 @@ namespace FancyZonesEditor.Models
{
for (int col = 0; col < cols; col++)
{
- int source = _cellChildMap[row, col];
+ int source = CellChildMap[row, col];
int index = mapping.IndexOf(source);
if (index == -1)
@@ -196,14 +190,14 @@ namespace FancyZonesEditor.Models
for (int row = 0; row < Rows; row++)
{
- int rowPercent = _rowPercents[row];
+ int rowPercent = RowPercents[row];
data[i++] = (byte)(rowPercent / 256);
data[i++] = (byte)(rowPercent % 256);
}
for (int col = 0; col < Columns; col++)
{
- int colPercent = _colPercents[col];
+ int colPercent = ColumnPercents[col];
data[i++] = (byte)(colPercent / 256);
data[i++] = (byte)(colPercent % 256);
}
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Models/LayoutModel.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Models/LayoutModel.cs
index f86f47439d..4a81e9bc8b 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/Models/LayoutModel.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/Models/LayoutModel.cs
@@ -1,13 +1,11 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
+// 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.Collections.ObjectModel;
using System.ComponentModel;
-using System.Linq;
using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
using Microsoft.Win32;
namespace FancyZonesEditor.Models
@@ -59,7 +57,7 @@ namespace FancyZonesEditor.Models
private ushort _id = 0;
// IsSelected (not-persisted) - tracks whether or not this LayoutModel is selected in the picker
- // TODO: once we switch to a picker per monitor, we need to move this state to the view
+ // TODO: once we switch to a picker per monitor, we need to move this state to the view
public bool IsSelected
{
get { return _isSelected; }
@@ -72,6 +70,7 @@ namespace FancyZonesEditor.Models
}
}
}
+
private bool _isSelected;
// implementation of INotifyProeprtyChanged
@@ -80,14 +79,13 @@ namespace FancyZonesEditor.Models
// FirePropertyChanged -- wrapper that calls INPC.PropertyChanged
protected virtual void FirePropertyChanged(string propertyName)
{
- PropertyChangedEventHandler handler = PropertyChanged;
- if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
// Removes this Layout from the registry and the loaded CustomModels list
public void Delete()
{
- RegistryKey key = Registry.CurrentUser.OpenSubKey(c_registryPath, true);
+ RegistryKey key = Registry.CurrentUser.OpenSubKey(_registryPath, true);
if (key != null)
{
key.DeleteValue(Name);
@@ -105,17 +103,17 @@ namespace FancyZonesEditor.Models
{
s_customModels = new ObservableCollection();
- RegistryKey key = Registry.CurrentUser.OpenSubKey(c_registryPath);
+ RegistryKey key = Registry.CurrentUser.OpenSubKey(_registryPath);
if (key != null)
{
foreach (string name in key.GetValueNames())
{
LayoutModel model = null;
- byte[] data = (byte[])Registry.GetValue(c_fullRegistryPath, name, null);
+ byte[] data = (byte[])Registry.GetValue(_fullRegistryPath, name, null);
- ushort version = (ushort) (data[0]*256 + data[1]);
+ ushort version = (ushort)(data[0] * 256 + data[1]);
byte type = data[2];
- ushort id = (ushort) (data[3]*256 + data[4]);
+ ushort id = (ushort)((data[3] * 256) + data[4]);
switch (type)
{
@@ -143,7 +141,7 @@ namespace FancyZonesEditor.Models
// Callbacks that the base LayoutModel makes to derived types
protected abstract byte[] GetPersistData();
public abstract LayoutModel Clone();
-
+
// PInvokes to handshake with fancyzones backend
internal static class Native
{
@@ -165,12 +163,12 @@ namespace FancyZonesEditor.Models
public void Persist(System.Windows.Int32Rect[] zones)
{
// Persist the editor data
- Registry.SetValue(c_fullRegistryPath, Name, GetPersistData(), Microsoft.Win32.RegistryValueKind.Binary);
+ Registry.SetValue(_fullRegistryPath, Name, GetPersistData(), Microsoft.Win32.RegistryValueKind.Binary);
Apply(zones);
}
public void Apply(System.Windows.Int32Rect[] zones)
- {
+ {
// Persist the zone data back into FZ
var module = Native.LoadLibrary("fancyzones.dll");
if (module == IntPtr.Zero)
@@ -196,16 +194,16 @@ namespace FancyZonesEditor.Models
var index = i * 4;
zoneArray[index] = left;
- zoneArray[index+1] = top;
- zoneArray[index+2] = right;
- zoneArray[index+3] = bottom;
+ zoneArray[index + 1] = top;
+ zoneArray[index + 2] = right;
+ zoneArray[index + 3] = bottom;
}
var persistZoneSet = Marshal.GetDelegateForFunctionPointer(pfn);
persistZoneSet(Settings.UniqueKey, Settings.WorkAreaKey, Settings.Monitor, _id, zoneCount, zoneArray);
}
- private static readonly string c_registryPath = Settings.RegistryPath + "\\Layouts";
- private static readonly string c_fullRegistryPath = Settings.FullRegistryPath + "\\Layouts";
+ private static readonly string _registryPath = Settings.RegistryPath + "\\Layouts";
+ private static readonly string _fullRegistryPath = Settings.FullRegistryPath + "\\Layouts";
}
}
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Models/Settings.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Models/Settings.cs
index f237bf5443..6ecb1d5293 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/Models/Settings.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/Models/Settings.cs
@@ -1,25 +1,21 @@
-using System;
+// 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.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.ComponentModel;
-using System.Collections;
using System.Collections.ObjectModel;
+using System.ComponentModel;
using System.Globalization;
-using FancyZonesEditor.Models;
-using System.Windows.Documents;
using System.Windows;
-using System.Windows.Controls;
+using FancyZonesEditor.Models;
using Microsoft.Win32;
namespace FancyZonesEditor
{
- //
// Settings
// These are the configuration settings used by the rest of the editor
// Other UIs in the editor will subscribe to change events on the properties to stay up to date as these properties change
- //
public class Settings : INotifyPropertyChanged
{
public bool IsCustomLayoutActive
@@ -271,9 +267,9 @@ namespace FancyZonesEditor
}
// Update the "Priority Grid" Default Layout
- if (ZoneCount <= s_priorityData.Length)
+ if (ZoneCount <= _priorityData.Length)
{
- _priorityGridModel.Reload(s_priorityData[ZoneCount - 1]);
+ _priorityGridModel.Reload(_priorityData[ZoneCount - 1]);
}
else
{
@@ -374,8 +370,8 @@ namespace FancyZonesEditor
// storage for Default Layout Models
private IList _defaultModels;
- private CanvasLayoutModel _focusModel;
- private GridLayoutModel _rowsModel;
+ private CanvasLayoutModel _focusModel;
+ private GridLayoutModel _rowsModel;
private GridLayoutModel _columnsModel;
private GridLayoutModel _gridModel;
private GridLayoutModel _priorityGridModel;
@@ -390,7 +386,7 @@ namespace FancyZonesEditor
private static readonly ushort c_lastPrefinedId = c_blankCustomModelId;
// hard coded data for all the "Priority Grid" configurations that are unique to "Grid"
- private static byte[][] s_priorityData = new byte[][]
+ private static byte[][] _priorityData = new byte[][]
{
new byte[] { 0, 0, 0, 0, 0, 1, 1, 39, 16, 39, 16, 0 },
new byte[] { 0, 0, 0, 0, 0, 1, 2, 39, 16, 26, 11, 13, 5, 0, 1 },
@@ -402,7 +398,7 @@ namespace FancyZonesEditor
new byte[] { 0, 0, 0, 0, 0, 3, 4, 13, 5, 13, 6, 13, 5, 9, 196, 9, 196, 9, 196, 9, 196, 0, 1, 2, 3, 4, 1, 2, 5, 6, 1, 2, 7 },
new byte[] { 0, 0, 0, 0, 0, 3, 4, 13, 5, 13, 6, 13, 5, 9, 196, 9, 196, 9, 196, 9, 196, 0, 1, 2, 3, 4, 1, 2, 5, 6, 1, 7, 8 },
new byte[] { 0, 0, 0, 0, 0, 3, 4, 13, 5, 13, 6, 13, 5, 9, 196, 9, 196, 9, 196, 9, 196, 0, 1, 2, 3, 4, 1, 5, 6, 7, 1, 8, 9 },
- new byte[] { 0, 0, 0, 0, 0, 3, 4, 13, 5, 13, 6, 13, 5, 9, 196, 9, 196, 9, 196, 9, 196, 0, 1, 2, 3, 4, 1, 5, 6, 7, 8, 9, 10 }
+ new byte[] { 0, 0, 0, 0, 0, 3, 4, 13, 5, 13, 6, 13, 5, 9, 196, 9, 196, 9, 196, 9, 196, 0, 1, 2, 3, 4, 1, 5, 6, 7, 8, 9, 10 },
};
private const int c_multiplier = 10000;
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/Properties/AssemblyInfo.cs b/src/modules/fancyzones/editor/FancyZonesEditor/Properties/AssemblyInfo.cs
index d330ad4cff..190f6d51e7 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/Properties/AssemblyInfo.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/Properties/AssemblyInfo.cs
@@ -1,6 +1,8 @@
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
+// 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.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/RowColInfo.cs b/src/modules/fancyzones/editor/FancyZonesEditor/RowColInfo.cs
index 0f126e330f..e1303dd4b4 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/RowColInfo.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/RowColInfo.cs
@@ -1,8 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// 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.
namespace FancyZonesEditor
{
diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/WindowLayout.xaml.cs b/src/modules/fancyzones/editor/FancyZonesEditor/WindowLayout.xaml.cs
index 55a23efe91..1735b0e782 100644
--- a/src/modules/fancyzones/editor/FancyZonesEditor/WindowLayout.xaml.cs
+++ b/src/modules/fancyzones/editor/FancyZonesEditor/WindowLayout.xaml.cs
@@ -1,16 +1,8 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+// 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.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
namespace FancyZonesEditor
{