Browse Source

removed all windows to tabs

Veloe 4 months ago
parent
commit
8d21c0f9ab

+ 2 - 2
VeloeMinecraftLauncher/VeloeMinecraftLauncher.csproj

@@ -10,8 +10,8 @@
 		<DebugType>embedded</DebugType>
 		<StartupObject>VeloeMinecraftLauncher.Program</StartupObject>
 		<PlatformTarget>x64</PlatformTarget>
-		<AssemblyVersion>1.6.0.153</AssemblyVersion>
-		<FileVersion>1.6.0.153</FileVersion>
+		<AssemblyVersion>1.6.0.174</AssemblyVersion>
+		<FileVersion>1.6.0.174</FileVersion>
 		<Configurations>Debug;Release</Configurations>
 		<Copyright>MIT</Copyright>
 		<RepositoryType>git</RepositoryType>

+ 15 - 63
VeloeMinecraftLauncher/ViewModels/MainWindowViewModel.cs

@@ -9,7 +9,6 @@ using System.Text.Json;
 using System.Threading.Tasks;
 using VeloeMinecraftLauncher.Entity.LauncherProfiles;
 using VeloeMinecraftLauncher.Utils;
-using VeloeMinecraftLauncher.Views;
 using Microsoft.AspNetCore.SignalR.Client;
 using VeloeMinecraftLauncher.Entity.McStatus;
 using System.Timers;
@@ -28,6 +27,7 @@ using System.ComponentModel;
 using VeloeMinecraftLauncher.Utils.Logger;
 using VeloeMinecraftLauncher.Utils.Downloader;
 using VeloeMinecraftLauncher.Utils.Starter;
+using System.Windows.Input;
 
 namespace VeloeMinecraftLauncher.ViewModels;
 
@@ -72,6 +72,9 @@ public class MainWindowViewModel : ViewModelBase
                 value => { return !string.IsNullOrEmpty(value); },
                 "Empty username.");
         }
+        UpdateVersions = ReactiveCommand.Create(ScanForDownloadedVersions);
+        SettingsTabViewModel = new SettingsViewModel(_logger,UpdateVersions);
+        VersionsDownloaderTabViewModel = new VersionsDownloaderViewModel(_logger,UpdateVersions);
 
         Task.Run(async () =>
         {
@@ -243,6 +246,8 @@ public class MainWindowViewModel : ViewModelBase
     private Action _hide = () => { };
     private Action _show = () => { };
 
+    private ICommand UpdateVersions;
+
     LatestLauncherVersion? _latestLauncherInfo;
     DownloadedVersion? _downloadedVersion;
     DownloadedVersion? _startedVersion;
@@ -360,28 +365,8 @@ public class MainWindowViewModel : ViewModelBase
         set => this.RaisePropertyChanged(nameof(ConsoleTextCaretIndex));
     }
 
-    public async void OnClickCommand()
-    {
-        using var versionsDownloaderViewModel = new VersionsDownloaderViewModel(_logger);
-        var versionsDownloader = new VersionsDownloader 
-        { 
-            DataContext = versionsDownloaderViewModel
-        };
-       
-        if (Avalonia.Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop && desktop.MainWindow is not null)
-        {
-            try
-            {
-                versionsDownloader.Closed += OnDialogWindowCloseVersionsScan;
-                await versionsDownloader.ShowDialog(desktop.MainWindow);
-            }
-            catch (Exception ex)
-            {
-                //sometimes throws collection modified exception in manager tab
-                OpenErrorWindow(ex);
-            }
-        }
-    }
+    public SettingsViewModel SettingsTabViewModel { get; set; }
+    public VersionsDownloaderViewModel VersionsDownloaderTabViewModel { get; set; }
 
     public void StartMinecraft()
     {
@@ -659,8 +644,6 @@ public class MainWindowViewModel : ViewModelBase
         }
     }
 
-
-
     public void ScanForDownloadedVersions()
     {
         DownloadedVersions ??= new();
@@ -718,41 +701,6 @@ public class MainWindowViewModel : ViewModelBase
         
     }
 
-    public void OnDialogWindowCloseVersionsScan(object? sendingObject, EventArgs e)
-    {
-        try
-        {
-            ScanForDownloadedVersions();
-        }
-        catch (Exception ex)
-        {
-            OpenErrorWindow(ex);                
-        }
-
-        switch (sendingObject)
-        {
-            case VersionsDownloader:
-                ((VersionsDownloader)sendingObject).Closed -= OnDialogWindowCloseVersionsScan;
-                break;
-
-            case SettingsWindow:
-                ((SettingsWindow)sendingObject).Closed -= OnDialogWindowCloseVersionsScan;
-                break;
-        }
-
-    }
-
-    public void OpenSettings()
-    {
-        var settingsWindow = new SettingsWindow { DataContext = new SettingsWindowViewModel(_logger) };
-
-        if (Avalonia.Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop && desktop.MainWindow is not null)
-        {
-            settingsWindow.Closed += OnDialogWindowCloseVersionsScan;
-            settingsWindow.ShowDialog(desktop.MainWindow);
-        }
-    }
-
     public void DownloadUpdate()
     {
         _logger.Debug("Started updater.exe");
@@ -905,7 +853,7 @@ public class MainWindowViewModel : ViewModelBase
             if (downloadedVersion != null)
             {
                 DownloadedIndex = DownloadedVersions.IndexOf(downloadedVersion);
-                StartMinecraft($" -server {server.Address}");
+                StartMinecraft($" --server {server.Address}");
                 return;
             }
         }
