Merge branch 'master' into spelling

This commit is contained in:
Clint Rutkas
2020-11-02 09:57:48 -08:00
committed by GitHub
245 changed files with 2177 additions and 1210 deletions

View File

@@ -6,6 +6,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.IO.Abstractions;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
@@ -41,6 +42,8 @@ namespace FancyZonesEditor
private const string CrashReportDynamicAssemblyTag = "dynamic assembly doesn't have location";
private const string CrashReportLocationNullTag = "location is null or empty";
private readonly IFileSystem _fileSystem = new FileSystem();
public Settings ZoneSettings { get; }
public App()
@@ -157,6 +160,8 @@ namespace FancyZonesEditor
sb.AppendLine("## " + CrashReportEnvironmentTag);
sb.AppendLine(CrashReportCommandLineTag + Environment.CommandLine);
// Using InvariantCulture since this is used for a timestamp internally
sb.AppendLine(CrashReportTimestampTag + DateTime.Now.ToString(CultureInfo.InvariantCulture));
sb.AppendLine(CrashReportOSVersionTag + Environment.OSVersion.VersionString);
sb.AppendLine(CrashReportIntPtrLengthTag + IntPtr.Size);

View File

@@ -250,6 +250,9 @@
<PackageReference Include="MahApps.Metro">
<Version>2.3.0</Version>
</PackageReference>
<PackageReference Include="System.IO.Abstractions">
<Version>12.2.5</Version>
</PackageReference>
<PackageReference Include="System.Text.Json">
<Version>4.7.2</Version>
</PackageReference>

View File

@@ -166,8 +166,8 @@
<TextBlock Name="windowEditorDialogTitle" Text="{x:Static props:Resources.Custom_Table_Layout}" Style="{StaticResource titleText}" />
<TextBlock Text="{x:Static props:Resources.Note_Custom_Table}" Style="{StaticResource textLabel}" TextWrapping="Wrap" />
<TextBlock Text="{x:Static props:Resources.Name}" Style="{StaticResource textLabel}" />
<TextBox Text="{Binding Name}" Style="{StaticResource textBox}" />
<TextBlock x:Name="customLayoutName" Text="{x:Static props:Resources.Name}" Style="{StaticResource textLabel}" />
<TextBox Text="{Binding Name}" AutomationProperties.LabeledBy="{Binding ElementName=customLayoutName}" Style="{StaticResource textBox}" />
<!--
<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
<CheckBox x:Name="showGridSetting" VerticalAlignment="Center" HorizontalAlignment="Center" IsChecked="True" Margin="21,4,0,0"/>

View File

