From 2a223b6926a8da85d89d4818dab0cbee4734b7b9 Mon Sep 17 00:00:00 2001 From: Surfin Bird Date: Mon, 16 Mar 2020 20:13:59 +0300 Subject: [PATCH] update --- .../Presentation/AppAppearanceManager.cs | 23 +++++++++++-------- .../AcTools.NeuralTyres.Tests.csproj | 3 --- AcTools.NeuralTyres.Tests/Tests.cs | 11 --------- AcTools.Tests/DataWrapperTest.cs | 2 -- 4 files changed, 14 insertions(+), 25 deletions(-) diff --git a/AcManager.Controls/Presentation/AppAppearanceManager.cs b/AcManager.Controls/Presentation/AppAppearanceManager.cs index 7fec077b9..71ff17610 100644 --- a/AcManager.Controls/Presentation/AppAppearanceManager.cs +++ b/AcManager.Controls/Presentation/AppAppearanceManager.cs @@ -15,6 +15,7 @@ using AcManager.Tools.Helpers; using AcTools.Utils; using AcTools.Utils.Helpers; +using FirstFloor.ModernUI; using FirstFloor.ModernUI.Helpers; using FirstFloor.ModernUI.Presentation; using FirstFloor.ModernUI.Windows.Controls; @@ -174,7 +175,7 @@ private void InnerInitialize() { AccentDisplayColor = ValuesStorage.Get(KeyAccentDisplayColor); BackgroundFilename = ValuesStorage.Get(KeyBackgroundImage); BackgroundOpacity = ValuesStorage.Get(KeyBackgroundOpacity, 0.2); - BackgroundBlur = ValuesStorage.Get(KeyBackgroundBlur, 0); + BackgroundBlur = ValuesStorage.Get(KeyBackgroundBlur, 0d); BackgroundStretch = ValuesStorage.Get(KeyBackgroundStretch, Stretch.UniformToFill); SlideshowChangeRate = ValuesStorage.Get(KeySlideshowChangeRate, SlideshowChangeRates.ElementAt(3).Value); IdealFormattingMode = ValuesStorage.Get(KeyIdealFormattingMode); @@ -189,7 +190,7 @@ private void InnerInitialize() { PopupToolBars = ValuesStorage.Get(KeyPopupToolBars); FrameAnimation = FrameAnimations.GetByIdOrDefault(ValuesStorage.Get(KeyFrameAnimation)) ?? FrameAnimations.First(); - UpdateBackgroundImageBrush(false).Forget(); + UpdateBackgroundImageBrush(false); } finally { _loading = false; } @@ -218,13 +219,13 @@ private async Task StartSlideshowTimer() { if (_slideshowWaitCancellation == c) { _slideshowWaitCancellation = null; if (SlideshowMode) { - UpdateBackgroundImageBrush(false).Ignore(); + UpdateBackgroundImageBrush(false); } } } } - private async Task UpdateBackgroundImageBrush(bool keepSlideshow) { + private async Task UpdateBackgroundImageBrushUI(bool keepSlideshow) { BetterImage.Image image; if (_backgroundFilename == null) { image = BetterImage.Image.Empty; @@ -268,7 +269,7 @@ private async Task UpdateBackgroundImageBrush(bool keepSlideshow) { brush = imageBrush; } else { brush = new VisualBrush { - Visual = new Border() { + Visual = new Border { Child = new BetterImage { ImageSource = image.ImageSource, Stretch = _backgroundStretch, @@ -288,6 +289,10 @@ private async Task UpdateBackgroundImageBrush(bool keepSlideshow) { Application.Current.Resources["WindowBackgroundContentBrush"] = brush; } + private void UpdateBackgroundImageBrush(bool keepSlideshow) { + ActionExtension.InvokeInMainThreadAsync(() => UpdateBackgroundImageBrushUI(keepSlideshow).Ignore()); + } + private string _backgroundFilename; [CanBeNull] @@ -304,7 +309,7 @@ public string BackgroundFilename { OnPropertyChanged(); OnPropertyChanged(nameof(SlideshowMode)); ValuesStorage.Set(KeyBackgroundImage, value); - UpdateBackgroundImageBrush(false).Forget(); + UpdateBackgroundImageBrush(false); } } @@ -324,7 +329,7 @@ public double BackgroundBlur { _backgroundBlur = value; OnPropertyChanged(); ValuesStorage.Set(KeyBackgroundBlur, value); - UpdateBackgroundImageBrush(true).Forget(); + UpdateBackgroundImageBrush(true); } } @@ -342,7 +347,7 @@ public double BackgroundOpacity { _backgroundOpacity = value; OnPropertyChanged(); ValuesStorage.Set(KeyBackgroundOpacity, value); - UpdateBackgroundImageBrush(true).Forget(); + UpdateBackgroundImageBrush(true); } } @@ -408,7 +413,7 @@ public Stretch BackgroundStretch { ValuesStorage.Set(KeyBackgroundStretch, value); OnPropertyChanged(); OnPropertyChanged(nameof(BackgroundStretchMode)); - UpdateBackgroundImageBrush(true).Forget(); + UpdateBackgroundImageBrush(true); } } #endregion diff --git a/AcTools.NeuralTyres.Tests/AcTools.NeuralTyres.Tests.csproj b/AcTools.NeuralTyres.Tests/AcTools.NeuralTyres.Tests.csproj index 2a982fc32..cf6dd3abb 100644 --- a/AcTools.NeuralTyres.Tests/AcTools.NeuralTyres.Tests.csproj +++ b/AcTools.NeuralTyres.Tests/AcTools.NeuralTyres.Tests.csproj @@ -48,9 +48,6 @@ x64 - - ..\Libraries\AcTools.AcdEncryption\AcTools.AcdEncryption.dll - diff --git a/AcTools.NeuralTyres.Tests/Tests.cs b/AcTools.NeuralTyres.Tests/Tests.cs index 5eaa9c5f5..4a591fc9b 100644 --- a/AcTools.NeuralTyres.Tests/Tests.cs +++ b/AcTools.NeuralTyres.Tests/Tests.cs @@ -4,25 +4,16 @@ using System.IO; using System.Linq; using System.Windows.Forms.DataVisualization.Charting; -using AcTools.AcdEncryption; -using AcTools.AcdFile; using AcTools.DataFile; using AcTools.NeuralTyres.Data; using AcTools.Utils; using AcTools.Utils.Helpers; -using NUnit.Framework; // ReSharper disable RedundantAssignment // ReSharper disable ConditionIsAlwaysTrueOrFalse namespace AcTools.NeuralTyres.Tests { - // [TestFixture] public class Tests { - // [SetUp] - public void SetUp() { - Acd.Factory = new AcdFactory(); - } - private void BuildChart(params Action[] series) { using (var ch = new Chart()) { ch.ChartAreas.Add(new ChartArea()); @@ -38,7 +29,6 @@ private void BuildChart(params Action[] series) { } } - // [Test] public void Main() { var carsFromWebApp = new[] { /*"lotus_exige_s", "lotus_exige_s", "lotus_evora_gte", "lotus_elise_sc", "alfa_mito_qv", @@ -100,7 +90,6 @@ public void Main() { Console.WriteLine(neural.Conjure(width.Denormalize(0.5), radius.Denormalize(0.5), profile.Denormalize(0.5))[testKey]); } - // [Test] public void MainSingleNet() { var carsFromWebApp = new[] { "lotus_exige_s", "lotus_exige_s", "lotus_evora_gte", "lotus_elise_sc", "alfa_mito_qv", diff --git a/AcTools.Tests/DataWrapperTest.cs b/AcTools.Tests/DataWrapperTest.cs index d931780db..5e9c8c9f1 100644 --- a/AcTools.Tests/DataWrapperTest.cs +++ b/AcTools.Tests/DataWrapperTest.cs @@ -1,7 +1,5 @@ using System.IO; -using System.Linq; using System.Runtime.CompilerServices; -using System.Text; using AcTools.AcdEncryption; using AcTools.AcdFile; using AcTools.DataFile;