@@ -917,7 +865,7 @@ public class MainWindowViewModel : ViewModelBase
             if (downloadedVersion != null)
             {
                 DownloadedIndex = DownloadedVersions.IndexOf(downloadedVersion);
-                StartMinecraft($" -server {server.Address}");
+                StartMinecraft($" --server {server.Address}");
                 return;
             }
         }
@@ -928,7 +876,10 @@ public class MainWindowViewModel : ViewModelBase
 
     public void SetNewPreferredVersion(ServerPanelModel server)
     {
-        SettingsService.Instance.ServerAutoConnectLinks.Add(server.Name, DownloadedVersion?.Version);
+        if (!SettingsService.Instance.ServerAutoConnectLinks.ContainsKey(server.Name))
+            SettingsService.Instance.ServerAutoConnectLinks.Add(server.Name, DownloadedVersion?.Version);
+        else
+            SettingsService.Instance.ServerAutoConnectLinks[server.Name] = DownloadedVersion?.Version;
         server.UserClientName = DownloadedVersion?.Version;
         SettingsService.SaveSettings();
     }
@@ -945,6 +896,7 @@ public class MainWindowViewModel : ViewModelBase
 
     public void OnClosing(object sender, CancelEventArgs args)
     {
+        VersionsDownloaderTabViewModel?.OnClosing(sender, args);
         _tokenSource.Cancel();
         _tokenSource.Dispose();
     }

+ 10 - 12
VeloeMinecraftLauncher/ViewModels/SettingsWindowViewModel.cs → VeloeMinecraftLauncher/ViewModels/SettingsViewModel.cs

@@ -12,14 +12,15 @@ using System.Linq;
 using Avalonia.Platform.Storage;
 using DynamicData.Binding;
 using System.Reactive.Linq;
+using System.Windows.Input;
 
 namespace VeloeMinecraftLauncher.ViewModels;
 
-public class SettingsWindowViewModel : ViewModelBase
+public class SettingsViewModel : ViewModelBase
 {
-    public SettingsWindowViewModel() : this(new Serilog.LoggerConfiguration().CreateLogger())
+    public SettingsViewModel() : this(new Serilog.LoggerConfiguration().CreateLogger(), null)
     { }
-    public SettingsWindowViewModel(Serilog.ILogger logger)
+    public SettingsViewModel(Serilog.ILogger logger,ICommand update)
     {
         _logger = logger;
 
@@ -29,8 +30,9 @@ public class SettingsWindowViewModel : ViewModelBase
         ValidationContext.Changed.Subscribe(x => this.RaisePropertyChanged(nameof(IsValid)));
         AllSettingsProprtiesObservable().Subscribe(x=>this.RaisePropertyChanged(nameof(IsValid)));
         AllSettingsProprtiesObservable().Subscribe(x => this.RaisePropertyChanged(nameof(IsModified)));
+        Update = update;
+
 
-        
         //AllSettingsProprtiesObservable().Subscribe(x => this.RaisePropertyChanged(nameof(IsValid)));
     }
 
@@ -63,13 +65,7 @@ public class SettingsWindowViewModel : ViewModelBase
         SettingsService.Instance = (SettingsSerializable)Settings.Clone();
         SettingsService.SaveSettings();
         this.RaisePropertyChanged(nameof(SetMinecraftFolder));
-    }
-
-    public void SaveSettingsAndClose(object window)
-    {
-        SettingsService.Instance = (SettingsSerializable)Settings.Clone();
-        SettingsService.SaveSettings();
-        ((Window)window).Close();
+        Update.Execute(null);
     }
 
     public void OpenMinecraftPathDialog(object window)
@@ -130,7 +126,7 @@ public class SettingsWindowViewModel : ViewModelBase
         }
     }
 
-    private IObservable<SettingsWindowViewModel?> AllSettingsProprtiesObservable()
+    private IObservable<SettingsViewModel?> AllSettingsProprtiesObservable()
     {
         return this.WhenAnyPropertyChanged(
                     nameof(SetMinecraftFolder),
@@ -379,5 +375,7 @@ public class SettingsWindowViewModel : ViewModelBase
         }
     }
 
+    public ICommand Update { get; }
+
     #endregion
 }

+ 8 - 2
VeloeMinecraftLauncher/ViewModels/VersionsDownloaderViewModel.cs

@@ -19,6 +19,7 @@ using System.Linq.Expressions;
 using System.Globalization;
 using VeloeMinecraftLauncher.Utils.Downloader;
 using VeloeMinecraftLauncher.Utils.Starter;
+using System.Windows.Input;
 
 namespace VeloeMinecraftLauncher.ViewModels;
 
@@ -65,8 +66,9 @@ public class VersionsDownloaderViewModel : ViewModelBase, IDisposable
     DownloadedVersion? _downloadedVersion;
     Modpack? _selectedModpack;
     VersionManifest _versionManifest;
