Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
gro-ove committed Mar 16, 2020
1 parent 2a812e8 commit 2a223b6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 25 deletions.
23 changes: 14 additions & 9 deletions AcManager.Controls/Presentation/AppAppearanceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -174,7 +175,7 @@ private void InnerInitialize() {
AccentDisplayColor = ValuesStorage.Get<string>(KeyAccentDisplayColor);
BackgroundFilename = ValuesStorage.Get<string>(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<bool?>(KeyIdealFormattingMode);
Expand All @@ -189,7 +190,7 @@ private void InnerInitialize() {
PopupToolBars = ValuesStorage.Get<bool>(KeyPopupToolBars);
FrameAnimation = FrameAnimations.GetByIdOrDefault(ValuesStorage.Get<string>(KeyFrameAnimation)) ?? FrameAnimations.First();

UpdateBackgroundImageBrush(false).Forget();
UpdateBackgroundImageBrush(false);
} finally {
_loading = false;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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]
Expand All @@ -304,7 +309,7 @@ public string BackgroundFilename {
OnPropertyChanged();
OnPropertyChanged(nameof(SlideshowMode));
ValuesStorage.Set(KeyBackgroundImage, value);
UpdateBackgroundImageBrush(false).Forget();
UpdateBackgroundImageBrush(false);
}
}

Expand All @@ -324,7 +329,7 @@ public double BackgroundBlur {
_backgroundBlur = value;
OnPropertyChanged();
ValuesStorage.Set(KeyBackgroundBlur, value);
UpdateBackgroundImageBrush(true).Forget();
UpdateBackgroundImageBrush(true);
}
}

Expand All @@ -342,7 +347,7 @@ public double BackgroundOpacity {
_backgroundOpacity = value;
OnPropertyChanged();
ValuesStorage.Set(KeyBackgroundOpacity, value);
UpdateBackgroundImageBrush(true).Forget();
UpdateBackgroundImageBrush(true);
}
}

Expand Down Expand Up @@ -408,7 +413,7 @@ public Stretch BackgroundStretch {
ValuesStorage.Set(KeyBackgroundStretch, value);
OnPropertyChanged();
OnPropertyChanged(nameof(BackgroundStretchMode));
UpdateBackgroundImageBrush(true).Forget();
UpdateBackgroundImageBrush(true);
}
}
#endregion
Expand Down
3 changes: 0 additions & 3 deletions AcTools.NeuralTyres.Tests/AcTools.NeuralTyres.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="AcTools.AcdEncryption, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\Libraries\AcTools.AcdEncryption\AcTools.AcdEncryption.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
Expand Down
11 changes: 0 additions & 11 deletions AcTools.NeuralTyres.Tests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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>[] series) {
using (var ch = new Chart()) {
ch.ChartAreas.Add(new ChartArea());
Expand All @@ -38,7 +29,6 @@ private void BuildChart(params Action<Series>[] series) {
}
}

// [Test]
public void Main() {
var carsFromWebApp = new[] {
/*"lotus_exige_s", "lotus_exige_s", "lotus_evora_gte", "lotus_elise_sc", "alfa_mito_qv",
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 0 additions & 2 deletions AcTools.Tests/DataWrapperTest.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 2a223b6

Please sign in to comment.