Browse Source

updated avaloniaui and other dependencies

Veloe 2 years ago
parent
commit
ca4b6aba59

+ 3 - 2
VeloeMinecraftLauncher/App.axaml

@@ -1,11 +1,12 @@
 <Application xmlns="https://github.com/avaloniaui"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:local="using:VeloeMinecraftLauncher"
-             x:Class="VeloeMinecraftLauncher.App">
+             x:Class="VeloeMinecraftLauncher.App"
+	         RequestedThemeVariant="Default">
     <Application.DataTemplates>
         <local:ViewLocator/>
     </Application.DataTemplates>
 	<Application.Styles>
-		<FluentTheme Mode="Dark"/>
+		<FluentTheme/>
 	</Application.Styles>
 </Application>

+ 4 - 3
VeloeMinecraftLauncher/Program.cs

@@ -31,9 +31,10 @@ namespace VeloeMinecraftLauncher
             Trace.Listeners.Add(listener);
             
             return AppBuilder.Configure<App>()
-                  .UsePlatformDetect()                 
-                  .LogToTrace()
-                  .UseReactiveUI();
+                    .UsePlatformDetect()
+                    .WithInterFont()
+                    .LogToTrace()
+                    .UseReactiveUI();
         }
     }
 }

+ 14 - 13
VeloeMinecraftLauncher/VeloeMinecraftLauncher.csproj

@@ -4,14 +4,13 @@
     <TargetFramework>net7.0</TargetFramework>
 	<TieredCompilationQuickJit>false</TieredCompilationQuickJit>
     <Nullable>enable</Nullable>
-    <!--Avalonia doesen't support TrimMode=link currently,but we are working on that https://github.com/AvaloniaUI/Avalonia/issues/6892 -->
-    <TrimMode>copyused</TrimMode>
+	<TrimMode>partial</TrimMode>
     <BuiltInComInteropSupport>true</BuiltInComInteropSupport>
     <DebugType>embedded</DebugType>
     <StartupObject>VeloeMinecraftLauncher.Program</StartupObject>
     <PlatformTarget>x64</PlatformTarget>
-    <AssemblyVersion>1.3.1.6</AssemblyVersion>
-    <FileVersion>1.3.1.6</FileVersion>
+    <AssemblyVersion>1.4.0.44</AssemblyVersion>
+    <FileVersion>1.4.0.44</FileVersion>
     <Configurations>Debug;Release</Configurations>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@@ -33,21 +32,23 @@
     <TrimmableAssembly Include="Avalonia.Themes.Default" />
   </ItemGroup>
   <ItemGroup>
-    <PackageReference Include="Avalonia" Version="0.10.21" />
-    <PackageReference Include="Avalonia.Controls.DataGrid" Version="0.10.21" />
-    <PackageReference Include="Avalonia.Desktop" Version="0.10.21" />
+    <PackageReference Include="Avalonia" Version="11.0.0" />
+    <PackageReference Include="Avalonia.Controls.DataGrid" Version="11.0.0" />
+    <PackageReference Include="Avalonia.Desktop" Version="11.0.0" />
     <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
-    <PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.18" />
-    <PackageReference Include="Avalonia.ReactiveUI" Version="0.10.21" />
+    <PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0" />
+    <PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.0" />
+    <PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0" />
+    <PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0" />
+    <PackageReference Include="Avalonia.Xaml.Interactivity" Version="11.0.0.1" />
     <PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.9" />
-    <PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.0" />
-    <PackageReference Include="ReactiveUI.Blazor" Version="18.4.1" />
+    <PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.8" />
+    <PackageReference Include="ReactiveUI.Blazor" Version="19.3.3" />
     <PackageReference Include="ReactiveUI.Validation" Version="3.1.7" />
-    <PackageReference Include="Serilog" Version="2.12.0" />
+    <PackageReference Include="Serilog" Version="3.0.1" />
     <PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
     <PackageReference Include="SerilogTraceListener" Version="3.2.0" />
     <PackageReference Include="System.Net.Http" Version="4.3.4" />
-    <PackageReference Include="XamlNameReferenceGenerator" Version="1.5.1" />
   </ItemGroup>
   <ItemGroup>
     <Compile Update="Views\MessageWindow.axaml.cs">

+ 3 - 5
VeloeMinecraftLauncher/ViewLocator.cs