-
-    public VersionsDownloaderViewModel(Serilog.ILogger logger)
+    public VersionsDownloaderViewModel() : this(new Serilog.LoggerConfiguration().CreateLogger(), null)
+    { }
+    public VersionsDownloaderViewModel(Serilog.ILogger logger,ICommand update)
     {
         IsDownloaderTabControlsEnabled = false;
         IsManagerTabControlsEnabled = false;
@@ -125,6 +127,7 @@ public class VersionsDownloaderViewModel : ViewModelBase, IDisposable
                 OpenErrorWindow(ex);
             }
         });
+        Update = update;
     }
 
     public Entity.VersionManifest.Version? FilteredVersion
@@ -297,6 +300,7 @@ public class VersionsDownloaderViewModel : ViewModelBase, IDisposable
         get => _isManagerTabControlsEnabled;
         set => this.RaiseAndSetIfChanged(ref _isManagerTabControlsEnabled, value);
     }
+    public ICommand Update { get; }
 
     private async void OnFilteredVersionPropertyChanged(object? sender, PropertyChangedEventArgs e)
     {
@@ -435,6 +439,7 @@ public class VersionsDownloaderViewModel : ViewModelBase, IDisposable
             await new Downloader(parameters, _logger).DownloadClient(_tokenSource.Token);
 
             SearchGameFolderForVersions();
+            Update.Execute(null);
             return TaskStatus.RanToCompletion; 
         });
     }
@@ -884,6 +889,7 @@ public class VersionsDownloaderViewModel : ViewModelBase, IDisposable
                 IsManagerTabControlsEnabled = true;
             }
         });
+        Update.Execute(null);
     }
 
     static string[] _size_label = { "bytes", "KB", "MB", "GB" };

+ 57 - 33
VeloeMinecraftLauncher/Views/MainWindow.axaml

@@ -1,6 +1,7 @@
 <Window xmlns="https://github.com/avaloniaui"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:vm="using:VeloeMinecraftLauncher.ViewModels"
+		xmlns:views="using:VeloeMinecraftLauncher.Views"
 		xmlns:m="using:VeloeMinecraftLauncher.Models"
 		xmlns:entity="using:VeloeMinecraftLauncher.Models.Entity"
 		xmlns:utils="using:VeloeMinecraftLauncher.Utils"
@@ -28,7 +29,7 @@
 				Opacity="0.9"
 				/>
 	</Window.Background>
-	
+
     <Design.DataContext>
         <vm:MainWindowViewModel/>
     </Design.DataContext>
@@ -73,13 +74,17 @@
 				</TextBlock>
 				<TabControl
 					Grid.Row="1"
-					HorizontalAlignment="Stretch">
+					HorizontalAlignment="Stretch"
+					SelectionChanged="OnTabSelectionChanged">
 					<TabItem
 						Header="Servers"
 						VerticalContentAlignment="Center">
 						<ItemsControl
 							Name="ServerPanelsControls"
 							ItemsSource="{Binding ServerPanels}">
+							<ItemsControl.RenderTransform>
+								<TranslateTransform X="0" Y="0" />
+							</ItemsControl.RenderTransform>
 							<ItemsControl.ItemsPanel>
 								<ItemsPanelTemplate>
 									<UniformGrid Columns="5" Rows="4"/>
@@ -170,11 +175,14 @@
 					<TabItem>
 						<TabItem.Header>
 							<TextBlock VerticalAlignment="Center">Console</TextBlock>
-						</TabItem.Header>
+						</TabItem.Header>				
 						<Panel
 							VerticalAlignment="Stretch"
 							HorizontalAlignment="Stretch"								
 							Margin="0 0 0 5">
+							<Panel.RenderTransform>
+								<TranslateTransform X="0" Y="0" />
+							</Panel.RenderTransform>
 							<Border Background="Black" Opacity="0.2" CornerRadius="5" />
 							<ScrollViewer
 								Name="ConsoleScroll"
@@ -201,6 +209,9 @@
 							VerticalAlignment="Stretch"
 							HorizontalAlignment="Stretch"
 							Margin="0 0 0 5">
+							<Panel.RenderTransform>
+								<TranslateTransform X="0" Y="0" />
+							</Panel.RenderTransform>
 							<Border Background="Black" Opacity="0.2" CornerRadius="5" />
 							<ScrollViewer
 								HorizontalScrollBarVisibility="Auto"
@@ -241,35 +252,38 @@
 							</ScrollViewer>
 						</Panel>
 					</TabItem>
+					<TabItem Header="Download">
+						<Panel
+							VerticalAlignment="Stretch"
+							HorizontalAlignment="Stretch"
+							Margin="0 0 0 5">
+							<Panel.RenderTransform>
+								<TranslateTransform X="0" Y="0" />
+							</Panel.RenderTransform>
+							<Border Background="Black" Opacity="0.2" CornerRadius="5" />
+							<views:VersionsDownloader DataContext="{Binding VersionsDownloaderTabViewModel}"></views:VersionsDownloader>
+						</Panel>
+					</TabItem>
+					<TabItem Header="Settings">
+						<Panel
+							VerticalAlignment="Stretch"
+							HorizontalAlignment="Stretch"
+							Margin="0 0 0 5">
+							<Panel.RenderTransform>
+								<TranslateTransform X="0" Y="0" />
+							</Panel.RenderTransform>
+							<Border Background="Black" Opacity="0.2" CornerRadius="5" />
+							<views:SettingsView DataContext="{Binding SettingsTabViewModel}"></views:SettingsView>
+						</Panel>
+					</TabItem>
 				</TabControl>