@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Abstractions;
using System.Text.Json;
using System.Windows;
@@ -201,7 +201,7 @@ namespace FancyZonesEditor.Models
try
{
string jsonString = JsonSerializer.Serialize(jsonObj, options);
File.WriteAllText(Settings.AppliedZoneSetTmpFile, jsonString);
FileSystem.File.WriteAllText(Settings.AppliedZoneSetTmpFile, jsonString);
}
catch (Exception ex)
{

View File

@@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;
using System.Windows;
@@ -237,7 +236,7 @@ namespace FancyZonesEditor.Models
try
{
string jsonString = JsonSerializer.Serialize(jsonObj, options);
File.WriteAllText(Settings.AppliedZoneSetTmpFile, jsonString);
FileSystem.File.WriteAllText(Settings.AppliedZoneSetTmpFile, jsonString);
}
catch (Exception ex)
{

View File

@@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.IO.Abstractions;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text.Json;
@@ -29,6 +30,8 @@ namespace FancyZonesEditor.Models
// Manages common properties and base persistence
public abstract class LayoutModel : INotifyPropertyChanged
{
protected static readonly IFileSystem FileSystem = new FileSystem();
// Localizable strings
private const string ErrorMessageBoxTitle = "FancyZones Editor Exception Handler";
private const string ErrorMessageBoxMessage = "Please report the bug to ";
@@ -194,7 +197,7 @@ namespace FancyZonesEditor.Models
try
{
string jsonString = JsonSerializer.Serialize(deletedLayouts, options);
File.WriteAllText(Settings.DeletedCustomZoneSetsTmpFile, jsonString);
FileSystem.File.WriteAllText(Settings.DeletedCustomZoneSetsTmpFile, jsonString);
}
catch (Exception ex)
{
@@ -209,7 +212,7 @@ namespace FancyZonesEditor.Models
try
{
FileStream inputStream = File.Open(Settings.FancyZonesSettingsFile, FileMode.Open);
Stream inputStream = FileSystem.File.Open(Settings.FancyZonesSettingsFile, FileMode.Open);
JsonDocument jsonObject = JsonDocument.Parse(inputStream, options: default);
JsonElement.ArrayEnumerator customZoneSetsEnumerator = jsonObject.RootElement.GetProperty(CustomZoneSetsJsonTag).EnumerateArray();
@@ -437,7 +440,7 @@ namespace FancyZonesEditor.Models
try
{
string jsonString = JsonSerializer.Serialize(zoneSet, options);
File.WriteAllText(Settings.ActiveZoneSetTmpFile, jsonString);
FileSystem.File.WriteAllText(Settings.ActiveZoneSetTmpFile, jsonString);
}
catch (Exception ex)
{

View File

@@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.IO.Abstractions;
using System.Runtime.CompilerServices;
using System.Text.Json;
using System.Windows;
@@ -39,6 +40,8 @@ namespace FancyZonesEditor
Debug,
}
private static readonly IFileSystem _fileSystem = new FileSystem();
private static CanvasLayoutModel _blankCustomModel;
private readonly CanvasLayoutModel _focusModel;
private readonly GridLayoutModel _rowsModel;
@@ -137,7 +140,7 @@ namespace FancyZonesEditor
public Settings()
{
string tmpDirPath = Path.GetTempPath();
string tmpDirPath = _fileSystem.Path.GetTempPath();
ActiveZoneSetTmpFile = tmpDirPath + ActiveZoneSetsTmpFileName;
AppliedZoneSetTmpFile = tmpDirPath + AppliedZoneSetsTmpFileName;
@@ -441,9 +444,9 @@ namespace FancyZonesEditor
ActiveZoneSetUUid = NullUuidStr;
JsonElement jsonObject = default(JsonElement);
if (File.Exists(Settings.ActiveZoneSetTmpFile))
if (_fileSystem.File.Exists(Settings.ActiveZoneSetTmpFile))
{
FileStream inputStream = File.Open(Settings.ActiveZoneSetTmpFile, FileMode.Open);
Stream inputStream = _fileSystem.File.Open(Settings.ActiveZoneSetTmpFile, FileMode.Open);
jsonObject = JsonDocument.Parse(inputStream, options: default).RootElement;
inputStream.Close();
UniqueKey = jsonObject.GetProperty(DeviceIdJsonTag).GetString();

View File

@@ -37,7 +37,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";FancyZones" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";FancyZones" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[FancyZones]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
@@ -46,7 +46,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";FancyZones_Data_Error" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";FancyZones_Data_Error" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[FancyZones persisted data path not found. Please report the bug to]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
@@ -55,7 +55,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";FancyZones_Editor_Launch_Error" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";FancyZones_Editor_Launch_Error" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[The FancyZones editor failed to start. Please report the bug to]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
@@ -64,7 +64,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";FancyZones_Settings_Load_Error" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";FancyZones_Settings_Load_Error" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Failed to load the FancyZones settings. Default settings will be used.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
@@ -73,7 +73,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";FancyZones_Settings_Save_Error" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";FancyZones_Settings_Save_Error" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Failed to save the FancyZones settings. Please retry again later, if the problem persists report the bug to]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
@@ -91,7 +91,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Powertoys_FancyZones" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Powertoys_FancyZones" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[PowerToys - FancyZones]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
@@ -100,7 +100,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Setting_Description" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Setting_Description" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Create window layouts to help make multi-tasking easy]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
@@ -109,7 +109,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Setting_Description_AppLastZone_MoveWindows" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Setting_Description_AppLastZone_MoveWindows" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Move newly created windows to their last known zone]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
@@ -118,7 +118,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Setting_Description_DisplayChange_MoveWindows" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Setting_Description_DisplayChange_MoveWindows" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Keep windows in their zones when the screen resolution changes]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
@@ -145,7 +145,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Setting_Description_Move_Window_Across_Monitors" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Setting_Description_Move_Window_Across_Monitors" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Move windows between zones across all monitors when snapping with (Win + Arrow)]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
@@ -154,7 +154,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Setting_Description_Move_Windows_Based_On_Position" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Setting_Description_Move_Windows_Based_On_Position" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Move windows based on their position when snapping with (Win + Arrow)]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
@@ -172,7 +172,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Setting_Description_Override_Snap_Hotkeys" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Setting_Description_Override_Snap_Hotkeys" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Override Windows Snap hotkeys (Win + Arrow) to move windows between zones]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
@@ -190,7 +190,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Setting_Description_ShiftDrag" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Setting_Description_ShiftDrag" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Hold Shift key to activate zones while dragging]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
@@ -219,10 +219,13 @@
</Item>
<Item ItemId=";Setting_Description_Use_CursorPos_Editor_StartupScreen" ItemType="0;.resx" PsrId="211" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Follow mouse cursor instead of focus when launching editor in a multi screen environment]]></Val>
<Val><![CDATA[Follow mouse cursor instead of focus when launching editor in a multi-screen environment]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
<Val><![CDATA[Při spouštění editoru v prostředí s více obrazovkami sledovat ukazatel myši místo fokusu]]></Val>
</Tgt>
<Prev Cat="Text">
<Val><![CDATA[Follow mouse cursor instead of focus when launching editor in a multi screen environment]]></Val>
</Prev>
</Str>
<Disp Icon="Str" />
</Item>
@@ -244,7 +247,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Setting_Description_ZoneSetChange_FlashZones" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Setting_Description_ZoneSetChange_FlashZones" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Flash zones when the active FancyZones layout changes]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
@@ -253,7 +256,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Setting_Description_ZoneSetChange_MoveWindows" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Setting_Description_ZoneSetChange_MoveWindows" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[During zone layout changes, windows assigned to a zone will match new size/positions]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
@@ -271,7 +274,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Setting_Excluded_Apps_Description" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Setting_Excluded_Apps_Description" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[To exclude an application from snapping to zones add its name here (one per line). Excluded apps will react to the Windows Snap regardless of all other settings.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
@@ -289,7 +292,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Setting_Launch_Editor_Description" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Setting_Launch_Editor_Description" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[To launch the zone editor, select the Edit zones button below or press the zone editor hotkey anytime]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
@@ -316,7 +319,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Settings_Highlight_Opacity" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Settings_Highlight_Opacity" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Zone opacity (%)]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">
@@ -334,7 +337,7 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Window_Event_Listener_Error" ItemType="0;.resx" PsrId="211" Leaf="true">
<Item ItemId=";Window_Event_Listener_Error" ItemType="0;.resx" PsrId="211" InstFlg="true" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Failed to install Windows event listener.]]></Val>
<Tgt Cat="Text" Stat="Loc" Orig="New">