@@ -7,7 +7,7 @@ namespace VeloeMinecraftLauncher
 {
     public class ViewLocator : IDataTemplate
     {
-        public IControl Build(object data)
+        public Control Build(object data)
         {
             var name = data.GetType().FullName!.Replace("ViewModel", "View");
             var type = Type.GetType(name);
@@ -16,10 +16,8 @@ namespace VeloeMinecraftLauncher
             {
                 return (Control)Activator.CreateInstance(type)!;
             }
-            else
-            {
-                return new TextBlock { Text = "Not Found: " + name };
-            }
+
+            return new TextBlock { Text = "Not Found: " + name };
         }
 
         public bool Match(object data)

+ 4 - 9
VeloeMinecraftLauncher/ViewModels/ViewModelBase.cs

@@ -3,13 +3,11 @@ using Avalonia.Controls;
 using Avalonia.Controls.ApplicationLifetimes;
 using Avalonia.Media;
 using Avalonia.Threading;
-using Avalonia.VisualTree;
 using ReactiveUI;
 using ReactiveUI.Validation.Helpers;
 using System;
 using System.ComponentModel;
 using System.IO;
-using System.Linq;
 using System.Net;
 using VeloeMinecraftLauncher.Utils;
 using VeloeMinecraftLauncher.Views;
@@ -39,9 +37,9 @@ public class ViewModelBase : ReactiveValidationObject
 
     public static void OpenErrorWindow(Exception ex)
     {
-        string message = "";
-        string stackTrace = "";
-        string logfile = "";
+        string message = string.Empty;
+        string stackTrace = string.Empty;
+        string logfile = string.Empty;
         Exception? innerException;
         switch (ex)
         {
@@ -49,11 +47,8 @@ public class ViewModelBase : ReactiveValidationObject
                 message = ex.Message;
                 Settings.logger.Error(ex.Message);
 
-                if (ex is JavaProcessException)
-                {
-                    if (Path.Exists(((JavaProcessException)ex).LogPath))
+                if (ex is JavaProcessException javaEx && Path.Exists(javaEx.LogPath))
                         logfile = ((JavaProcessException)ex).LogPath;                   
-                }
 
                 if (ex.StackTrace is not null)
                     Settings.logger.Error(ex.StackTrace);

+ 31 - 7
VeloeMinecraftLauncher/Views/MainWindow.axaml

@@ -31,9 +31,6 @@
     </Design.DataContext>
 	
 	<Panel>
-
-		
-
 		<DockPanel>			
 			<titlebars:TitleBarWindow
 			  IsSeamless="False"
@@ -43,7 +40,7 @@
 			  DockPanel.Dock="Top"
 			  ZIndex="997">
 			</titlebars:TitleBarWindow>
-			
+
 			<Grid DockPanel.Dock="Left">
 				<Grid.RowDefinitions>
 					<RowDefinition Height="0"></RowDefinition>
@@ -147,7 +144,7 @@
 						Margin="3">
 					</TextBlock>
 					<ComboBox
-						Items="{Binding DownloadedVersions}"
+						ItemsSource="{Binding DownloadedVersions}"
 						PlaceholderText="Select version"
 						SelectedItem="Binding DownloadedVersion"
 						SelectedIndex="{Binding DownloadedIndex}"
@@ -167,8 +164,35 @@
 						HorizontalAlignment="Center">
 						<TextBox.Styles>
 							<Style Selector="DataValidationErrors">
-								<Setter Property="Template" Value="{DynamicResource TooltipDataValidationContentTemplate}" />
-								<Setter Property="ErrorTemplate" Value="{DynamicResource TooltipDataValidationErrorTemplate}" />
+								<Setter Property="Template">
+									<ControlTemplate>
+										<DockPanel LastChildFill="True" MaxWidth="220">
+											<ContentControl DockPanel.Dock="Right"
+															ContentTemplate="{TemplateBinding ErrorTemplate}"
+															DataContext="{TemplateBinding Owner}"
+															Content="{Binding (DataValidationErrors.Errors)}"
+															IsVisible="{Binding (DataValidationErrors.HasErrors)}"/>
+											<ContentPresenter Name="PART_ContentPresenter"
+															  Background="{TemplateBinding Background}"
+															  BorderBrush="{TemplateBinding BorderBrush}"
+															  BorderThickness="{TemplateBinding BorderThickness}"
+															  CornerRadius="{TemplateBinding CornerRadius}"
+															  ContentTemplate="{TemplateBinding ContentTemplate}"
+															  Content="{TemplateBinding Content}"
+															  Padding="{TemplateBinding Padding}"/>
+										</DockPanel>
+									</ControlTemplate>
+								</Setter>
+								<Setter Property="ErrorTemplate">
+									<DataTemplate>
+										<Canvas Width="14" Height="14" Margin="4 0 1 0"
+												Background="Transparent">
+											<Path Data="M14,7 A7,7 0 0,0 0,7 M0,7 A7,7 0 1,0 14,7 M7,3l0,5 M7,9l0,2"
+												  Stroke="Yellow"
+												  StrokeThickness="2"/>
+										</Canvas>
+									</DataTemplate>
+								</Setter>
 							</Style>
 						</TextBox.Styles>
 					</TextBox>

+ 1 - 1
VeloeMinecraftLauncher/Views/MainWindow.axaml.cs

@@ -10,7 +10,7 @@ namespace VeloeMinecraftLauncher.Views
             InitializeComponent();
         }
 
-        private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
+        private void MainWindow_Closing(object sender, WindowClosingEventArgs e)
         {
             if (DataContext is MainWindowViewModel model)
             {

+ 2 - 2
VeloeMinecraftLauncher/Views/SettingsWindow.axaml

@@ -82,10 +82,10 @@
 						</Grid.ColumnDefinitions>
 						
 						<TextBlock Grid.Row="1" Grid.Column="0" VerticalAlignment="Center">Console log event level</TextBlock>
-						<ComboBox Grid.Row="1" Grid.Column="1" Margin="5" Items="{Binding LogEventLevels}" PlaceholderText="Select level" SelectedItem="{Binding ConsoleLogEventLevel}" HorizontalAlignment="Stretch"></ComboBox>
+						<ComboBox Grid.Row="1" Grid.Column="1" Margin="5" ItemsSource="{Binding LogEventLevels}" PlaceholderText="Select level" SelectedItem="{Binding ConsoleLogEventLevel}" HorizontalAlignment="Stretch"></ComboBox>
 						
 						<TextBlock Grid.Row="2" Grid.Column="0" VerticalAlignment="Center">File log event level</TextBlock>
-						<ComboBox Grid.Row="2" Grid.Column="1" Margin="5" Items="{Binding LogEventLevels}" PlaceholderText="Select level" SelectedItem="{Binding FileLogEventLevel}" HorizontalAlignment="Stretch"></ComboBox>
+						<ComboBox Grid.Row="2" Grid.Column="1" Margin="5" ItemsSource="{Binding LogEventLevels}" PlaceholderText="Select level" SelectedItem="{Binding FileLogEventLevel}" HorizontalAlignment="Stretch"></ComboBox>
 						
 						<CheckBox Grid.Row="3" Grid.Column="0" IsChecked="{Binding SetMaxLog}">Set max log size</CheckBox>
 						<TextBox Grid.Row="3" Grid.Column="1" Margin="5" Name="MaxLog" Text="{Binding MaxLog}" IsEnabled="{Binding SetMaxLog}" HorizontalAlignment="Left" VerticalAlignment="Top"></TextBox>

+ 3 - 5
VeloeMinecraftLauncher/Views/VersionsDownloader.axaml

@@ -4,8 +4,6 @@
 		xmlns:vm="using:VeloeMinecraftLauncher.ViewModels"
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-		xmlns:i="clr-namespace:Avalonia.Xaml.Interactivity;assembly=Avalonia.Xaml.Interactivity"
-             xmlns:ia="clr-namespace:Avalonia.Xaml.Interactions.Core;assembly=Avalonia.Xaml.Interactions"
 		xmlns:titlebars="using:VeloeMinecraftLauncher.Views.TitleBar"
         mc:Ignorable="d" d:DesignWidth="350" d:DesignHeight="500"
 		Width="350" Height="500"
@@ -47,7 +45,7 @@
 				<TabItem Header="Downloader">
 					<Grid Margin="10" RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,*,Auto,Auto,Auto,Auto">
 						<ComboBox
-							Items="{Binding FilteredVersions}"
+							ItemsSource="{Binding FilteredVersions}"
 							PlaceholderText="Select version"
 							SelectedItem="{Binding FilteredVersion}"
 							IsEnabled="{Binding IsControlsEnabled}"
@@ -124,7 +122,7 @@
 				<TabItem Header="Manager">
 					<Grid Margin="10" RowDefinitions="Auto,*,Auto">
 						<ComboBox
-							Items="{Binding DownloadedVersions}"
+							ItemsSource="{Binding DownloadedVersions}"
 							PlaceholderText="Select version"
 							SelectedItem="{Binding DownloadedVersion}"
 							IsEnabled="{Binding IsControlsEnabled}"
@@ -132,7 +130,7 @@
 							Grid.Row="0"/>
 
 							<TreeView
-								Items="{Binding DownloadedVersionTree}"
+								ItemsSource="{Binding DownloadedVersionTree}"
 							    IsEnabled="{Binding IsControlsEnabled}"
 								x:Name="treeView"
 								Margin="0,10,0,0"

+ 1 - 1
VeloeMinecraftLauncher/Views/VersionsDownloader.axaml.cs

@@ -13,7 +13,7 @@ namespace VeloeMinecraftLauncher.Views
             InitializeComponent();
         }
 
-        private void VersionDownloader_Closing(object sender, System.ComponentModel.CancelEventArgs e)
+        private void VersionDownloader_Closing(object sender, WindowClosingEventArgs e)
         {
             if (DataContext is VersionsDownloaderViewModel model)
             {

+ 18 - 0
VeloeMinecraftLauncher/app.manifest

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
+  <!-- This manifest is used on Windows only.
+       Don't remove it as it might cause problems with window transparency and embeded controls.
+       For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
+  <assemblyIdentity version="1.0.0.0" name="VeloeMinecraftLauncher.Desktop"/>
+
+  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+    <application>
+      <!-- A list of the Windows versions that this application has been tested on
+           and is designed to work with. Uncomment the appropriate elements
+           and Windows will automatically select the most compatible environment. -->
+
+      <!-- Windows 10 -->
+      <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
+    </application>
+  </compatibility>
+</assembly>