diff --git a/Images/Plus Minus.psd b/Images/Plus Minus.psd new file mode 100644 index 00000000..ae3fff21 Binary files /dev/null and b/Images/Plus Minus.psd differ diff --git a/Source/LibationWinForms/Resources/Stoplight1 with pdf.psd b/Images/Stoplight with pdf.psd similarity index 100% rename from Source/LibationWinForms/Resources/Stoplight1 with pdf.psd rename to Images/Stoplight with pdf.psd diff --git a/Source/LibationWinForms/Resources/Stoplight1.psd b/Images/Stoplight.psd similarity index 100% rename from Source/LibationWinForms/Resources/Stoplight1.psd rename to Images/Stoplight.psd diff --git a/Source/LibationAvalonia/App.axaml b/Source/LibationAvalonia/App.axaml index e76d03e1..da3b6fad 100644 --- a/Source/LibationAvalonia/App.axaml +++ b/Source/LibationAvalonia/App.axaml @@ -2,15 +2,71 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:LibationAvalonia" x:Class="LibationAvalonia.App"> - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + \ No newline at end of file diff --git a/Source/LibationAvalonia/App.axaml.cs b/Source/LibationAvalonia/App.axaml.cs index b1d0fed2..13fa7356 100644 --- a/Source/LibationAvalonia/App.axaml.cs +++ b/Source/LibationAvalonia/App.axaml.cs @@ -12,6 +12,7 @@ using System.Collections.Generic; using System.IO; using ApplicationServices; using Avalonia.Controls; +using Avalonia.Styling; namespace LibationAvalonia { @@ -23,6 +24,7 @@ namespace LibationAvalonia public static IBrush ProcessQueueBookCancelledBrush { get; private set; } public static IBrush ProcessQueueBookDefaultBrush { get; private set; } public static IBrush SeriesEntryGridBackgroundBrush { get; private set; } + public static IBrush HyperlinkVisited { get; private set; } public static IAssetLoader AssetLoader { get; private set; } @@ -58,7 +60,7 @@ namespace LibationAvalonia if (config.LibationSettingsAreValid) { - LibraryTask = Task.Run(() => DbContexts.GetLibrary_Flat_NoTracking(includeParents: true)); + LibraryTask = Task.Run(() => DbContexts.GetLibrary_Flat_NoTracking(includeParents: true)); ShowMainWindow(desktop); } else @@ -214,6 +216,10 @@ namespace LibationAvalonia private static void ShowMainWindow(IClassicDesktopStyleApplicationLifetime desktop) { + Current.RequestedThemeVariant = Configuration.Instance.GetString(propertyName: nameof(ThemeVariant)) is "Dark" ? ThemeVariant.Dark : ThemeVariant.Light; + + //Reload colors for current theme + LoadStyles(); var mainWindow = new MainWindow(); desktop.MainWindow = MainWindow = mainWindow; mainWindow.RestoreSizeAndLocation(Configuration.Instance); @@ -227,8 +233,9 @@ namespace LibationAvalonia ProcessQueueBookFailedBrush = AvaloniaUtils.GetBrushFromResources("ProcessQueueBookFailedBrush"); ProcessQueueBookCompletedBrush = AvaloniaUtils.GetBrushFromResources("ProcessQueueBookCompletedBrush"); ProcessQueueBookCancelledBrush = AvaloniaUtils.GetBrushFromResources("ProcessQueueBookCancelledBrush"); - ProcessQueueBookDefaultBrush = AvaloniaUtils.GetBrushFromResources("ProcessQueueBookDefaultBrush"); SeriesEntryGridBackgroundBrush = AvaloniaUtils.GetBrushFromResources("SeriesEntryGridBackgroundBrush"); + ProcessQueueBookDefaultBrush = AvaloniaUtils.GetBrushFromResources("ProcessQueueBookDefaultBrush"); + HyperlinkVisited = AvaloniaUtils.GetBrushFromResources(nameof(HyperlinkVisited)); } } } diff --git a/Source/LibationAvalonia/Assets/Arrows_left.png b/Source/LibationAvalonia/Assets/Arrows_left.png deleted file mode 100644 index a1a73311..00000000 Binary files a/Source/LibationAvalonia/Assets/Arrows_left.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/Arrows_right.png b/Source/LibationAvalonia/Assets/Arrows_right.png deleted file mode 100644 index 126dfa40..00000000 Binary files a/Source/LibationAvalonia/Assets/Arrows_right.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/DataGridFluentTheme.xaml b/Source/LibationAvalonia/Assets/DataGridFluentTheme.xaml new file mode 100644 index 00000000..82ef3f10 --- /dev/null +++ b/Source/LibationAvalonia/Assets/DataGridFluentTheme.xaml @@ -0,0 +1,588 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.6 + 0.8 + + M1875 1011l-787 787v-1798h-128v1798l-787 -787l-90 90l941 941l941 -941z + M1965 947l-941 -941l-941 941l90 90l787 -787v1798h128v-1798l787 787z + M515 93l930 931l-930 931l90 90l1022 -1021l-1022 -1021z + M109 486 19 576 1024 1581 2029 576 1939 486 1024 1401z + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/LibationAvalonia/Assets/LibationStyles.xaml b/Source/LibationAvalonia/Assets/LibationStyles.xaml deleted file mode 100644 index e3569ba2..00000000 --- a/Source/LibationAvalonia/Assets/LibationStyles.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - #cdffcd - - - - - - - - - - - - \ No newline at end of file diff --git a/Source/LibationAvalonia/Assets/LibationVectorIcons.xaml b/Source/LibationAvalonia/Assets/LibationVectorIcons.xaml new file mode 100644 index 00000000..d2e2d278 --- /dev/null +++ b/Source/LibationAvalonia/Assets/LibationVectorIcons.xaml @@ -0,0 +1,69 @@ + + + + M30,0 H60 L30,50 L60,100 H30 L0,50 M85,0 H115 L85,50 L115,100 H85 L55,50 M140,0 H170 L140,50 L170,100 H140 L110,50 + M0,0 H100 V12 H53 L100,46 H0 L47,12 H0 + M0,36.66 L50,0 L100,36.66 + M0,0 L100,0 L50,36.66 + M0,0 H100 L53,34 H100 V46 H0 V34 H47 + M30,0 H50 V30 H80 V50 H50 V80 H30 V50 H0 V30 H30 + M31,0 H49 V100 H31 M58,0 H76 V100 H58 M85,0 H103 V100 H85 M8,85 V122 H129 V85 H117 V109 H20 V85 H8 M0,36 V66 L24,51 M114,36 V66 L138,51 + M0,0 H100 V100 H0 V0 M2,50 L36,82 L 93,27 L81,15 L36,59 L14,38 + M0,0 H100 V100 H0 V0 M15,71 L29,85 L50,64 L71,85 L85,71 L64,50 L85,29 L71,15 L50,36 L29,15 L15,29 L36,50 + M32,0 a 32,32 0 0 1 0,64 a 32,32 0 0 1 0,-64 m 0,4 a 28,28 0 0 1 0,56 a 28,28 0 0 1 0,-56 m-21,24 h42 a 1,1 0 0 1 1,1 v6 a 1,1 0 0 1 -1,1 h-42 a 1,1 0 0 1 -1,-1 v-6 a 1,1 0 0 1 1,-1 + + + + + M39,35 L50,24 H11 + A 11,11 0 0 0 0,35 V89 A 11,11 0 0 0 11,100 H64 A 11,11 0 0 0 75,89 V52 L64,63 V89 H11 V35 + M 51,65 H36 V50 + M 90.5,26.5 L55,62 L 39,45 L74,10 + M 78,6 L81.5,2.5 A 8,8 0 0 1 91.5,2 L98.5,9 A 8,8 0 0 1 97.5,19.5 L94,23 + + + + M0,2 A 2,2 0 0 1 2,0 H62 A2,2 0 0 1 64,2 V62 A 2,2 0 0 1 62,64 H 2 A 2,2 0 0 1 0,62 V2 + M 2,2 H62 V62 H2 V2 + M11,28 h42 a 1,1 0 0 1 1,1 v6 a 1,1 0 0 1 -1,1 h-42 a 1,1 0 0 1 -1,-1 v-6 a 1,1 0 0 1 1,-1 + + M28,53 v-42 a 1,1 0 0 1 1,-1 h6 a 1,1 0 0 1 1,1 v42 a 1,1 0 0 1 -1,1 h-6 a 1,1 0 0 1 -1,-1 + + + + + + M0,12 A 12,12 0 0 1 12,0 H34 A 12,12 0 0 1 46,12 V88 A 12,12 0 0 1 34,100 H12 A 12,12 0 0 1 0,88 V12 + M20,8 H26 A 12,12 0 0 1 26,32 H20 A 12,12 0 0 1 20,8 + M20,38 H26 A 12,12 0 0 1 26,62 H20 A 12,12 0 0 1 20,38 + M20,68 H26 A 12,12 0 0 1 26,92 H20 A 12,12 0 0 1 20,68 + + + + M4,38.5 H3 A 3,3 0 0 1 0,35.5 V21.4 A 3,3 0 0 1 3,18.4 H4 V2 A 2,2 0 0 1 6,0 H30.5 L41,12 V18.4 A 3,3 0 0 1 45,21.4 V35.5 A 3,3 0 0 1 42,38.5 H41 V48.5 A 2,2 0 0 1 39,50.5 H6 A 2,2 0 0 1 4,48.5 + M6,38.5 H39 V48.5 H6 V38.5 + M6,18.4 V2 H29 V12 A 1,1 0 0 0 30,13 H39 V18.4 + M 4.3179,36 c 0,0 0.122,-14.969 0.122,-14.969 1.469,-0.194 2.939,-0.388 4.5,-0.362 1.561,0.026 3.214,0.27 4.357,0.944 1.143,0.674 1.775,1.776 2.015,2.959 0.24,1.184 0.087,2.449 -0.5,3.52 -0.587,1.071 -1.607,1.949 -2.816,2.352 -1.209,0.403 -2.607,0.332 -4.005,0.26 0,0 -0.031,5.265 -0.031,5.265 0,0 -3.673,0.122 -3.673,0.122 0,0 0.031,-0.092 0.031,-0.092 + m 3.643,-12.428 c 0,0 0.031,4.286 0.031,4.286 0.735,0.051 1.47,0.102 2.107,-0.056 0.638,-0.158 1.178,-0.526 1.459,-1.122 0.281,-0.597 0.301,-1.423 0.01,-2.005 -0.291,-0.582 -0.893,-0.918 -1.546,-1.061 -0.653,-0.143 -1.357,-0.092 -1.709,-0.066 -0.352,0.026 -0.352,0.026 -0.352,0.026 + m 9.428,12.428 c 2.265,0.245 4.531,0.49 6.674,0.066 2.143,-0.424 4.163,-1.515 5.285,-3.081 1.122,-1.566 1.347,-3.607 1.27,-5.306 -0.076,-1.699 -0.454,-3.056 -1.454,-4.219 -1,-1.163 -2.622,-2.133 -4.704,-2.505 -2.082,-0.373 -4.623,-0.148 -7.164,0.076 0,0 0.092,14.969 0.092,14.969 + m 3.49,-12.398 c 0,0 0,9.673 0,9.673 0.888,0.02 1.776,0.041 2.653,-0.179 0.877,-0.219 1.745,-0.679 2.367,-1.541 0.622,-0.862 1,-2.127 0.98,-3.403 -0.02,-1.275 -0.439,-2.561 -1.193,-3.337 -0.755,-0.776 -1.847,-1.041 -2.704,-1.158 -0.857,-0.117 -1.48,-0.087 -2.102,-0.056 + m 11.908,12.245 v-14.785 h8.969 v2.51 h-5.786 v3.612 h5.388 v2.51 h-5.449 v6.092 + + + + M29,44 V58.7498 H35.0491 A 1.5,1.5 0 0 1 36.1342,61.2861 L23.5607,73.8595 A 1.5,1.5 0 0 1 21.4393,73.8595 L8.8658,61.2861 A 1.5,1.5 0 0 1 9.9509,58.7498 H16 V44 A 1.5,1.5 0 0 1 17.5,42.5 H27.5 A 1.5,1.5 0 0 1 29,44 + + + + + + M5.65,4.3 h-2.75 a2.9,2.25 0 0 0 -2.9,2.25 v7.2 + a2.9,2.25 0 0 0 2.9,2.25 h10.2 a2.9,2.25 0 0 0 2.9,-2.25 v-7.2 a2.9,2.25 0 0 0 -2.9,-2.25 + h-2.75 v1.6 h2.75 a1.3,0.65 0 0 1 1.3,0.65 v7.2 a1.3,0.65 0 0 1 -1.3,0.65 h-10.2 a1.3,0.65 0 0 1 -1.3,-0.65 v-7.2 a1.3,0.65 0 0 1 1.3,-0.65 h2.75 v-1.6 + M7.2,0.8 a 0.8,0.8 0 0 1 1.6,0 v8 l0.9929,-0.9929 a 0.8,0.8 0 0 1 1.1314,1.1314 l-2.3586,2.3586 + a 0.8,0.8 0 0 1 -1.1314,0 l-2.3586,-2.3586 a 0.8,0.8 0 0 1 1.1314,-1.1314 l0.9929,0.9929 v8 + + + + diff --git a/Source/LibationAvalonia/Assets/cancel.png b/Source/LibationAvalonia/Assets/cancel.png deleted file mode 100644 index fa34f935..00000000 Binary files a/Source/LibationAvalonia/Assets/cancel.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/completed.png b/Source/LibationAvalonia/Assets/completed.png deleted file mode 100644 index 3cd61981..00000000 Binary files a/Source/LibationAvalonia/Assets/completed.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/down.png b/Source/LibationAvalonia/Assets/down.png deleted file mode 100644 index 2536c961..00000000 Binary files a/Source/LibationAvalonia/Assets/down.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/download-arrow.png b/Source/LibationAvalonia/Assets/download-arrow.png deleted file mode 100644 index 16617998..00000000 Binary files a/Source/LibationAvalonia/Assets/download-arrow.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/edit-tags-25x25.png b/Source/LibationAvalonia/Assets/edit-tags-25x25.png deleted file mode 100644 index 82b24209..00000000 Binary files a/Source/LibationAvalonia/Assets/edit-tags-25x25.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/edit-tags-50x50.png b/Source/LibationAvalonia/Assets/edit-tags-50x50.png deleted file mode 100644 index 7b0043ac..00000000 Binary files a/Source/LibationAvalonia/Assets/edit-tags-50x50.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/edit_25x25.png b/Source/LibationAvalonia/Assets/edit_25x25.png deleted file mode 100644 index 12e70d0f..00000000 Binary files a/Source/LibationAvalonia/Assets/edit_25x25.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/edit_64x64.png b/Source/LibationAvalonia/Assets/edit_64x64.png deleted file mode 100644 index 1d9e5f83..00000000 Binary files a/Source/LibationAvalonia/Assets/edit_64x64.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/error.png b/Source/LibationAvalonia/Assets/error.png deleted file mode 100644 index 700ce41e..00000000 Binary files a/Source/LibationAvalonia/Assets/error.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/errored.png b/Source/LibationAvalonia/Assets/errored.png deleted file mode 100644 index bb8ba7ef..00000000 Binary files a/Source/LibationAvalonia/Assets/errored.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/first.png b/Source/LibationAvalonia/Assets/first.png deleted file mode 100644 index e470c697..00000000 Binary files a/Source/LibationAvalonia/Assets/first.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/glass-with-glow_16.png b/Source/LibationAvalonia/Assets/glass-with-glow_16.png deleted file mode 100644 index 05e40bec..00000000 Binary files a/Source/LibationAvalonia/Assets/glass-with-glow_16.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/import_16x16.png b/Source/LibationAvalonia/Assets/import_16x16.png deleted file mode 100644 index 40b582b1..00000000 Binary files a/Source/LibationAvalonia/Assets/import_16x16.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/last.png b/Source/LibationAvalonia/Assets/last.png deleted file mode 100644 index 3c3ea886..00000000 Binary files a/Source/LibationAvalonia/Assets/last.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/liberate_green.png b/Source/LibationAvalonia/Assets/liberate_green.png deleted file mode 100644 index 86171e0c..00000000 Binary files a/Source/LibationAvalonia/Assets/liberate_green.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/liberate_green_pdf_no.png b/Source/LibationAvalonia/Assets/liberate_green_pdf_no.png deleted file mode 100644 index a128c088..00000000 Binary files a/Source/LibationAvalonia/Assets/liberate_green_pdf_no.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/liberate_green_pdf_yes.png b/Source/LibationAvalonia/Assets/liberate_green_pdf_yes.png deleted file mode 100644 index baac0151..00000000 Binary files a/Source/LibationAvalonia/Assets/liberate_green_pdf_yes.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/liberate_red.png b/Source/LibationAvalonia/Assets/liberate_red.png deleted file mode 100644 index 8e4b34e4..00000000 Binary files a/Source/LibationAvalonia/Assets/liberate_red.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/liberate_red_pdf_no.png b/Source/LibationAvalonia/Assets/liberate_red_pdf_no.png deleted file mode 100644 index 6506603c..00000000 Binary files a/Source/LibationAvalonia/Assets/liberate_red_pdf_no.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/liberate_red_pdf_yes.png b/Source/LibationAvalonia/Assets/liberate_red_pdf_yes.png deleted file mode 100644 index 0d5b5eb6..00000000 Binary files a/Source/LibationAvalonia/Assets/liberate_red_pdf_yes.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/liberate_yellow.png b/Source/LibationAvalonia/Assets/liberate_yellow.png deleted file mode 100644 index 8b3e8aab..00000000 Binary files a/Source/LibationAvalonia/Assets/liberate_yellow.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/liberate_yellow_pdf_no.png b/Source/LibationAvalonia/Assets/liberate_yellow_pdf_no.png deleted file mode 100644 index 2bddcffd..00000000 Binary files a/Source/LibationAvalonia/Assets/liberate_yellow_pdf_no.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/liberate_yellow_pdf_yes.png b/Source/LibationAvalonia/Assets/liberate_yellow_pdf_yes.png deleted file mode 100644 index b51a28ad..00000000 Binary files a/Source/LibationAvalonia/Assets/liberate_yellow_pdf_yes.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/minus.png b/Source/LibationAvalonia/Assets/minus.png deleted file mode 100644 index c0c5d15c..00000000 Binary files a/Source/LibationAvalonia/Assets/minus.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/plus.png b/Source/LibationAvalonia/Assets/plus.png deleted file mode 100644 index 1cd1c630..00000000 Binary files a/Source/LibationAvalonia/Assets/plus.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/queued.png b/Source/LibationAvalonia/Assets/queued.png deleted file mode 100644 index f30221c3..00000000 Binary files a/Source/LibationAvalonia/Assets/queued.png and /dev/null differ diff --git a/Source/LibationAvalonia/Assets/up.png b/Source/LibationAvalonia/Assets/up.png deleted file mode 100644 index 7c00155a..00000000 Binary files a/Source/LibationAvalonia/Assets/up.png and /dev/null differ diff --git a/Source/LibationAvalonia/AvaloniaUtils.cs b/Source/LibationAvalonia/AvaloniaUtils.cs index 842777cf..f92e1c4d 100644 --- a/Source/LibationAvalonia/AvaloniaUtils.cs +++ b/Source/LibationAvalonia/AvaloniaUtils.cs @@ -13,9 +13,8 @@ namespace LibationAvalonia public static IBrush GetBrushFromResources(string name) => GetBrushFromResources(name, Brushes.Transparent); public static IBrush GetBrushFromResources(string name, IBrush defaultBrush) - { - //TODO: use ThemeVariant - if (App.Current.Styles.TryGetResource(name, null, out var value) && value is IBrush brush) + { + if (App.Current.TryGetResource(name, App.Current.ActualThemeVariant, out var value) && value is IBrush brush) return brush; return defaultBrush; } diff --git a/Source/LibationAvalonia/Controls/GroupBox.axaml b/Source/LibationAvalonia/Controls/GroupBox.axaml index f8c2b755..91246b19 100644 --- a/Source/LibationAvalonia/Controls/GroupBox.axaml +++ b/Source/LibationAvalonia/Controls/GroupBox.axaml @@ -27,7 +27,7 @@ VerticalAlignment="Top"> diff --git a/Source/LibationAvalonia/Controls/LinkLabel.axaml b/Source/LibationAvalonia/Controls/LinkLabel.axaml index e1043dfc..f15725b0 100644 --- a/Source/LibationAvalonia/Controls/LinkLabel.axaml +++ b/Source/LibationAvalonia/Controls/LinkLabel.axaml @@ -6,7 +6,7 @@ x:Class="LibationAvalonia.Controls.LinkLabel"> diff --git a/Source/LibationAvalonia/Controls/LinkLabel.axaml.cs b/Source/LibationAvalonia/Controls/LinkLabel.axaml.cs index ac31ff40..4d7ee7ac 100644 --- a/Source/LibationAvalonia/Controls/LinkLabel.axaml.cs +++ b/Source/LibationAvalonia/Controls/LinkLabel.axaml.cs @@ -20,7 +20,7 @@ namespace LibationAvalonia.Controls private void LinkLabel_Tapped(object sender, TappedEventArgs e) { - Foreground = Brushes.Purple; + Foreground = App.HyperlinkVisited; } protected override void OnPointerEntered(PointerEventArgs e) diff --git a/Source/LibationAvalonia/Dialogs/AccountsDialog.axaml b/Source/LibationAvalonia/Dialogs/AccountsDialog.axaml index c49b9dbb..07647a43 100644 --- a/Source/LibationAvalonia/Dialogs/AccountsDialog.axaml +++ b/Source/LibationAvalonia/Dialogs/AccountsDialog.axaml @@ -33,9 +33,9 @@ + + diff --git a/Source/LibationAvalonia/Views/LiberateStatusButton.axaml.cs b/Source/LibationAvalonia/Views/LiberateStatusButton.axaml.cs new file mode 100644 index 00000000..edb1b24a --- /dev/null +++ b/Source/LibationAvalonia/Views/LiberateStatusButton.axaml.cs @@ -0,0 +1,80 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Interactivity; +using DataLayer; +using LibationAvalonia.ViewModels; +using System; + +namespace LibationAvalonia.Views +{ + public partial class LiberateStatusButton : UserControl + { + public event EventHandler Click; + + public static readonly StyledProperty BookStatusProperty = + AvaloniaProperty.Register(nameof(BookStatus)); + + public static readonly StyledProperty PdfStatusProperty = + AvaloniaProperty.Register(nameof(PdfStatus)); + + public static readonly StyledProperty IsUnavailableProperty = + AvaloniaProperty.Register(nameof(IsUnavailable)); + + public static readonly StyledProperty ExpandedProperty = + AvaloniaProperty.Register(nameof(Expanded)); + + public static readonly StyledProperty IsSeriesProperty = + AvaloniaProperty.Register(nameof(IsSeries)); + + public LiberatedStatus BookStatus { get => GetValue(BookStatusProperty); set => SetValue(BookStatusProperty, value); } + public LiberatedStatus? PdfStatus { get => GetValue(PdfStatusProperty); set => SetValue(PdfStatusProperty, value); } + public bool IsUnavailable { get => GetValue(IsUnavailableProperty); set => SetValue(IsUnavailableProperty, value); } + public bool Expanded { get => GetValue(ExpandedProperty); set => SetValue(ExpandedProperty, value); } + public bool IsSeries { get => GetValue(IsSeriesProperty); set => SetValue(IsSeriesProperty, value); } + + private readonly LiberateStatusButtonViewModel viewModel = new(); + + public LiberateStatusButton() + { + InitializeComponent(); + button.DataContext = viewModel; + + if (Design.IsDesignMode) + { + BookStatus = LiberatedStatus.PartialDownload; + PdfStatus = null; + IsSeries = true; + } + } + + private void Button_Click(object sender, RoutedEventArgs e) => Click?.Invoke(this, EventArgs.Empty); + + protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) + { + if (change.Property == BookStatusProperty) + { + viewModel.IsError = BookStatus is LiberatedStatus.Error; + viewModel.RedVisible = BookStatus is LiberatedStatus.NotLiberated; + viewModel.YellowVisible = BookStatus is LiberatedStatus.PartialDownload; + viewModel.GreenVisible = BookStatus is LiberatedStatus.Liberated; + } + else if (change.Property == PdfStatusProperty) + { + viewModel.PdfDownloadedVisible = PdfStatus is LiberatedStatus.Liberated; + viewModel.PdfNotDownloadedVisible = PdfStatus is LiberatedStatus.NotLiberated; + } + else if (change.Property == IsSeriesProperty) + { + viewModel.IsSeries = IsSeries; + } + else if (change.Property == ExpandedProperty) + { + viewModel.Expanded = Expanded; + } + + viewModel.IsButtonEnabled = !viewModel.IsError && (!IsUnavailable || (BookStatus is LiberatedStatus.Liberated && PdfStatus is null or LiberatedStatus.Liberated)); + + base.OnPropertyChanged(change); + } + } +} diff --git a/Source/LibationAvalonia/Views/MainWindow.axaml b/Source/LibationAvalonia/Views/MainWindow.axaml index d2feee33..d4485a6a 100644 --- a/Source/LibationAvalonia/Views/MainWindow.axaml +++ b/Source/LibationAvalonia/Views/MainWindow.axaml @@ -138,7 +138,7 @@ - + @@ -172,12 +172,13 @@ - @@ -198,8 +199,8 @@ LiberateSeriesClicked="ProductsDisplay_LiberateSeriesClicked" ConvertToMp3Clicked="ProductsDisplay_ConvertToMp3Clicked" /> - - + + diff --git a/Source/LibationAvalonia/Views/MainWindow.axaml.cs b/Source/LibationAvalonia/Views/MainWindow.axaml.cs index 6344c083..6a436916 100644 --- a/Source/LibationAvalonia/Views/MainWindow.axaml.cs +++ b/Source/LibationAvalonia/Views/MainWindow.axaml.cs @@ -2,9 +2,6 @@ using System; using System.Collections.Generic; using System.Linq; using ApplicationServices; -using Avalonia; -using Avalonia.Controls; -using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; using DataLayer; using LibationAvalonia.ViewModels; diff --git a/Source/LibationAvalonia/Views/ProcessBookControl.axaml b/Source/LibationAvalonia/Views/ProcessBookControl.axaml index e9bf30ac..0c2cb800 100644 --- a/Source/LibationAvalonia/Views/ProcessBookControl.axaml +++ b/Source/LibationAvalonia/Views/ProcessBookControl.axaml @@ -2,16 +2,16 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="90" MaxHeight="90" MinHeight="90" MinWidth="300" + mc:Ignorable="d" d:DesignWidth="400" d:DesignHeight="87" MaxHeight="87" MinHeight="87" MinWidth="300" x:Class="LibationAvalonia.Views.ProcessBookControl" Background="{Binding BackgroundColor}"> - + - + - + @@ -28,23 +28,35 @@ + + + + - - - - - - diff --git a/Source/LibationAvalonia/Views/ProcessQueueControl.axaml b/Source/LibationAvalonia/Views/ProcessQueueControl.axaml index 79962d8f..87b50442 100644 --- a/Source/LibationAvalonia/Views/ProcessQueueControl.axaml +++ b/Source/LibationAvalonia/Views/ProcessQueueControl.axaml @@ -38,7 +38,7 @@ Process Queue - + Queue Log - + @@ -99,7 +99,7 @@ - + @@ -108,6 +108,7 @@ + + + + + + + - - - + + + - - - + + + diff --git a/Source/LibationAvalonia/Views/ProductsDisplay.axaml b/Source/LibationAvalonia/Views/ProductsDisplay.axaml index a81c7cfd..38a6b59d 100644 --- a/Source/LibationAvalonia/Views/ProductsDisplay.axaml +++ b/Source/LibationAvalonia/Views/ProductsDisplay.axaml @@ -32,6 +32,11 @@ + @@ -58,13 +63,14 @@ - - - - - + @@ -202,7 +208,9 @@ diff --git a/Source/LibationAvalonia/Views/ProductsDisplay.axaml.cs b/Source/LibationAvalonia/Views/ProductsDisplay.axaml.cs index eed0e4d9..8f29b4ca 100644 --- a/Source/LibationAvalonia/Views/ProductsDisplay.axaml.cs +++ b/Source/LibationAvalonia/Views/ProductsDisplay.axaml.cs @@ -354,9 +354,9 @@ namespace LibationAvalonia.Views #region Button Click Handlers - public async void LiberateButton_Click(object sender, Avalonia.Interactivity.RoutedEventArgs args) + public async void LiberateButton_Click(object sender, EventArgs e) { - var button = args.Source as Button; + var button = sender as LiberateStatusButton; if (button.DataContext is ISeriesEntry sEntry) { @@ -364,8 +364,7 @@ namespace LibationAvalonia.Views //Expanding and collapsing reset the list, which will cause focus to shift //to the topright cell. Reset focus onto the clicked button's cell. - var parentControl = (sender as Button).Parent as Control; - parentControl?.Focus(); + button.Focus(); } else if (button.DataContext is ILibraryBookEntry lbEntry) { diff --git a/Source/LibationAvalonia/libation.ico b/Source/LibationAvalonia/libation.ico deleted file mode 100644 index d3e00443..00000000 Binary files a/Source/LibationAvalonia/libation.ico and /dev/null differ diff --git a/Source/LibationWinForms/Resources/minus.png b/Source/LibationWinForms/Resources/minus.png index c0c5d15c..8aee13b4 100644 Binary files a/Source/LibationWinForms/Resources/minus.png and b/Source/LibationWinForms/Resources/minus.png differ diff --git a/Source/LibationWinForms/Resources/plus.png b/Source/LibationWinForms/Resources/plus.png index 1cd1c630..41b056db 100644 Binary files a/Source/LibationWinForms/Resources/plus.png and b/Source/LibationWinForms/Resources/plus.png differ