diff --git a/src/Certify.UI.Desktop/App.xaml b/src/Certify.UI.Desktop/App.xaml index 05f269b45..de8f9f8b3 100644 --- a/src/Certify.UI.Desktop/App.xaml +++ b/src/Certify.UI.Desktop/App.xaml @@ -2,77 +2,100 @@ x:Class="Certify.UI.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls" xmlns:utils="clr-namespace:Certify.UI.Utils;assembly=Certify.UI.Shared" StartupUri="pack://application:,,,/Certify.UI.Shared;component/Windows/MainWindow.xaml"> - - - - - + + + + + #FF78B83E + #FF8FC75A + #FFA8D27A + #FFDDEECD + #FF5EA02D + #FF467D1F + #FF315916 + + + + + + + + - - - - - - - + - - - - - - + diff --git a/src/Certify.UI.Shared/Certify.UI.Shared.csproj b/src/Certify.UI.Shared/Certify.UI.Shared.csproj index a2ff71ac2..b1accc0fb 100644 --- a/src/Certify.UI.Shared/Certify.UI.Shared.csproj +++ b/src/Certify.UI.Shared/Certify.UI.Shared.csproj @@ -6,7 +6,7 @@ true 6.0.0.* - NU1701 + $(NoWarn);NU1701;WPF0001 latest @@ -25,12 +25,10 @@ - NU1701 - diff --git a/src/Certify.UI.Shared/Controls/Fluent/NumberBox.cs b/src/Certify.UI.Shared/Controls/Fluent/NumberBox.cs new file mode 100644 index 000000000..c4495d523 --- /dev/null +++ b/src/Certify.UI.Shared/Controls/Fluent/NumberBox.cs @@ -0,0 +1,118 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; + +namespace Certify.UI.Controls.Fluent +{ + public class NumberBox : TextBox + { + public static readonly DependencyProperty ValueProperty = + DependencyProperty.Register(nameof(Value), typeof(double?), typeof(NumberBox), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnValueChanged, CoerceValue)); + + public static readonly DependencyProperty MinimumProperty = + DependencyProperty.Register(nameof(Minimum), typeof(double), typeof(NumberBox), new PropertyMetadata(double.MinValue, OnLimitChanged)); + + public static readonly DependencyProperty MaximumProperty = + DependencyProperty.Register(nameof(Maximum), typeof(double), typeof(NumberBox), new PropertyMetadata(double.MaxValue, OnLimitChanged)); + + public static readonly DependencyProperty IntervalProperty = + DependencyProperty.Register(nameof(Interval), typeof(double), typeof(NumberBox), new PropertyMetadata(1d)); + + private bool _updatingText; + + public NumberBox() + { + TextChanged += NumberBox_TextChanged; + PreviewKeyDown += NumberBox_PreviewKeyDown; + } + + public event RoutedPropertyChangedEventHandler ValueChanged; + + public double? Value + { + get => (double?)GetValue(ValueProperty); + set => SetValue(ValueProperty, value); + } + + public double Minimum + { + get => (double)GetValue(MinimumProperty); + set => SetValue(MinimumProperty, value); + } + + public double Maximum + { + get => (double)GetValue(MaximumProperty); + set => SetValue(MaximumProperty, value); + } + + public double Interval + { + get => (double)GetValue(IntervalProperty); + set => SetValue(IntervalProperty, value); + } + + private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + if (d is NumberBox numberBox) + { + numberBox.UpdateText(); + numberBox.ValueChanged?.Invoke(numberBox, new RoutedPropertyChangedEventArgs((double?)e.OldValue, (double?)e.NewValue)); + } + } + + private static void OnLimitChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + d.CoerceValue(ValueProperty); + } + + private static object CoerceValue(DependencyObject d, object baseValue) + { + if (d is NumberBox numberBox && baseValue is double value) + { + return numberBox.CoerceValueWithinBounds(value); + } + + return baseValue; + } + + private void NumberBox_TextChanged(object sender, TextChangedEventArgs e) + { + if (_updatingText) + { + return; + } + + if (double.TryParse(Text, NumberStyles.Float, CultureInfo.CurrentCulture, out var value)) + { + Value = value; + } + } + + private void NumberBox_PreviewKeyDown(object sender, KeyEventArgs e) + { + if (e.Key != Key.Up && e.Key != Key.Down) + { + return; + } + + var currentValue = Value ?? (Minimum != double.MinValue ? Minimum : 0); + Value = currentValue + (e.Key == Key.Up ? Interval : -Interval); + e.Handled = true; + } + + private double CoerceValueWithinBounds(double value) + { + return Math.Max(Minimum, Math.Min(Maximum, value)); + } + + private void UpdateText() + { + _updatingText = true; + Text = Value?.ToString(CultureInfo.CurrentCulture) ?? string.Empty; + _updatingText = false; + } + } +} diff --git a/src/Certify.UI.Shared/Controls/GettingStarted.xaml b/src/Certify.UI.Shared/Controls/GettingStarted.xaml index 638d6be29..c6cb70b38 100644 --- a/src/Certify.UI.Shared/Controls/GettingStarted.xaml +++ b/src/Certify.UI.Shared/Controls/GettingStarted.xaml @@ -2,7 +2,6 @@ x:Class="Certify.UI.Controls.GettingStarted" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:Custom="http://metro.mahapps.com/winfx/xaml/controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:fa="http://schemas.fontawesome.io/icons/" xmlns:local="clr-namespace:Certify.UI.Controls" @@ -27,13 +26,13 @@ Margin="0,0,0,0" FontFamily="Segoe UI" FontSize="30" - Foreground="{DynamicResource MahApps.Brushes.Gray1}" + Foreground="{DynamicResource TextOnAccentFillColorPrimaryBrush}" TextWrapping="Wrap"> @@ -47,7 +46,6 @@ @@ -72,7 +70,7 @@ VerticalAlignment="Top" FontSize="12" FontWeight="Bold" - Foreground="{StaticResource MahApps.Brushes.IdealForeground}" + Foreground="{DynamicResource TextOnAccentFillColorPrimaryBrush}" Text="Your license key has expired. Some features will be reduced or unavailable. Please Sign In to https://certifytheweb.com and renew your license key, then re-open the app." TextWrapping="Wrap" /> @@ -119,7 +117,7 @@ Margin="0" HorizontalAlignment="Left" VerticalAlignment="Center" - Foreground="#FF6BB039" + Foreground="{DynamicResource AccentFillColorDefaultBrush}" Icon="PlayCircle" /> @@ -153,7 +151,7 @@ HorizontalAlignment="Left" VerticalAlignment="Top" FontSize="12" - Foreground="{StaticResource MahApps.Brushes.IdealForeground}" + Foreground="{DynamicResource TextOnAccentFillColorPrimaryBrush}" Text="{Binding SystemDiagnosticError}" TextWrapping="Wrap" /> @@ -280,7 +278,7 @@ Margin="0" HorizontalAlignment="Left" VerticalAlignment="Center" - Foreground="#FF6BB039" + Foreground="{DynamicResource AccentFillColorDefaultBrush}" Icon="PlusCircle" /> @@ -298,7 +296,7 @@ Margin="0" HorizontalAlignment="Left" VerticalAlignment="Center" - Foreground="#FF6BB039" + Foreground="{DynamicResource AccentFillColorDefaultBrush}" Icon="Leaf" /> diff --git a/src/Certify.UI.Shared/Controls/ManagedCertificate/AdvancedOptions.xaml b/src/Certify.UI.Shared/Controls/ManagedCertificate/AdvancedOptions.xaml index b378b10c5..ae1ba113e 100644 --- a/src/Certify.UI.Shared/Controls/ManagedCertificate/AdvancedOptions.xaml +++ b/src/Certify.UI.Shared/Controls/ManagedCertificate/AdvancedOptions.xaml @@ -2,7 +2,6 @@ x:Class="Certify.UI.Controls.ManagedCertificate.AdvancedOptions" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" xmlns:Resources="clr-namespace:Certify.Locales;assembly=Certify.Locales" xmlns:certifyui="clr-namespace:Certify.UI" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" @@ -32,14 +31,11 @@ Margin="0,0,0,0" HorizontalContentAlignment="Left" VerticalContentAlignment="Stretch" - Controls:TabControlHelper.UnderlineBrush="{DynamicResource MahApps.Brushes.Accent4}" - Controls:TabControlHelper.Underlined="TabPanel" DockPanel.Dock="Top" TabStripPlacement="Left"> @@ -89,8 +85,7 @@ @@ -114,7 +108,6 @@ @@ -258,8 +251,7 @@ @@ -274,7 +266,6 @@ @@ -291,8 +282,7 @@ Height="38" MinWidth="300" MaxWidth="600" - HorizontalAlignment="Left" - Controls:TextBoxHelper.Watermark="{x:Static Resources:SR.Comments}" + HorizontalAlignment="Left" ToolTip="{x:Static Resources:SR.Comments}" AcceptsReturn="True" DockPanel.Dock="Top" VerticalScrollBarVisibility="Auto"> @@ -349,7 +339,6 @@ @@ -378,8 +367,7 @@ x:Name="PFXPassword" Width="220" Margin="0,4,0,8" - HorizontalAlignment="Left" - Controls:TextBoxHelper.Watermark="Pfx Unlock Password (if applicable)" + HorizontalAlignment="Left" ToolTip="Pfx Unlock Password (if applicable)" PasswordChanged="PFXPassword_PasswordChanged" /> @@ -424,7 +412,7 @@ BorderThickness="2" Content="{x:Static Resources:SR.ManagedCertificateSettings_CertificateRevokeWarning}" FontWeight="Bold" - Foreground="{DynamicResource MahApps.Brushes.IdealForeground}" /> + Foreground="{DynamicResource TextOnAccentFillColorPrimaryBrush}" /> diff --git a/src/Certify.UI.Shared/Controls/ManagedCertificate/AuthorityTokenList.xaml b/src/Certify.UI.Shared/Controls/ManagedCertificate/AuthorityTokenList.xaml index c2047c3e3..fb8651354 100644 --- a/src/Certify.UI.Shared/Controls/ManagedCertificate/AuthorityTokenList.xaml +++ b/src/Certify.UI.Shared/Controls/ManagedCertificate/AuthorityTokenList.xaml @@ -1,8 +1,7 @@ - @@ -47,14 +46,12 @@ Orientation="Vertical"> @@ -340,7 +334,7 @@ ToolTip="{x:Static Resources:SR.SelectAll}"> @@ -354,7 +348,7 @@ ToolTip="{x:Static Resources:SR.ManagedCertificateSettings_SelectNone}"> @@ -369,7 +363,7 @@ ToolTip="{x:Static Resources:SR.ManagedCertificatesSettings_RefreshDomains}"> @@ -405,12 +399,11 @@ AutomationProperties.Name="Set As Primary Domain" BorderThickness="0" Click="SetPrimaryDomainOption_Click" - Style="{DynamicResource MahApps.Styles.Button.Circle}" Visibility="{Binding IsPrimaryDomain, Converter={StaticResource ResourceKey=InvBoolToVisConverter}}"> @@ -421,12 +414,11 @@ AutomationProperties.Name="Selected as Primary Domain" BorderThickness="0" Click="SetPrimaryDomainOption_Click" - Style="{DynamicResource MahApps.Styles.Button.Circle}" Visibility="{Binding IsPrimaryDomain, Converter={StaticResource ResourceKey=BoolToVisConverter}}"> @@ -437,13 +429,10 @@ @@ -458,7 +447,7 @@ @@ -509,7 +498,6 @@ @@ -518,7 +506,6 @@ diff --git a/src/Certify.UI.Shared/Controls/ManagedCertificate/ChallengeConfigItem.xaml b/src/Certify.UI.Shared/Controls/ManagedCertificate/ChallengeConfigItem.xaml index 8a84415f7..919e9feed 100644 --- a/src/Certify.UI.Shared/Controls/ManagedCertificate/ChallengeConfigItem.xaml +++ b/src/Certify.UI.Shared/Controls/ManagedCertificate/ChallengeConfigItem.xaml @@ -6,7 +6,6 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:fa="http://schemas.fontawesome.io/icons/" xmlns:local="clr-namespace:Certify.UI.Windows" - xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:models="clr-namespace:Certify.Models;assembly=Certify.Models" d:DesignHeight="200" @@ -23,7 +22,6 @@ diff --git a/src/Certify.UI.Shared/Controls/ManagedCertificate/ManagedCertificateSettings.xaml.cs b/src/Certify.UI.Shared/Controls/ManagedCertificate/ManagedCertificateSettings.xaml.cs index 2f60e0525..d2616b645 100644 --- a/src/Certify.UI.Shared/Controls/ManagedCertificate/ManagedCertificateSettings.xaml.cs +++ b/src/Certify.UI.Shared/Controls/ManagedCertificate/ManagedCertificateSettings.xaml.cs @@ -6,7 +6,6 @@ using Certify.Locales; using Certify.Models; using Certify.UI.Shared; -using MahApps.Metro.Controls; namespace Certify.UI.Controls.ManagedCertificate { @@ -248,10 +247,10 @@ private void ShowTestResultsUI() { var parentWindow = Window.GetWindow(this); var obj = parentWindow.FindName("MainFlyout"); - var flyout = (Flyout)obj; + var flyout = (GroupBox)obj; flyout.Header = "Test Progress"; flyout.Content = new TestProgress(); - flyout.IsOpen = !flyout.IsOpen; + flyout.Visibility = flyout.Visibility != Visibility.Visible ? Visibility.Visible : Visibility.Collapsed; } private async void TestChallenge_Click(object sender, EventArgs e) diff --git a/src/Certify.UI.Shared/Controls/ManagedCertificate/Preview.xaml b/src/Certify.UI.Shared/Controls/ManagedCertificate/Preview.xaml index bfe0d3be2..5c6db8cfd 100644 --- a/src/Certify.UI.Shared/Controls/ManagedCertificate/Preview.xaml +++ b/src/Certify.UI.Shared/Controls/ManagedCertificate/Preview.xaml @@ -1,4 +1,4 @@ - @@ -128,12 +128,12 @@ @@ -143,13 +143,13 @@ Certificate Active @@ -208,13 +208,13 @@ @@ -228,13 +228,13 @@ @@ -269,7 +269,7 @@ Margin="0" HorizontalAlignment="Left" VerticalAlignment="Center" - Foreground="#FF6BB039" + Foreground="{DynamicResource AccentFillColorDefaultBrush}" Icon="Database" /> @@ -27,7 +27,7 @@ Width="16" HorizontalAlignment="Center" VerticalAlignment="Center" - Foreground="{StaticResource MahApps.Brushes.Accent}" + Foreground="{DynamicResource AccentFillColorDefaultBrush}" Icon="{Binding IconName}" /> - \ No newline at end of file + diff --git a/src/Certify.UI.Shared/Controls/ManagedCertificate/TaskList.xaml b/src/Certify.UI.Shared/Controls/ManagedCertificate/TaskList.xaml index 785a13405..b8449dd04 100644 --- a/src/Certify.UI.Shared/Controls/ManagedCertificate/TaskList.xaml +++ b/src/Certify.UI.Shared/Controls/ManagedCertificate/TaskList.xaml @@ -2,7 +2,6 @@ x:Class="Certify.UI.Controls.ManagedCertificate.TaskList" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" xmlns:Resources="clr-namespace:Certify.Locales;assembly=Certify.Locales" xmlns:certifyui="clr-namespace:Certify.UI" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" @@ -50,7 +49,7 @@ @@ -68,7 +67,7 @@ @@ -84,7 +83,7 @@ @@ -95,7 +94,7 @@ @@ -130,13 +129,13 @@ diff --git a/src/Certify.UI.Shared/Controls/ManagedCertificate/Tasks.xaml b/src/Certify.UI.Shared/Controls/ManagedCertificate/Tasks.xaml index ee544b25a..74f1ddd59 100644 --- a/src/Certify.UI.Shared/Controls/ManagedCertificate/Tasks.xaml +++ b/src/Certify.UI.Shared/Controls/ManagedCertificate/Tasks.xaml @@ -1,4 +1,4 @@ - Add @@ -65,7 +65,7 @@ Add diff --git a/src/Certify.UI.Shared/Controls/ManagedCertificate/TestProgress.xaml b/src/Certify.UI.Shared/Controls/ManagedCertificate/TestProgress.xaml index eebf55c1e..9a343e69e 100644 --- a/src/Certify.UI.Shared/Controls/ManagedCertificate/TestProgress.xaml +++ b/src/Certify.UI.Shared/Controls/ManagedCertificate/TestProgress.xaml @@ -1,4 +1,4 @@ - @@ -59,7 +58,7 @@ @@ -71,7 +70,7 @@ @@ -106,7 +103,8 @@ @@ -185,13 +191,13 @@ Margin="0,0,0,0" FontSize="10" FontWeight="Normal" - Foreground="DarkGray" + Foreground="{DynamicResource TextFillColorTertiaryBrush}" Text="Managed by " /> @@ -208,7 +214,7 @@ Width="2" Margin="8,0,0,0" HorizontalAlignment="Stretch" - Background="{StaticResource MahApps.Brushes.Accent4}" /> + Background="{DynamicResource AccentFillColorTertiaryBrush}" /> @@ -114,7 +114,7 @@ HorizontalAlignment="Stretch" DockPanel.Dock="Top" FontSize="10" - Foreground="{DynamicResource MahApps.Brushes.SystemControlForegroundChromeGray}" + Foreground="{DynamicResource TextFillColorSecondaryBrush}" Text="{Binding Message}" TextWrapping="WrapWithOverflow" /> diff --git a/src/Certify.UI.Shared/Controls/QuickStart.xaml b/src/Certify.UI.Shared/Controls/QuickStart.xaml index d6d253d74..4cd8484ce 100644 --- a/src/Certify.UI.Shared/Controls/QuickStart.xaml +++ b/src/Certify.UI.Shared/Controls/QuickStart.xaml @@ -1,21 +1,18 @@ - - + Margin="16"> - + - - + + - - + + - + - + \ No newline at end of file diff --git a/src/Certify.UI.Shared/Controls/Settings/CertificateAuthorities.xaml b/src/Certify.UI.Shared/Controls/Settings/CertificateAuthorities.xaml index 293bd78a4..7ee72802d 100644 --- a/src/Certify.UI.Shared/Controls/Settings/CertificateAuthorities.xaml +++ b/src/Certify.UI.Shared/Controls/Settings/CertificateAuthorities.xaml @@ -1,4 +1,4 @@ - @@ -127,7 +127,7 @@ diff --git a/src/Certify.UI.Shared/Controls/Settings/Experiments.xaml b/src/Certify.UI.Shared/Controls/Settings/Experiments.xaml index 192120d19..3d9325621 100644 --- a/src/Certify.UI.Shared/Controls/Settings/Experiments.xaml +++ b/src/Certify.UI.Shared/Controls/Settings/Experiments.xaml @@ -1,4 +1,4 @@ - - @@ -353,7 +349,6 @@ Certificate Authority Settings @@ -364,7 +359,6 @@ Stored Credentials @@ -376,7 +370,6 @@ Maintenance Windows @@ -387,7 +380,6 @@ @@ -422,7 +414,6 @@ @@ -452,13 +443,12 @@ @@ -478,7 +468,6 @@ diff --git a/src/Certify.UI.Shared/Controls/Settings/MaintenanceWindows.xaml b/src/Certify.UI.Shared/Controls/Settings/MaintenanceWindows.xaml index b24b5e792..a9b41f2a5 100644 --- a/src/Certify.UI.Shared/Controls/Settings/MaintenanceWindows.xaml +++ b/src/Certify.UI.Shared/Controls/Settings/MaintenanceWindows.xaml @@ -2,7 +2,6 @@ x:Class="Certify.UI.Controls.Settings.MaintenanceWindows" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:fa="http://schemas.fontawesome.io/icons/" xmlns:local="clr-namespace:Certify.UI.Controls.Settings" @@ -33,7 +32,7 @@ Height="16" Margin="0,0,8,0" VerticalAlignment="Center" - Foreground="{DynamicResource MahApps.Brushes.Accent}" + Foreground="{DynamicResource AccentFillColorDefaultBrush}" Icon="Plus" /> Add Window diff --git a/src/Certify.UI.Shared/Controls/Settings/ManagementHub.xaml b/src/Certify.UI.Shared/Controls/Settings/ManagementHub.xaml index 0e261ae53..72b910372 100644 --- a/src/Certify.UI.Shared/Controls/Settings/ManagementHub.xaml +++ b/src/Certify.UI.Shared/Controls/Settings/ManagementHub.xaml @@ -1,8 +1,7 @@ - Client ID: diff --git a/src/Certify.UI.Shared/ICertifyApp.cs b/src/Certify.UI.Shared/ICertifyApp.cs index 2c58a93f9..f4f31aa28 100644 --- a/src/Certify.UI.Shared/ICertifyApp.cs +++ b/src/Certify.UI.Shared/ICertifyApp.cs @@ -1,7 +1,7 @@ -using System; +using System; using System.Windows; +using System.Windows.Threading; using Certify.Models.Providers; -using ControlzEx.Theming; using ToastNotifications; using ToastNotifications.Lifetime; using ToastNotifications.Messages; @@ -38,38 +38,52 @@ public static string ToggleTheme(System.Windows.Application application, Certify { if (initialTheme == "Dark") { - ThemeManager.Current.ChangeTheme(application, "Dark.Green"); + application.ThemeMode = ThemeMode.Dark; } else { - ThemeManager.Current.ChangeTheme(application, "Light.Green"); + application.ThemeMode = ThemeMode.Light; } - // refresh bindings to force dynamic resources to redraw - mainViewModel.RaisePropertyChangedEvent(nameof(mainViewModel.ManagedCertificates)); + RefreshTheme(application, mainViewModel); return initialTheme; } else { - var theme = ThemeManager.Current.DetectTheme(); string themeSelection; - if (theme.BaseColorScheme == "Light") + if (application.ThemeMode == ThemeMode.Light) { - ThemeManager.Current.ChangeTheme(application, "Dark.Green"); + application.ThemeMode = ThemeMode.Dark; themeSelection = "Dark"; } else { - ThemeManager.Current.ChangeTheme(application, "Light.Green"); + application.ThemeMode = ThemeMode.Light; themeSelection = "Light"; } - mainViewModel.RaisePropertyChangedEvent(nameof(mainViewModel.ManagedCertificates)); + RefreshTheme(application, mainViewModel); return themeSelection; } } + private static void RefreshTheme(System.Windows.Application application, Certify.UI.ViewModel.AppViewModel mainViewModel) + { + foreach (Window window in application.Windows) + { + window.Dispatcher.BeginInvoke(new Action(() => + { + window.InvalidateVisual(); + window.UpdateLayout(); + }), DispatcherPriority.Background); + } + + // refresh bindings that use converters returning theme brushes + mainViewModel.RaisePropertyChangedEvent(nameof(mainViewModel.ManagedCertificates)); + mainViewModel.RaisePropertyChangedEvent(nameof(mainViewModel.SelectedItem)); + } + public static Notifier Startup(ILog log, ViewModel.AppViewModel mainViewModel, StartupEventArgs e) { log?.Information("UI Startup"); diff --git a/src/Certify.UI.Shared/Utils/ExpiryDateConverter.cs b/src/Certify.UI.Shared/Utils/ExpiryDateConverter.cs index 0097f4042..0ac63ff1e 100644 --- a/src/Certify.UI.Shared/Utils/ExpiryDateConverter.cs +++ b/src/Certify.UI.Shared/Utils/ExpiryDateConverter.cs @@ -89,11 +89,12 @@ public static System.Windows.Media.Brush GetColour(Lifetime lifetime) { try { - return (System.Windows.Media.Brush)ViewModel.AppViewModel.Current.GetApplication().Resources["MahApps.Brushes.SystemControlForegroundBaseMediumHigh"]; + return System.Windows.Application.Current?.TryFindResource("TextFillColorPrimaryBrush") as System.Windows.Media.Brush + ?? System.Windows.SystemColors.ControlTextBrush; } catch { - //unit test may not reference MahApps + //unit test may not reference WPF application resources return System.Windows.Media.Brushes.Green; } } diff --git a/src/Certify.UI.Shared/Utils/ManagedCertificateHealthColourConverter.cs b/src/Certify.UI.Shared/Utils/ManagedCertificateHealthColourConverter.cs index 884932cf2..569d4c96e 100644 --- a/src/Certify.UI.Shared/Utils/ManagedCertificateHealthColourConverter.cs +++ b/src/Certify.UI.Shared/Utils/ManagedCertificateHealthColourConverter.cs @@ -41,9 +41,8 @@ public static System.Windows.Media.Brush GetColour(ManagedCertificateHealth heal { if (mode == "standard") { - return (System.Windows.Media.Brush) - ViewModel.AppViewModel.Current.GetApplication() - .Resources["MahApps.Brushes.SystemControlForegroundBaseHigh"]; + return System.Windows.Application.Current?.TryFindResource("TextFillColorPrimaryBrush") as System.Windows.Media.Brush + ?? System.Windows.SystemColors.ControlTextBrush; } else { diff --git a/src/Certify.UI.Shared/Windows/AddToDashboard.xaml b/src/Certify.UI.Shared/Windows/AddToDashboard.xaml index 30acdc6c0..c5f0cd1bd 100644 --- a/src/Certify.UI.Shared/Windows/AddToDashboard.xaml +++ b/src/Certify.UI.Shared/Windows/AddToDashboard.xaml @@ -1,8 +1,7 @@ - - + - + @@ -65,4 +62,4 @@ - + diff --git a/src/Certify.UI.Shared/Windows/DataStoreConnections.xaml b/src/Certify.UI.Shared/Windows/DataStoreConnections.xaml index 5fd39d995..fe1119f7d 100644 --- a/src/Certify.UI.Shared/Windows/DataStoreConnections.xaml +++ b/src/Certify.UI.Shared/Windows/DataStoreConnections.xaml @@ -1,8 +1,7 @@ - @@ -42,14 +39,11 @@ Margin="0,0,0,0" HorizontalContentAlignment="Left" VerticalContentAlignment="Stretch" - Controls:TabControlHelper.UnderlineBrush="{DynamicResource MahApps.Brushes.Accent4}" - Controls:TabControlHelper.Underlined="TabPanel" DockPanel.Dock="Top" TabStripPlacement="Top"> @@ -71,8 +65,8 @@ - - + + @@ -85,7 +79,6 @@ Click="Connect_Click" CommandParameter="{Binding}" DockPanel.Dock="Left" - Style="{DynamicResource MahApps.Styles.Button.Reveal}" ToolTip="Select this Data Store"> @@ -118,7 +111,7 @@ @@ -135,7 +128,6 @@ @@ -177,7 +169,7 @@ Margin="4,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" - Foreground="{StaticResource MahApps.Brushes.Accent}" + Foreground="{DynamicResource AccentFillColorDefaultBrush}" Icon="Database" /> @@ -208,4 +200,4 @@ - + diff --git a/src/Certify.UI.Shared/Windows/DataStoreConnections.xaml.cs b/src/Certify.UI.Shared/Windows/DataStoreConnections.xaml.cs index ad6c82fd8..daa3d6feb 100644 --- a/src/Certify.UI.Shared/Windows/DataStoreConnections.xaml.cs +++ b/src/Certify.UI.Shared/Windows/DataStoreConnections.xaml.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Threading; using System.Windows; @@ -101,7 +101,7 @@ private async void Connect_Click(object sender, RoutedEventArgs e) } } - private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) + private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { // cancel pending operations (if any) _cts.Cancel(); diff --git a/src/Certify.UI.Shared/Windows/EditAccountDialog.xaml b/src/Certify.UI.Shared/Windows/EditAccountDialog.xaml index 3ff3a1e74..94988e854 100644 --- a/src/Certify.UI.Shared/Windows/EditAccountDialog.xaml +++ b/src/Certify.UI.Shared/Windows/EditAccountDialog.xaml @@ -1,8 +1,7 @@ - - + - + @@ -110,7 +104,6 @@ @@ -135,8 +128,7 @@ Width="300" Height="23" HorizontalAlignment="Left" - VerticalAlignment="Top" - Controls:TextBoxHelper.Watermark="(optional) e.g. DST Root CA X3" + VerticalAlignment="Top" ToolTip="(optional) e.g. DST Root CA X3" Text="{Binding Item.PreferredChain}" TextWrapping="Wrap" /> @@ -193,8 +185,7 @@ Width="300" Height="23" HorizontalAlignment="Left" - VerticalAlignment="Top" - Controls:TextBoxHelper.Watermark="optional, e.g. HS256 (default), HS384 or HS512" + VerticalAlignment="Top" ToolTip="optional, e.g. HS256 (default), HS384 or HS512" Text="{Binding Item.EabKeyAlgorithm}" TextWrapping="Wrap" /> @@ -288,4 +279,4 @@ DockPanel.Dock="Left" /> - + diff --git a/src/Certify.UI.Shared/Windows/EditCertificateAuthority.xaml b/src/Certify.UI.Shared/Windows/EditCertificateAuthority.xaml index e6e4c896f..f9e3aa416 100644 --- a/src/Certify.UI.Shared/Windows/EditCertificateAuthority.xaml +++ b/src/Certify.UI.Shared/Windows/EditCertificateAuthority.xaml @@ -1,8 +1,7 @@ - - + - + @@ -70,8 +66,7 @@ Width="300" Height="48" HorizontalAlignment="Left" - VerticalAlignment="Top" - Controls:TextBoxHelper.Watermark="(Optional description)" + VerticalAlignment="Top" ToolTip="(Optional description)" Text="{Binding Model.Item.Description}" TextWrapping="Wrap" /> @@ -88,8 +83,7 @@ Width="300" Height="23" HorizontalAlignment="Left" - VerticalAlignment="Top" - Controls:TextBoxHelper.Watermark="{x:Static res:SR.EditCertificateAuthority_ProductionDirectoryHelp}" + VerticalAlignment="Top" ToolTip="{x:Static res:SR.EditCertificateAuthority_ProductionDirectoryHelp}" Text="{Binding Model.Item.ProductionAPIEndpoint}" TextWrapping="Wrap" /> @@ -106,8 +100,7 @@ Width="300" Height="23" HorizontalAlignment="Left" - VerticalAlignment="Top" - Controls:TextBoxHelper.Watermark="(Optional Url for the staging/test directory endpoint)" + VerticalAlignment="Top" ToolTip="(Optional Url for the staging/test directory endpoint)" Text="{Binding Model.Item.StagingAPIEndpoint}" TextWrapping="Wrap" /> @@ -121,12 +114,12 @@ VerticalAlignment="Top" Content="Features" /> - - - - - - + + + + + + @@ -159,4 +152,4 @@ - + diff --git a/src/Certify.UI.Shared/Windows/EditCertificateAuthority.xaml.cs b/src/Certify.UI.Shared/Windows/EditCertificateAuthority.xaml.cs index 8a058f2d4..9e1221d94 100644 --- a/src/Certify.UI.Shared/Windows/EditCertificateAuthority.xaml.cs +++ b/src/Certify.UI.Shared/Windows/EditCertificateAuthority.xaml.cs @@ -156,7 +156,7 @@ private void OnFeatureToggled(object sender, RoutedEventArgs e) { if (sender != null) { - var s = ((MahApps.Metro.Controls.ToggleSwitch)sender); + var s = ((System.Windows.Controls.Primitives.ToggleButton)sender); var featureTag = s.Tag.ToString(); Model.ToggleFeature(featureTag); diff --git a/src/Certify.UI.Shared/Windows/EditCredential.xaml b/src/Certify.UI.Shared/Windows/EditCredential.xaml index f894de907..22f40f605 100644 --- a/src/Certify.UI.Shared/Windows/EditCredential.xaml +++ b/src/Certify.UI.Shared/Windows/EditCredential.xaml @@ -1,8 +1,7 @@ - - + - + - + @@ -34,7 +31,6 @@ @@ -168,4 +163,4 @@ DockPanel.Dock="Right" /> - + diff --git a/src/Certify.UI.Shared/Windows/EditDataStoreConnection.xaml b/src/Certify.UI.Shared/Windows/EditDataStoreConnection.xaml index 994865ef0..4289170d3 100644 --- a/src/Certify.UI.Shared/Windows/EditDataStoreConnection.xaml +++ b/src/Certify.UI.Shared/Windows/EditDataStoreConnection.xaml @@ -1,24 +1,21 @@ - - + - + @@ -80,8 +76,7 @@ Width="300" Height="42" HorizontalAlignment="Left" - VerticalAlignment="Top" - Controls:TextBoxHelper.Watermark="e.g. a database connection string" + VerticalAlignment="Top" ToolTip="e.g. a database connection string" Text="{Binding Item.ConnectionConfig}" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" /> @@ -113,4 +108,4 @@ - + diff --git a/src/Certify.UI.Shared/Windows/EditDataStoreConnection.xaml.cs b/src/Certify.UI.Shared/Windows/EditDataStoreConnection.xaml.cs index a940849d3..1d2b39ad1 100644 --- a/src/Certify.UI.Shared/Windows/EditDataStoreConnection.xaml.cs +++ b/src/Certify.UI.Shared/Windows/EditDataStoreConnection.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Windows; @@ -47,7 +47,7 @@ public EditDataStoreConnectionDialog(DataStoreConnection editItem = null) } - private async void MetroWindow_Loaded(object sender, RoutedEventArgs e) + private async void Window_Loaded(object sender, RoutedEventArgs e) { Model.DataStoreProviders = await MainViewModel.GetDataStoreProviders(); } diff --git a/src/Certify.UI.Shared/Windows/EditDeploymentTask.xaml b/src/Certify.UI.Shared/Windows/EditDeploymentTask.xaml index 4de36a956..45e0afd0d 100644 --- a/src/Certify.UI.Shared/Windows/EditDeploymentTask.xaml +++ b/src/Certify.UI.Shared/Windows/EditDeploymentTask.xaml @@ -1,8 +1,7 @@ - - + - + @@ -48,4 +45,4 @@ VerticalAlignment="Top" DockPanel.Dock="Top" /> - + diff --git a/src/Certify.UI.Shared/Windows/EditMaintenanceWindow.xaml b/src/Certify.UI.Shared/Windows/EditMaintenanceWindow.xaml index 8bde37cbf..50f74b28a 100644 --- a/src/Certify.UI.Shared/Windows/EditMaintenanceWindow.xaml +++ b/src/Certify.UI.Shared/Windows/EditMaintenanceWindow.xaml @@ -1,22 +1,20 @@ - @@ -41,8 +39,7 @@ Name Description @@ -50,8 +47,7 @@ x:Name="WindowDescription" Height="60" Margin="0,4,0,16" - AcceptsReturn="True" - Controls:TextBoxHelper.Watermark="Optional description of this maintenance window" + AcceptsReturn="True" ToolTip="Optional description of this maintenance window" Text="{Binding EditWindow.Description, UpdateSourceTrigger=PropertyChanged}" VerticalScrollBarVisibility="Auto" /> @@ -153,7 +149,7 @@ Start Time (24-hour format) - : - End Time (24-hour format) - : - @@ -227,8 +223,8 @@ Schedule Preview: @@ -241,4 +237,4 @@ - + diff --git a/src/Certify.UI.Shared/Windows/EditServerConnection.xaml b/src/Certify.UI.Shared/Windows/EditServerConnection.xaml index 64722da9a..b4a42dc55 100644 --- a/src/Certify.UI.Shared/Windows/EditServerConnection.xaml +++ b/src/Certify.UI.Shared/Windows/EditServerConnection.xaml @@ -1,8 +1,7 @@ - - + - + @@ -45,8 +42,7 @@ Width="300" Height="23" HorizontalAlignment="Left" - VerticalAlignment="Top" - Controls:TextBoxHelper.Watermark="e.g. Primary Server, WEB01 etc " + VerticalAlignment="Top" ToolTip="e.g. Primary Server, WEB01 etc " Text="{Binding Item.DisplayName}" TextWrapping="Wrap" /> @@ -79,8 +75,7 @@ Width="300" Height="23" HorizontalAlignment="Left" - VerticalAlignment="Top" - Controls:TextBoxHelper.Watermark="e.g. 9696" + VerticalAlignment="Top" ToolTip="e.g. 9696" Text="{Binding Item.Port}" TextWrapping="Wrap" /> @@ -131,4 +126,4 @@ - + diff --git a/src/Certify.UI.Shared/Windows/Feedback.xaml b/src/Certify.UI.Shared/Windows/Feedback.xaml index 334ed3d0f..10269cd96 100644 --- a/src/Certify.UI.Shared/Windows/Feedback.xaml +++ b/src/Certify.UI.Shared/Windows/Feedback.xaml @@ -1,8 +1,7 @@ - - + - + - + diff --git a/src/Certify.UI.Shared/Windows/GettingStartedGuide.xaml b/src/Certify.UI.Shared/Windows/GettingStartedGuide.xaml index 6a33c0cfb..8cb59671a 100644 --- a/src/Certify.UI.Shared/Windows/GettingStartedGuide.xaml +++ b/src/Certify.UI.Shared/Windows/GettingStartedGuide.xaml @@ -1,8 +1,7 @@ - - + diff --git a/src/Certify.UI.Shared/Windows/ImportExport.xaml b/src/Certify.UI.Shared/Windows/ImportExport.xaml index 922e0b9b4..11409e17d 100644 --- a/src/Certify.UI.Shared/Windows/ImportExport.xaml +++ b/src/Certify.UI.Shared/Windows/ImportExport.xaml @@ -1,18 +1,15 @@ - @@ -23,8 +20,7 @@ + HorizontalAlignment="Left" ToolTip="Password" /> @@ -34,14 +30,11 @@ Margin="0,8,0,0" HorizontalContentAlignment="Left" VerticalContentAlignment="Stretch" - Controls:TabControlHelper.UnderlineBrush="{DynamicResource MahApps.Brushes.Accent4}" - Controls:TabControlHelper.Underlined="TabPanel" DockPanel.Dock="Top" TabStripPlacement="Top"> @@ -59,7 +52,6 @@ Import a settings bundle exported from another instance of the app. @@ -97,7 +89,7 @@ - - + diff --git a/src/Certify.UI.Shared/Windows/MainWindow.xaml b/src/Certify.UI.Shared/Windows/MainWindow.xaml index 024e378d3..543dc4efe 100644 --- a/src/Certify.UI.Shared/Windows/MainWindow.xaml +++ b/src/Certify.UI.Shared/Windows/MainWindow.xaml @@ -1,8 +1,7 @@ - - + - + - - - - - + + + + + + - - - + + + + + - + diff --git a/src/Certify.UI.Shared/Windows/ServerConnections.xaml.cs b/src/Certify.UI.Shared/Windows/ServerConnections.xaml.cs index 284df9483..4e7488999 100644 --- a/src/Certify.UI.Shared/Windows/ServerConnections.xaml.cs +++ b/src/Certify.UI.Shared/Windows/ServerConnections.xaml.cs @@ -1,4 +1,4 @@ -using System.Threading; +using System.Threading; using System.Windows; using System.Windows.Controls; using Certify.Shared; @@ -42,7 +42,7 @@ private async void Connect_Click(object sender, RoutedEventArgs e) Close(); } - private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) + private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { // cancel pending operations (if any) _cts.Cancel(); diff --git a/src/Certify.UI.Shared/Windows/UpdateAvailable.xaml b/src/Certify.UI.Shared/Windows/UpdateAvailable.xaml index 8e29d649c..8e567eedc 100644 --- a/src/Certify.UI.Shared/Windows/UpdateAvailable.xaml +++ b/src/Certify.UI.Shared/Windows/UpdateAvailable.xaml @@ -1,8 +1,7 @@ - - + - + Download @@ -71,11 +66,11 @@ Later - +