-				<StackPanel
+				<Grid
 					Grid.Row="2"
-					Orientation="Horizontal"
-					HorizontalAlignment="Center">
-					<Button
-						Content="{Binding DownloadButton}"
-						Command="{Binding OnClickCommand}">
-					</Button>
-					<Button
-						Content="{Binding SettingsButton}"
-						Command="{Binding OpenSettings}">
-					</Button>
-					<TextBlock
-						Margin="3">
-					</TextBlock>
-					<ComboBox
-						ItemsSource="{Binding DownloadedVersions}"
-						PlaceholderText="Select version"
-						SelectedItem="Binding DownloadedVersion"
-						SelectedIndex="{Binding DownloadedIndex}"
-						Width="220"
-						VerticalAlignment="Center"
-						HorizontalAlignment="Center">
-					</ComboBox>
-					<TextBlock
-						Margin="3">
-					</TextBlock>
+					Margin="12 0 12 5"
+					ColumnDefinitions="Auto,Auto,*">
 					<TextBox
+						Margin="0 0 3 0"
+						Grid.Column="0"
 						Text="{Binding Username}"
 						Watermark="Username"
 						MinWidth="190"
@@ -310,15 +324,25 @@
 							</Style>
 						</TextBox.Styles>
 					</TextBox>
-					<TextBlock
-						Margin="3">
-					</TextBlock>
+					<ComboBox
+						Grid.Column="1"
+						ItemsSource="{Binding DownloadedVersions}"
+						PlaceholderText="Select version"
+						SelectedItem="Binding DownloadedVersion"
+						SelectedIndex="{Binding DownloadedIndex}"
+						Width="220"
+						VerticalAlignment="Center"
+						HorizontalAlignment="Center">
+					</ComboBox>
 					<Button
+						Grid.Column="2"
+						HorizontalAlignment="Right"
+						VerticalAlignment="Center"
 						Content="{Binding StartButton}"
 						Command="{Binding StartMinecraft}" 
 						IsEnabled="{Binding IsStartButtonEnabled}">
 					</Button>
-				</StackPanel>
+				</Grid>
 			</Grid>
 		</DockPanel>
 	</Panel>	

+ 41 - 0
VeloeMinecraftLauncher/Views/MainWindow.axaml.cs

@@ -1,5 +1,9 @@
 using Avalonia.Controls;
+using Avalonia.Animation;
 using VeloeMinecraftLauncher.ViewModels;
+using Avalonia.Media;
+using Avalonia.Styling;
+using System;
 
 namespace VeloeMinecraftLauncher.Views
 {
@@ -17,5 +21,42 @@ namespace VeloeMinecraftLauncher.Views
                 model.OnClosing(sender, e);
             }
         }
+
+        private void OnTabSelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+            if ((e.AddedItems[0] as TabItem)?.Content is Control selectedContent)
+            {
+                // Define the slide-and-fade animation
+                var slideAnimation = new Animation
+                {
+                    Duration = TimeSpan.FromSeconds(0.2),
+                    Children =
+                {
+                    new KeyFrame
+                    {
+                        Cue = new Cue(0),
+                        Setters =
+                        {
+                            new Setter(TranslateTransform.XProperty, -(e.AddedItems[0] as TabItem).Bounds.Width),
+                            new Setter(OpacityProperty, 0.0)
+                        }
+                    },
+                    new KeyFrame
+                    {
+                        Cue = new Cue(1),
+                        Setters =
+                        {
+                            new Setter(TranslateTransform.XProperty, 0),
+                            new Setter(OpacityProperty, 1.0)
+                        }
+                    }
+                }
+                };
+
+                // Apply the animation
+                selectedContent.RenderTransform = new TranslateTransform();
+                slideAnimation.RunAsync(selectedContent, default);
+            }
+        }
     }
 }

+ 119 - 149
VeloeMinecraftLauncher/Views/SettingsWindow.axaml → VeloeMinecraftLauncher/Views/SettingsView.axaml

