[FancyZones] "Match not found" error fix (#11840)

This commit is contained in:
Seraphima Zykova
2021-06-23 18:28:23 +03:00
committed by GitHub
parent eeea6b3bae
commit 2dc82f31b3
10 changed files with 92 additions and 178 deletions

View File

@@ -21,24 +21,20 @@ namespace FancyZonesEditor.Utils
public int Dpi { get; set; }
public bool Primary { get; private set; }
public Device(string id, int dpi, Rect bounds, Rect workArea, bool primary)
public Device(string id, int dpi, Rect bounds, Rect workArea)
{
Id = id;
Dpi = dpi;
WorkAreaRect = workArea;
UnscaledBounds = bounds;
ScaledBounds = bounds;
Primary = primary;
}
public Device(Rect bounds, Rect workArea, bool primary)
public Device(Rect bounds, Rect workArea)
{
WorkAreaRect = workArea;
UnscaledBounds = bounds;
ScaledBounds = bounds;
Primary = primary;
}
public void Scale(double scaleFactor)
@@ -61,7 +57,6 @@ namespace FancyZonesEditor.Utils
sb.AppendFormat(CultureInfo.InvariantCulture, "ID: {0}{1}", Id, Environment.NewLine);
sb.AppendFormat(CultureInfo.InvariantCulture, "DPI: {0}{1}", Dpi, Environment.NewLine);
sb.AppendFormat(CultureInfo.InvariantCulture, "Is primary: {0}{1}", Primary, Environment.NewLine);
string workArea = string.Format(CultureInfo.InvariantCulture, "({0}, {1}, {2}, {3})", WorkAreaRect.X, WorkAreaRect.Y, WorkAreaRect.Width, WorkAreaRect.Height);
string bounds = string.Format(CultureInfo.InvariantCulture, "({0}, {1}, {2}, {3})", UnscaledBounds.X, UnscaledBounds.Y, UnscaledBounds.Width, UnscaledBounds.Height);

View File

@@ -187,6 +187,14 @@ namespace FancyZonesEditor
return model.Type != LayoutType.Custom;
}
public void InitModels()
{
foreach (var model in DefaultModels)
{
model.InitTemplateZones();
}
}
public LayoutModel UpdateSelectedLayoutModel()
{
LayoutModel foundModel = null;

View File

@@ -18,11 +18,11 @@ namespace FancyZonesEditor.Models
public Device Device { get; set; }
public Monitor(Rect bounds, Rect workArea, bool primary)
public Monitor(Rect bounds, Rect workArea)
{
Window = new LayoutOverlayWindow();
Settings = new LayoutSettings();
Device = new Device(bounds, workArea, primary);
Device = new Device(bounds, workArea);
if (App.DebugMode)
{
@@ -41,10 +41,10 @@ namespace FancyZonesEditor.Models
Window.Height = workArea.Height;
}
public Monitor(string id, int dpi, Rect bounds, Rect workArea, bool primary)
: this(bounds, workArea, primary)
public Monitor(string id, int dpi, Rect bounds, Rect workArea)
: this(bounds, workArea)
{
Device = new Device(id, dpi, bounds, workArea, primary);
Device = new Device(id, dpi, bounds, workArea);
}
public void Scale(double scaleFactor)