diff --git a/BTCPayServer.Vault.sln b/BTCPayServer.Vault.sln index db80c13..1cc3061 100644 --- a/BTCPayServer.Vault.sln +++ b/BTCPayServer.Vault.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29411.108 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32414.318 MinimumVisualStudioVersion = 15.0.26124.0 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BTCPayServer.Vault", "BTCPayServer.Vault\BTCPayServer.Vault.csproj", "{E54675AA-679D-440B-B82C-52FC2E119C34}" EndProject diff --git a/BTCPayServer.Vault/BTCPayServer.Vault.csproj b/BTCPayServer.Vault/BTCPayServer.Vault.csproj index a57e6ba..be29c0c 100644 --- a/BTCPayServer.Vault/BTCPayServer.Vault.csproj +++ b/BTCPayServer.Vault/BTCPayServer.Vault.csproj @@ -16,12 +16,12 @@ + - - + @@ -54,7 +54,8 @@ - false + true + true true diff --git a/BTCPayServer.Vault/Extensions.cs b/BTCPayServer.Vault/Extensions.cs index ee89f0b..202dc17 100644 --- a/BTCPayServer.Vault/Extensions.cs +++ b/BTCPayServer.Vault/Extensions.cs @@ -10,8 +10,6 @@ using Avalonia.Controls; using Avalonia.Platform; using Avalonia.Rendering; using Avalonia.Threading; -using AvalonStudio.Shell; -using AvalonStudio.Shell.Extensibility.Platforms; using Microsoft.Extensions.DependencyInjection; using Avalonia.Controls.Platform; using System.Reflection; diff --git a/BTCPayServer.Vault/MainWindow.xaml b/BTCPayServer.Vault/MainWindow.xaml index c1bb780..90c82af 100644 --- a/BTCPayServer.Vault/MainWindow.xaml +++ b/BTCPayServer.Vault/MainWindow.xaml @@ -3,7 +3,8 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" - SizeToContent="Manual" + SizeToContent="Height" + CanResize="false" Width="622" Height="433" Icon="avares://BTCPayServer.Vault/Assets/BTCPayServerVault-256x256.png" diff --git a/BTCPayServer.Vault/MainWindow.xaml.cs b/BTCPayServer.Vault/MainWindow.xaml.cs index 6547538..96a34d2 100644 --- a/BTCPayServer.Vault/MainWindow.xaml.cs +++ b/BTCPayServer.Vault/MainWindow.xaml.cs @@ -16,26 +16,6 @@ namespace BTCPayServer.Vault { public class MainWindow : Window { - static Size NormalSize = new Size(622, 220); - static Size ExpandedSize = new Size(622, 433); - /// - /// Workaround https://github.com/AvaloniaUI/Avalonia/issues/3290 and https://github.com/AvaloniaUI/Avalonia/issues/3291 - /// Because our app can only have two size we just resize based on the state of IsVisible of the MainViewModel - /// - void ResizeHack() - { - Size newSize = MainViewModel.IsVisible ? ExpandedSize : NormalSize; - - if (newSize != this.ClientSize) - { - this.ClientSize = newSize; - // On Mac, resizing down will make the windows jump down, so we need to set it back up - if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) && newSize == NormalSize) - { - this.Position = this.Position.WithY(this.Position.Y - (int)(ExpandedSize.Height - NormalSize.Height)); - } - } - } public MainWindow() { @@ -43,7 +23,7 @@ namespace BTCPayServer.Vault Title = Extensions.GetTitle(); } - DispatcherTimer _ResizeHackTimer; + private DispatcherTimer _BlinkTimer; private void InitializeComponent() { AvaloniaXamlLoader.Load(this); @@ -56,14 +36,12 @@ namespace BTCPayServer.Vault Indicator.StoppedRunning += OnStoppedRunning; DataContext = ServiceProvider.GetRequiredService(); MainViewModel.PropertyChanged += MainViewModel_PropertyChanged; - _ResizeHackTimer = new DispatcherTimer(TimeSpan.FromSeconds(1), DispatcherPriority.Normal, (_, __) => + _BlinkTimer = new DispatcherTimer(TimeSpan.FromSeconds(1), DispatcherPriority.Normal, (_, __) => { - ResizeHack(); if (MainViewModel.IsVisible && this.WindowState == WindowState.Minimized) this.Blink(); }); - _ResizeHackTimer.Start(); - this.ResizeHack(); + _BlinkTimer.Start(); } } private void MainViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e) @@ -72,7 +50,6 @@ namespace BTCPayServer.Vault { Context.Post(_ => { - this.ResizeHack(); this.ActivateHack(); }, null); } @@ -86,7 +63,7 @@ namespace BTCPayServer.Vault Indicator.Running -= OnRunning; Indicator.StoppedRunning -= OnStoppedRunning; MainViewModel.PropertyChanged -= MainViewModel_PropertyChanged; - _ResizeHackTimer.Stop(); + _BlinkTimer.Stop(); } } diff --git a/BTCPayServer.Vault/Program.cs b/BTCPayServer.Vault/Program.cs index 18c1c48..71ff317 100644 --- a/BTCPayServer.Vault/Program.cs +++ b/BTCPayServer.Vault/Program.cs @@ -16,7 +16,6 @@ using Microsoft.Extensions.Hosting; using Microsoft.AspNetCore.Hosting.Server; using System.IO; using Avalonia; -using Avalonia.Logging.Serilog; using Microsoft.AspNetCore.Connections; using System.Net.Sockets; using System.Threading; @@ -73,6 +72,6 @@ namespace BTCPayServer.Vault public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() .UsePlatformDetect() - .LogToDebug(); + .LogToTrace(); } }