@@ -1,59 +1,31 @@
-<Window xmlns="https://github.com/avaloniaui"
-        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-		xmlns:vm="using:VeloeMinecraftLauncher.ViewModels"
-        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
-        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-		xmlns:titlebars="using:VeloeMinecraftLauncher.Views.TitleBar"
-		xmlns:utils="using:VeloeMinecraftLauncher.Utils"
-		xmlns:controls="using:VeloeMinecraftLauncher.Controls"
-        mc:Ignorable="d" d:DesignWidth="600" d:DesignHeight="450"
-		Width="600" Height="450"
-		MaxWidth="600" MaxHeight="450"
-        x:Class="VeloeMinecraftLauncher.Views.SettingsWindow"
-        Icon="/Assets/avalonia-logo.ico"
-        Title="Settings"
-		TransparencyLevelHint="AcrylicBlur"
-		Background="Transparent"
-		CanResize="False"
-		ExtendClientAreaToDecorationsHint="True"
-		ExtendClientAreaChromeHints="NoChrome"
-		ExtendClientAreaTitleBarHeightHint="-1">
-
-	<Window.Styles>
+<UserControl xmlns="https://github.com/avaloniaui"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             xmlns:vm="using:VeloeMinecraftLauncher.ViewModels"
+		  	 xmlns:utils="using:VeloeMinecraftLauncher.Utils"
+		  	 xmlns:controls="using:VeloeMinecraftLauncher.Controls"
+			 mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="320"
+             x:Class="VeloeMinecraftLauncher.Views.SettingsView">
+	<UserControl.Styles>
 		<Style Selector="TabItem">
 			<Setter Property="FontSize" Value="16"/>
 		</Style>
-	</Window.Styles>
+	</UserControl.Styles>
 	<Design.DataContext>
-		<vm:SettingsWindowViewModel/>
+		<vm:SettingsViewModel/>
 	</Design.DataContext>
 	<Panel>
-		<ExperimentalAcrylicBorder IsHitTestVisible="False">
-			<ExperimentalAcrylicBorder.Material>
-				<ExperimentalAcrylicMaterial
-					BackgroundSource="Digger"
-					TintColor="{Binding InterfaceColor}"
-					TintOpacity="1"
-					MaterialOpacity="{Binding MaterialOpacity}" />
-			</ExperimentalAcrylicBorder.Material>
-		</ExperimentalAcrylicBorder>
 		<DockPanel>
-			<titlebars:TitleBarWindow
-			  IsSeamless="False"
-			  IsIconVisible="False"
-			  IsMaximizeVisible="False"
-			  TitleText="Settings"
-			  DockPanel.Dock="Top">
-			</titlebars:TitleBarWindow>
 			<TabControl
-				HorizontalAlignment="Stretch" 
+				HorizontalAlignment="Stretch"
 				DockPanel.Dock="Top">
 				<TabItem
 					Header="Game"
 					VerticalContentAlignment="Center">
-					<Grid 
-						Margin="10 0 10 5" 
-						ShowGridLines="false" 
+					<Grid
+						Margin="10 0 10 5"
+						ShowGridLines="false"
 						RowDefinitions="Auto, Auto, Auto, Auto, Auto, Auto, Auto, Auto">
 						<Grid.ColumnDefinitions>
 							<ColumnDefinition Width="250"></ColumnDefinition>
@@ -61,54 +33,54 @@
 							<ColumnDefinition Width="70"></ColumnDefinition>
 						</Grid.ColumnDefinitions>
 
-						<CheckBox 
-							Grid.Row="1" Grid.Column="0" 
-							IsChecked="true" 
+						<CheckBox
+							Grid.Row="1" Grid.Column="0"
+							IsChecked="true"
 							IsEnabled="False">
 							Set path to minecraft folder
 						</CheckBox>
-						<TextBox 
-							Grid.Row="1" Grid.Column="1" 
-							Margin="5" 
-							Text="{Binding MinecraftFolderPath}" 
+						<TextBox
+							Grid.Row="1" Grid.Column="1"
+							Margin="5"
+							Text="{Binding MinecraftFolderPath}"
 							IsEnabled="{Binding SetMinecraftFolder}"/>
-						<Button 
-							Grid.Row="1" Grid.Column="2" 
-							Content="Open" 
+						<Button
+							Grid.Row="1" Grid.Column="2"
+							Content="Open"
 							Command="{Binding OpenMinecraftPathDialog}"
-							CommandParameter="{Binding $parent[Window]}" 
-							HorizontalAlignment="Stretch" 
+							CommandParameter="{Binding $parent[Window]}"
+							HorizontalAlignment="Stretch"
 							HorizontalContentAlignment="Center"/>
 
-						<CheckBox 
-							Grid.Row="2" 
-							Grid.Column="0" 
+						<CheckBox
+							Grid.Row="2"
+							Grid.Column="0"
 							IsChecked="{Binding UseCustomJava}">
 							Use custom java
 						</CheckBox>
-						<TextBox 
-							Grid.Row="2" Grid.Column="1" 
-							Margin="5" 
+						<TextBox
+							Grid.Row="2" Grid.Column="1"
+							Margin="5"
 							Text="{Binding JavaPath, Mode=TwoWay}"
 							IsEnabled="{Binding UseCustomJava}" />
-						<Button 
-							Grid.Row="2" Grid.Column="2" 
-							Content="Open" 
-							Command="{Binding OpenJavaPathDialog}" 
-							CommandParameter="{Binding $parent[Window]}" 
-							IsEnabled="{Binding UseCustomJava}" 
-							HorizontalAlignment="Stretch" 
+						<Button
+							Grid.Row="2" Grid.Column="2"
+							Content="Open"
+							Command="{Binding OpenJavaPathDialog}"
+							CommandParameter="{Binding $parent[Window]}"
+							IsEnabled="{Binding UseCustomJava}"
+							HorizontalAlignment="Stretch"
 							HorizontalContentAlignment="Center"/>
 
