From fb274baebfc936b974a0c155fe68bfbeca0a7133 Mon Sep 17 00:00:00 2001 From: GreenXeMotion <97885053+GreenXeMotion@users.noreply.github.com> Date: Mon, 7 Apr 2025 03:56:44 +0600 Subject: [PATCH] Rework ServerSelector app UI (#27) * Rework ServerSelector app UI * fix border on linux --------- Co-authored-by: Mikhail Tyukin --- ServerSelector/App.axaml | 20 ++- ServerSelector/Views/MainView.axaml | 100 +++++++++++- ServerSelector/Views/MainView.axaml.cs | 8 +- ServerSelector/Views/MainWindow.axaml | 198 ++++++++++++++++++++++- ServerSelector/Views/MainWindow.axaml.cs | 20 +++ 5 files changed, 331 insertions(+), 15 deletions(-) diff --git a/ServerSelector/App.axaml b/ServerSelector/App.axaml index 5ec1193..603bea1 100644 --- a/ServerSelector/App.axaml +++ b/ServerSelector/App.axaml @@ -1,11 +1,25 @@ + RequestedThemeVariant="Dark"> - + + + + diff --git a/ServerSelector/Views/MainView.axaml b/ServerSelector/Views/MainView.axaml index d7f9b4f..2def89e 100644 --- a/ServerSelector/Views/MainView.axaml +++ b/ServerSelector/Views/MainView.axaml @@ -7,6 +7,88 @@ x:Class="ServerSelector.Views.MainView" xmlns:ui="using:FluentAvalonia.UI.Controls" > + + + + + + + + + + + + @@ -34,7 +116,7 @@ Game path: C:\NIKKE\ - + Server: @@ -51,7 +133,15 @@ Enable offline mode Status: OK - + @@ -70,16 +160,12 @@ - - - - APK path: - + IP: diff --git a/ServerSelector/Views/MainView.axaml.cs b/ServerSelector/Views/MainView.axaml.cs index 7e5456e..15d9ede 100644 --- a/ServerSelector/Views/MainView.axaml.cs +++ b/ServerSelector/Views/MainView.axaml.cs @@ -5,7 +5,6 @@ using FluentAvalonia.UI.Controls; using System; using System.IO; using System.Net; -using System.Runtime.InteropServices; using System.Security.Principal; namespace ServerSelector.Views; @@ -108,7 +107,7 @@ public partial class MainView : UserControl return; SetLoadingScreenVisible(true); - LblStatus.Text = "Status: " + await ServerSwitcher.CheckIntegrity(GamePath, LauncherPath) + ", for game version " + ServerSwitcher.PatchGameVersion; + LblStatus.Text = "Status: " + await ServerSwitcher.CheckIntegrity(GamePath, LauncherPath); SetLoadingScreenVisible(false); } @@ -211,6 +210,11 @@ public partial class MainView : UserControl } } + private void BtnSelectApkPath_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e) + { + // To be implemented + } + private void GamePath_TextChanged(object? sender, TextChangedEventArgs e) { UpdateIntegrityLabel(); diff --git a/ServerSelector/Views/MainWindow.axaml b/ServerSelector/Views/MainWindow.axaml index 5e33ac7..a1c0add 100644 --- a/ServerSelector/Views/MainWindow.axaml +++ b/ServerSelector/Views/MainWindow.axaml @@ -4,8 +4,200 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:views="clr-namespace:ServerSelector.Views" - mc:Ignorable="d" d:DesignWidth="370" d:DesignHeight="300" + xmlns:ui="using:FluentAvalonia.UI.Controls" + mc:Ignorable="d" d:DesignWidth="380" d:DesignHeight="300" x:Class="ServerSelector.Views.MainWindow" - Title="Server Switcher" Width="370" Height="300" CanResize="True"> - + Width="380" Height="360" + WindowStartupLocation="CenterScreen" + TransparencyLevelHint="AcrylicBlur" + Background="Transparent" + ExtendClientAreaToDecorationsHint="True" + ExtendClientAreaChromeHints="NoChrome" + ExtendClientAreaTitleBarHeightHint="-1" + SystemDecorations="BorderOnly"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ServerSelector/Views/MainWindow.axaml.cs b/ServerSelector/Views/MainWindow.axaml.cs index 6a5f0fb..610d422 100644 --- a/ServerSelector/Views/MainWindow.axaml.cs +++ b/ServerSelector/Views/MainWindow.axaml.cs @@ -1,4 +1,6 @@ using Avalonia.Controls; +using Avalonia.Input; +using Avalonia.Interactivity; namespace ServerSelector.Views; @@ -8,4 +10,22 @@ public partial class MainWindow : Window { InitializeComponent(); } + + private void WindowPointerPressed(object? sender, PointerPressedEventArgs e) + { + if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) + { + BeginMoveDrag(e); + } + } + + private void MinimizeButton_Click(object sender, RoutedEventArgs e) + { + WindowState = WindowState.Minimized; + } + + private void CloseButton_Click(object sender, RoutedEventArgs e) + { + Close(); + } }