Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FancyZones Editor] Add Fluent Design and theming support #8148

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
ba0f5b6
Removed MetroWindow, added theming support and modernWPF
Nov 19, 2020
804c48a
Rmoved MahApps refs
Nov 19, 2020
da40a77
Removed MahApps
Nov 20, 2020
f6e8f69
Updated canvas zones
niels9001 Nov 21, 2020
9ce6e2d
Updated GridEditor
niels9001 Nov 21, 2020
e362ec9
Fixes
niels9001 Nov 21, 2020
a511bbb
UI updates
niels9001 Nov 21, 2020
b64c5de
New layout type selection dialog
niels9001 Nov 21, 2020
71905c5
New editor UI
niels9001 Nov 22, 2020
806b75a
Updates
niels9001 Nov 24, 2020
008c469
Fix
niels9001 Nov 24, 2020
3cd48cb
UI enhancements
niels9001 Nov 27, 2020
08c4c36
Updated UI
niels9001 Nov 27, 2020
d910a08
Added styles to layoutpreview
niels9001 Nov 27, 2020
6172ccd
Accesibility improvements
niels9001 Nov 29, 2020
1d070f4
Accesibility and styling improvements
niels9001 Nov 29, 2020
4c5f01d
Fix
niels9001 Nov 29, 2020
5cdc1b4
Cleaned up brushes
niels9001 Dec 1, 2020
463728d
Updated UX
niels9001 Dec 7, 2020
6d7de6b
Updated UI
niels9001 Dec 10, 2020
19a27b9
Added no layouts description
niels9001 Dec 10, 2020
ceafc69
Fix
niels9001 Dec 10, 2020
be675b6
UI fixes
niels9001 Dec 13, 2020
1f5f7db
[FZ Editor] Serialize/deserialize settings (#8615)
SeraphimaZykova Dec 16, 2020
9ebef38
conflicts fix
SeraphimaZykova Dec 17, 2020
fff8b3a
[FZ Editor] Parse json file instead of command line args (#8649)
SeraphimaZykova Dec 18, 2020
8556a06
[FZ Editor] Serialize/deserialize settings fix (#8707)
SeraphimaZykova Dec 22, 2020
5623f8e
[FZ Editor] Hide unsupported settings in custom layouts flyouts (#8716)
SeraphimaZykova Dec 23, 2020
4a38e10
[FZ Editor] Duplicate custom layouts (#8718)
SeraphimaZykova Dec 23, 2020
854482d
[FZ Editor] Duplicate layout behavior (#8720)
SeraphimaZykova Dec 24, 2020
11c3048
[FZ Editor] Spacing settings in layout flyouts (#8772)
SeraphimaZykova Dec 28, 2020
e7c2b78
[FZ Editor] Do not close the editor after applying a layout in the si…
SeraphimaZykova Dec 28, 2020
c23b3cc
[FZ Editor] Update layout preview after editing (#8775)
SeraphimaZykova Dec 28, 2020
f6e0e29
[FZ Editor] Disable layout preview on mouse enter (#8852)
SeraphimaZykova Dec 31, 2020
e5cb4ba
[FZ Editor] Update ModernWpf package (dialog rendering fix) (#9099)
SeraphimaZykova Jan 14, 2021
5dc231b
[FZ Editor] close flyout after Duplicate or Delete button was clicked…
SeraphimaZykova Jan 14, 2021
9f34337
[FZ Editor] Move zones + and - buttons to the template layouts flyout…
SeraphimaZykova Jan 14, 2021
e7dc276
[FZ Editor] Editor opening fix (#9151)
SeraphimaZykova Jan 18, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion installer/PowerToysSetup/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@
<File Source="$(var.BinX64Dir)modules\$(var.FancyZonesProjectName)\FancyZonesEditor.runtimeconfig.json" />
<File Source="$(var.BinX64Dir)modules\$(var.FancyZonesProjectName)\FancyZonesEditor.exe" />
<File Source="$(var.BinX64Dir)modules\$(var.FancyZonesProjectName)\ControlzEx.dll" />
<File Source="$(var.BinX64Dir)modules\$(var.FancyZonesProjectName)\MahApps.Metro.dll" />
<File Source="$(var.BinX64Dir)modules\$(var.FancyZonesProjectName)\Microsoft.Xaml.Behaviors.dll" />
<File Source="$(var.BinX64Dir)modules\$(var.FancyZonesProjectName)\System.Text.Json.dll" />
<File Source="$(var.BinX64Dir)modules\$(var.FancyZonesProjectName)\ManagedCommon.dll" />
Expand Down
25 changes: 17 additions & 8 deletions src/modules/fancyzones/editor/FancyZonesEditor/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,29 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:FancyZonesEditor"
xmlns:ui="http://schemas.modernwpf.com/2019"
Startup="OnStartup">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<!-- Accent and AppTheme setting -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Blue.xaml" />
<ui:ThemeResources />
<ui:XamlControlsResources />
<ResourceDictionary Source="pack://application:,,,/Styles/ButtonStyles.xaml" />
<ResourceDictionary Source="pack://application:,,,/Styles/LayoutPreviewStyles.xaml" />
</ResourceDictionary.MergedDictionaries>

<SolidColorBrush x:Key="CanvasZoneBackgroundBrush" Color="#BF333333"/>
<SolidColorBrush x:Key="GridZoneBackgroundBrush" Color="#FF1a1a1a"/>

<Style x:Key="UWPFocusVisualStyle">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate>
<Border Margin="-2"
CornerRadius="4"
BorderThickness="2"
BorderBrush="{DynamicResource PrimaryForegroundBrush}" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
66 changes: 63 additions & 3 deletions src/modules/fancyzones/editor/FancyZonesEditor/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using FancyZonesEditor.Utils;
using ManagedCommon;
Expand Down Expand Up @@ -41,6 +43,9 @@ public partial class App : Application
private const string CrashReportDynamicAssemblyTag = "dynamic assembly doesn't have location";
private const string CrashReportLocationNullTag = "location is null or empty";

private const string ParsingErrorReportTag = "Settings parsing error";
private const string ParsingErrorDataTag = "Data: ";

public MainWindowSettingsModel MainWindowSettings { get; }

public static FancyZonesEditorIO FancyZonesEditorIO { get; private set; }
Expand All @@ -49,6 +54,8 @@ public partial class App : Application

public static int PowerToysPID { get; set; }

private ThemeManager _themeManager;

public static bool DebugMode
{
get
Expand All @@ -67,7 +74,7 @@ private void DebugModeCheck()

public App()
{
DebugModeCheck();
// DebugModeCheck();
FancyZonesEditorIO = new FancyZonesEditorIO();
Overlay = new Overlay();
MainWindowSettings = new MainWindowSettingsModel();
Expand All @@ -82,8 +89,61 @@ private void OnStartup(object sender, StartupEventArgs e)
Environment.Exit(0);
});

FancyZonesEditorIO.ParseCommandLineArguments();
FancyZonesEditorIO.ParseDeviceInfoData();
_themeManager = new ThemeManager(this);

if (!FancyZonesEditorIO.ParseParams().Result)
{
FancyZonesEditorIO.ParseCommandLineArguments();
}

var parseResult = FancyZonesEditorIO.ParseZoneSettings();

// 10ms retry loop with 1 second timeout
if (!parseResult.Result)
{
CancellationTokenSource ts = new CancellationTokenSource();
Task t = Task.Run(() =>
{
while (!parseResult.Result && !ts.IsCancellationRequested)
{
Task.Delay(10).Wait();
parseResult = FancyZonesEditorIO.ParseZoneSettings();
}
});

try
{
bool result = t.Wait(1000, ts.Token);
ts.Cancel();
}
catch (OperationCanceledException)
{
ts.Dispose();
}
}

// Error message if parsing failed
if (!parseResult.Result)
{
var sb = new StringBuilder();
sb.AppendLine();
sb.AppendLine("## " + ParsingErrorReportTag);
sb.AppendLine();
sb.AppendLine(parseResult.Message);
sb.AppendLine();
sb.AppendLine(ParsingErrorDataTag);
sb.AppendLine(parseResult.MalformedData);

string message = parseResult.Message + Environment.NewLine + Environment.NewLine + FancyZonesEditor.Properties.Resources.Error_Parsing_Zones_Settings_User_Choice;
if (MessageBox.Show(message, FancyZonesEditor.Properties.Resources.Error_Parsing_Zones_Settings_Title, MessageBoxButton.YesNo) == MessageBoxResult.No)
{
// TODO: log error
ShowExceptionReportMessageBox(sb.ToString());
Environment.Exit(0);
}

ShowExceptionReportMessageBox(sb.ToString());
}

MainWindowSettingsModel settings = ((App)Current).MainWindowSettings;
settings.UpdateSelectedLayoutModel();
Expand Down
Loading