-						<CheckBox Grid.Row="3" Grid.Column="0" 
-								  IsChecked="{Binding FullScreen}">Fullscreen mode</CheckBox>
-						
-						<CheckBox 
-							Grid.Row="4" Grid.Column="0" 
+						<CheckBox Grid.Row="3" Grid.Column="0"
+									IsChecked="{Binding FullScreen}">Fullscreen mode</CheckBox>
+
+						<CheckBox
+							Grid.Row="4" Grid.Column="0"
 							IsChecked="{Binding CustomSize}">Set game resolution</CheckBox>
-						
-						<StackPanel 
-							Grid.Row="4" Grid.Column="1" 
+
+						<StackPanel
+							Grid.Row="4" Grid.Column="1"
 							Orientation="Horizontal">
 							<NumericUpDown
 								Margin="5"
@@ -151,33 +123,33 @@
 									</MultiBinding>
 								</NumericUpDown.IsEnabled>
 							</NumericUpDown>
-						</StackPanel>		
+						</StackPanel>
 
-						<CheckBox 
+						<CheckBox
 							Grid.Row="5" Grid.Column="0" IsChecked="{Binding SetMaxRam}">Set max RAM</CheckBox>
-						<StackPanel 
-							Grid.Row="5" Grid.Column="1" 
+						<StackPanel
+							Grid.Row="5" Grid.Column="1"
 							Orientation="Horizontal">
-							<NumericUpDown 
-								Grid.Row="5" Grid.Column="1" 
-								Margin="5" 
-								Name="MaxRamEdit" 
-								Value="{Binding MaxRam}" 
+							<NumericUpDown
+								Grid.Row="5" Grid.Column="1"
+								Margin="5"
+								Name="MaxRamEdit"
+								Value="{Binding MaxRam}"
 								ParsingNumberStyle="Integer"
 								MaxWidth="200"
 								Minimum="256"
 								Maximum="{Binding $parent[Window].MaxRam}"
 								Theme="{StaticResource FixDataValidation}"
 								ClipValueToMinMax ="True"
-								ShowButtonSpinner="False" 
-								IsEnabled="{Binding SetMaxRam}" 
+								ShowButtonSpinner="False"
+								IsEnabled="{Binding SetMaxRam}"
 								HorizontalAlignment="Left"
 								VerticalAlignment="Top"/>
 							<TextBlock VerticalAlignment="Center">MB</TextBlock>
 						</StackPanel>
-						<CheckBox 
-							Grid.Row="6" Grid.ColumnSpan="2" 
-							IsChecked="{Binding CheckAssets}" 
+						<CheckBox
+							Grid.Row="6" Grid.ColumnSpan="2"
+							IsChecked="{Binding CheckAssets}"
 							IsEnabled="True">
 							Check vanilla game files before start
 						</CheckBox>
@@ -187,101 +159,99 @@
 							IsEnabled="True">
 							Hide launcher on game start
 						</CheckBox>
+						<Button
+							Grid.Row="7" Grid.Column="2"
+							HorizontalAlignment="Right"
+							Content="Save"
+							Command="{Binding SaveSettings}"
+							IsEnabled="{Binding IsValid}"/>
 					</Grid>
 				</TabItem>
 				<TabItem
 					Header="Log"
 					VerticalContentAlignment="Center">
-					<Grid 
-						Margin="10 0 10 5" 
-						ShowGridLines="false" 
-						RowDefinitions="Auto, Auto, Auto, Auto, Auto, Auto, Auto">
-						
+					<Grid
+						Margin="10 0 10 5"
+						ShowGridLines="false"
+						RowDefinitions="Auto, Auto, Auto, Auto, Auto, *">
+
 						<Grid.ColumnDefinitions>
 							<ColumnDefinition Width="250"></ColumnDefinition>
 							<ColumnDefinition Width="*"></ColumnDefinition>
 							<ColumnDefinition Width="70"></ColumnDefinition>
 						</Grid.ColumnDefinitions>
-						
-						<TextBlock 
+
+						<TextBlock
 							Grid.Row="1" Grid.Column="0"
 							VerticalAlignment="Center" Text="Console log event level"/>
-						<ComboBox 
-							Grid.Row="1" Grid.Column="1" 
-							Margin="5" 
-							ItemsSource="{Binding LogEventLevels}" 
-							PlaceholderText="Select level" 
-							SelectedItem="{Binding ConsoleLogEventLevel}" 
+						<ComboBox
+							Grid.Row="1" Grid.Column="1"
+							Margin="5"
+							ItemsSource="{Binding LogEventLevels}"
+							PlaceholderText="Select level"
+							SelectedItem="{Binding ConsoleLogEventLevel}"
 							HorizontalAlignment="Stretch"/>
-						
-						<TextBlock 
+
+						<TextBlock
 							Grid.Row="2" Grid.Column="0"
 							VerticalAlignment="Center">File log event level</TextBlock>
-						<ComboBox 
-							Grid.Row="2" Grid.Column="1" 
-							Margin="5" 
-							ItemsSource="{Binding LogEventLevels}" 
-							PlaceholderText="Select level" 
-							SelectedItem="{Binding FileLogEventLevel}" 
+						<ComboBox
+							Grid.Row="2" Grid.Column="1"
+							Margin="5"
+							ItemsSource="{Binding LogEventLevels}"
+							PlaceholderText="Select level"
+							SelectedItem="{Binding FileLogEventLevel}"
 							HorizontalAlignment="Stretch"/>
