Update Avalonia, reactivate trimming
This commit is contained in:
parent
0904f02364
commit
ed9a3c76eb
@ -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
|
||||
|
||||
@ -16,12 +16,12 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia.Desktop" Version="0.10.16" />
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="0.9.12" />
|
||||
<PackageReference Include="AvalonStudio.Shell" Version="0.9.9" />
|
||||
<PackageReference Include="Avalonia" Version="0.10.16" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
|
||||
<PackageReference Include="NicolasDorier.RateLimits" Version="1.1.0" />
|
||||
</ItemGroup>
|
||||
@ -54,7 +54,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(GithubDistrib)' == 'true'">
|
||||
<PublishTrimmed>false</PublishTrimmed>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<SelfContained>true</SelfContained>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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);
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
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<MainWindowViewModel>();
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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<App>()
|
||||
.UsePlatformDetect()
|
||||
.LogToDebug();
|
||||
.LogToTrace();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user