-						
-						<CheckBox 
-							Grid.Row="3" Grid.Column="0" 
+
+						<CheckBox
+							Grid.Row="3" Grid.Column="0"
 							IsChecked="{Binding SetMaxLog}">Set max log size</CheckBox>
 						<StackPanel
 							Grid.Row="3" Grid.Column="1"
 							Orientation="Horizontal">
 							<NumericUpDown
-								Margin="5" 
-								Name="MaxLogEdit" 
-								Value="{Binding MaxLog}" 
+								Margin="5"
+								Name="MaxLogEdit"
+								Value="{Binding MaxLog}"
 								MaxWidth="200"
-								ParsingNumberStyle="Integer" 
-								IsEnabled="{Binding SetMaxLog}" 
-								Minimum="1" 
+								ParsingNumberStyle="Integer"
+								IsEnabled="{Binding SetMaxLog}"
+								Minimum="1"
 								Maximum="1048576"
 								Theme="{StaticResource FixDataValidation}"
-								ClipValueToMinMax ="True" 
-								ShowButtonSpinner="False" 
-								HorizontalAlignment="Left" 
+								ClipValueToMinMax ="True"
+								ShowButtonSpinner="False"
+								HorizontalAlignment="Left"
 								VerticalAlignment="Top"/>
 							<TextBlock VerticalAlignment="Center">KB</TextBlock>
 						</StackPanel>
-						<DockPanel 
+						<DockPanel
 							Grid.Row="4" Grid.ColumnSpan="3">
 							<Button
 								DockPanel.Dock="Right"
 								Content="Open log"
 								Command="{Binding OpenLogFile}"/>
-							<CheckBox 
+							<CheckBox
 								DockPanel.Dock="Left"
 								IsChecked="{Binding GameLogToLauncher}">Show game log in launcher (performace issues)</CheckBox>
 						</DockPanel>
+						<DockPanel
+							Grid.Row="5" Grid.ColumnSpan="3">
+							<Button
+								DockPanel.Dock="Right"
+								Content="Save"
+								Command="{Binding SaveSettings}"
+								IsEnabled="{Binding IsValid}"
+								VerticalAlignment="Bottom"/>
+							<TextBlock
+								DockPanel.Dock="Left"
+								Text="{Binding LauncherVersion}"
+								HorizontalAlignment="Left"
+								VerticalAlignment="Bottom"/>			
+						</DockPanel>
 					</Grid>
 				</TabItem>
-				
 			</TabControl>
-			<TextBlock
-				Text="{Binding LauncherVersion}"
-				HorizontalAlignment="Left"
-				VerticalAlignment="Bottom"
-				Margin="10 0 0 10"/>
-			<StackPanel
-				Orientation="Horizontal"
-				HorizontalAlignment="Right"
-				VerticalAlignment="Bottom" 
-				Margin="0 0 10 10">
-				<Button 
-					Content="Save"
-					Command="{Binding SaveSettings}" 
-					IsEnabled="{Binding IsValid}"
-					Margin="0 0 10 0"/>
-				<Button
-					Content="Save &amp; close"
-					Command="{Binding SaveSettingsAndClose}"
-					CommandParameter="{Binding $parent[Window]}"
-					IsEnabled="{Binding IsValid}"/>
-			</StackPanel>
 		</DockPanel>
 	</Panel>
-</Window>
+</UserControl>

+ 31 - 0
VeloeMinecraftLauncher/Views/SettingsView.axaml.cs

@@ -0,0 +1,31 @@
+using System;
+using System.Linq;
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Input;
+using Avalonia.Markup.Xaml;
+
+namespace VeloeMinecraftLauncher.Views;
+
+public partial class SettingsView : UserControl
+{
+    public SettingsView()
+    {
+        InitializeComponent();
+        this.FindControl<NumericUpDown>("GameWidthEdit").AddHandler(TextInputEvent, NumericUpDown_TextInput, Avalonia.Interactivity.RoutingStrategies.Tunnel);
+        this.FindControl<NumericUpDown>("GameHeightEdit").AddHandler(TextInputEvent, NumericUpDown_TextInput, Avalonia.Interactivity.RoutingStrategies.Tunnel);
+        this.FindControl<NumericUpDown>("MaxRamEdit").AddHandler(TextInputEvent, NumericUpDown_TextInput, Avalonia.Interactivity.RoutingStrategies.Tunnel);
+        this.FindControl<NumericUpDown>("MaxLogEdit").AddHandler(TextInputEvent, NumericUpDown_TextInput, Avalonia.Interactivity.RoutingStrategies.Tunnel);
+    }
+
+    private int MaxGameWidth => 1920;//Screens.All.Select(x => x.Bounds.Width).Max();
+
+    private int MaxGameHeight => 1080;//Screens.All.Select(x => x.Bounds.Height).Max();
+
+    private long MaxRam => GC.GetGCMemoryInfo().TotalAvailableMemoryBytes / 1024 / 1024;
+
+    private void NumericUpDown_TextInput(object? sender, TextInputEventArgs e)
+    {
+        e.Handled = !e.Text?.All(x => char.IsDigit(x)) ?? false;
+    }
+}

+ 0 - 30
VeloeMinecraftLauncher/Views/SettingsWindow.axaml.cs

@@ -1,30 +0,0 @@
-using Avalonia.Controls;
-using Avalonia.Input;
-using System;
-using System.Linq;
-
-namespace VeloeMinecraftLauncher.Views
-{
-    public partial class SettingsWindow : Window
-    {
-        public SettingsWindow()
-        {
-            InitializeComponent();
-            this.FindControl<NumericUpDown>("GameWidthEdit").AddHandler(TextInputEvent, NumericUpDown_TextInput, Avalonia.Interactivity.RoutingStrategies.Tunnel);
-            this.FindControl<NumericUpDown>("GameHeightEdit").AddHandler(TextInputEvent, NumericUpDown_TextInput, Avalonia.Interactivity.RoutingStrategies.Tunnel);
-            this.FindControl<NumericUpDown>("MaxRamEdit").AddHandler(TextInputEvent, NumericUpDown_TextInput, Avalonia.Interactivity.RoutingStrategies.Tunnel);
-            this.FindControl<NumericUpDown>("MaxLogEdit").AddHandler(TextInputEvent, NumericUpDown_TextInput, Avalonia.Interactivity.RoutingStrategies.Tunnel);
-        }
-
-        private int MaxGameWidth => Screens.All.Select(x => x.Bounds.Width).Max();
-
-        private int MaxGameHeight => Screens.All.Select(x => x.Bounds.Height).Max();
-
-        private long MaxRam => GC.GetGCMemoryInfo().TotalAvailableMemoryBytes / 1024 / 1024;
-
-        private void NumericUpDown_TextInput(object? sender, TextInputEventArgs e)
-        {
-            e.Handled = !e.Text?.All(x => char.IsDigit(x)) ?? false;
-        }
-    }
-}

+ 8 - 33
VeloeMinecraftLauncher/Views/VersionsDownloader.axaml

@@ -1,46 +1,21 @@
 
-<Window xmlns="https://github.com/avaloniaui"
+<UserControl xmlns="https://github.com/avaloniaui"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 		xmlns:vm="using:VeloeMinecraftLauncher.ViewModels"
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
-		xmlns:titlebars="using:VeloeMinecraftLauncher.Views.TitleBar"
         mc:Ignorable="d" d:DesignWidth="350" d:DesignHeight="500"
-		Width="350" Height="500"
-		MaxWidth="350" MaxHeight="500"
-        x:Class="VeloeMinecraftLauncher.Views.VersionsDownloader"
-        Icon="/Assets/avalonia-logo.ico"
-        Title="Versions Downloader"
-		TransparencyLevelHint="AcrylicBlur"
-		Background="Transparent"
-		CanResize="False"
-		ExtendClientAreaToDecorationsHint="True"
-		ExtendClientAreaChromeHints="NoChrome"
-		ExtendClientAreaTitleBarHeightHint="-1"
-		Closing="VersionDownloader_Closing">
-	
+        x:Class="VeloeMinecraftLauncher.Views.VersionsDownloader">
 	<Design.DataContext>
 		<vm:VersionsDownloaderViewModel/>
 	</Design.DataContext>
-
+	<UserControl.Styles>
+		<Style Selector="TabItem">
+			<Setter Property="FontSize" Value="16"/>
+		</Style>
+	</UserControl.Styles>
 	<Panel>
-		<ExperimentalAcrylicBorder IsHitTestVisible="False">
-			<ExperimentalAcrylicBorder.Material>
-				<ExperimentalAcrylicMaterial
-					BackgroundSource="Digger"
-					TintColor="{Binding InterfaceColor}"
-					TintOpacity="1"
-					MaterialOpacity="{Binding MaterialOpacity}" />
-			</ExperimentalAcrylicBorder.Material>
-		</ExperimentalAcrylicBorder>
 		<DockPanel>
-			<titlebars:TitleBarWindow
-			  IsSeamless="False"
-			  IsIconVisible="False"
-			  IsMaximizeVisible="False"
-			  TitleText="Versions"
-			  DockPanel.Dock="Top">
-			</titlebars:TitleBarWindow>
 			<TabControl>
 				<TabItem Header="Downloader">
 					<Grid Margin="10" RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,*,Auto,Auto,Auto,Auto">
@@ -164,4 +139,4 @@
 			</TabControl>		
 		</DockPanel>
 	</Panel>
-</Window>
+</UserControl>

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

@@ -6,19 +6,11 @@ using VeloeMinecraftLauncher.ViewModels;
 
 namespace VeloeMinecraftLauncher.Views
 {
-    public partial class VersionsDownloader : Window
+    public partial class VersionsDownloader : UserControl
     {
         public VersionsDownloader()
         {
             InitializeComponent();
         }
-
-        private void VersionDownloader_Closing(object sender, WindowClosingEventArgs e)
-        {
-            if (DataContext is VersionsDownloaderViewModel model)
-            {
-                model.OnClosing(sender,e);
-            }
-        }
     }
 }