From 15b892774f882fd33f16e0e2b45a9eb87761ce91 Mon Sep 17 00:00:00 2001
From: Visne <39844191+Visne@users.noreply.github.com>
Date: Sun, 14 Sep 2025 15:18:19 +0200
Subject: [PATCH 01/11] WIP 2
---
Directory.Packages.props | 1 +
SS14.Launcher/App.xaml | 3 +-
SS14.Launcher/App.xaml.cs | 2 +-
SS14.Launcher/Localization/LocExtension.cs | 5 +
SS14.Launcher/SS14.Launcher.csproj | 1 +
SS14.Launcher/Theme/ThemeServerList.axaml | 131 +++++++----------
.../MainWindowTabs/ServerEntryViewModel.cs | 4 +
SS14.Launcher/Views/MainWindow.xaml | 2 +-
SS14.Launcher/Views/MainWindowContent.xaml | 2 +-
.../Views/MainWindowTabs/HomePageView.xaml | 9 +-
.../Views/MainWindowTabs/ServerEntryView.xaml | 136 +++++++-----------
.../Views/MainWindowTabs/ServerList.xaml | 67 +++++++++
.../Views/MainWindowTabs/ServerList.xaml.cs | 72 ++++++----
SS14.Launcher/Views/RowSideAlignedPanel.cs | 9 +-
14 files changed, 238 insertions(+), 206 deletions(-)
create mode 100644 SS14.Launcher/Views/MainWindowTabs/ServerList.xaml
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 80adcd584..9b0286a42 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -20,6 +20,7 @@
+
diff --git a/SS14.Launcher/App.xaml b/SS14.Launcher/App.xaml
index 07ee32fde..fd15fe1f8 100644
--- a/SS14.Launcher/App.xaml
+++ b/SS14.Launcher/App.xaml
@@ -23,10 +23,11 @@
-
+
+
diff --git a/SS14.Launcher/App.xaml.cs b/SS14.Launcher/App.xaml.cs
index c8fdd5065..fc70d3b6c 100644
--- a/SS14.Launcher/App.xaml.cs
+++ b/SS14.Launcher/App.xaml.cs
@@ -48,7 +48,7 @@ public App(OverrideAssetsManager overrideAssets)
public override void Initialize()
{
- this.EnableHotReload();
+ //this.EnableHotReload();
AvaloniaXamlLoader.Load(this);
LoadBaseAssets();
diff --git a/SS14.Launcher/Localization/LocExtension.cs b/SS14.Launcher/Localization/LocExtension.cs
index 4b3e80567..82e0149af 100644
--- a/SS14.Launcher/Localization/LocExtension.cs
+++ b/SS14.Launcher/Localization/LocExtension.cs
@@ -14,6 +14,11 @@ public LocExtension(string key)
public object ProvideValue(IServiceProvider services)
{
+ if (Key == "server-entry-connect")
+ {
+ return "Connect!";
+ }
+
var locMgr = Locator.Current.GetService()!;
return locMgr.GetString(Key);
}
diff --git a/SS14.Launcher/SS14.Launcher.csproj b/SS14.Launcher/SS14.Launcher.csproj
index 009ee3a00..f3f783d5f 100644
--- a/SS14.Launcher/SS14.Launcher.csproj
+++ b/SS14.Launcher/SS14.Launcher.csproj
@@ -51,6 +51,7 @@
+
diff --git a/SS14.Launcher/Theme/ThemeServerList.axaml b/SS14.Launcher/Theme/ThemeServerList.axaml
index 6298c42ec..04abb56d2 100644
--- a/SS14.Launcher/Theme/ThemeServerList.axaml
+++ b/SS14.Launcher/Theme/ThemeServerList.axaml
@@ -2,23 +2,60 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:loc="clr-namespace:SS14.Launcher.Localization"
xmlns:views="using:SS14.Launcher.Views"
- xmlns:mwt="using:SS14.Launcher.Views.MainWindowTabs">
-
+ xmlns:mwt="using:SS14.Launcher.Views.MainWindowTabs"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:models="clr-namespace:SS14.Launcher.Models"
+ xmlns:vm="clr-namespace:SS14.Launcher.ViewModels.MainWindowTabs"
+ xmlns:controls="clr-namespace:SS14.Launcher.Controls"
+ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
-
diff --git a/SS14.Launcher/ViewModels/MainWindowTabs/ServerEntryViewModel.cs b/SS14.Launcher/ViewModels/MainWindowTabs/ServerEntryViewModel.cs
index 2d6975713..8d9e18921 100644
--- a/SS14.Launcher/ViewModels/MainWindowTabs/ServerEntryViewModel.cs
+++ b/SS14.Launcher/ViewModels/MainWindowTabs/ServerEntryViewModel.cs
@@ -27,6 +27,8 @@ public ServerEntryViewModel(MainWindowViewModel windowVm, ServerStatusData cache
_windowVm = windowVm;
_cacheData = cacheData;
_serverSource = serverSource;
+
+ _cacheData.PropertyChanged += OnCacheDataOnPropertyChanged;
}
public ServerEntryViewModel(
@@ -38,6 +40,8 @@ public ServerEntryViewModel(
: this(windowVm, cacheData, serverSource, cfg)
{
Favorite = favorite;
+
+ _cacheData.PropertyChanged += OnCacheDataOnPropertyChanged;
}
public ServerEntryViewModel(
diff --git a/SS14.Launcher/Views/MainWindow.xaml b/SS14.Launcher/Views/MainWindow.xaml
index da4ebe952..9c09ab757 100644
--- a/SS14.Launcher/Views/MainWindow.xaml
+++ b/SS14.Launcher/Views/MainWindow.xaml
@@ -4,7 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:views="clr-namespace:SS14.Launcher.Views"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
- MinWidth="800" MinHeight="500"
+ MinWidth="1" MinHeight="500"
Width="650" Height="400"
x:Class="SS14.Launcher.Views.MainWindow"
Icon="{DynamicResource WindowIcon}"
diff --git a/SS14.Launcher/Views/MainWindowContent.xaml b/SS14.Launcher/Views/MainWindowContent.xaml
index b14b5e3a4..2e718e996 100644
--- a/SS14.Launcher/Views/MainWindowContent.xaml
+++ b/SS14.Launcher/Views/MainWindowContent.xaml
@@ -53,7 +53,7 @@
+ SelectedIndex="{Binding SelectedIndex,Mode=TwoWay}">
diff --git a/SS14.Launcher/Views/MainWindowTabs/HomePageView.xaml b/SS14.Launcher/Views/MainWindowTabs/HomePageView.xaml
index 7a1f56785..573ff775d 100644
--- a/SS14.Launcher/Views/MainWindowTabs/HomePageView.xaml
+++ b/SS14.Launcher/Views/MainWindowTabs/HomePageView.xaml
@@ -14,7 +14,7 @@
-
+
@@ -36,10 +36,13 @@
-
+
-
+
+
diff --git a/SS14.Launcher/Views/MainWindowTabs/ServerEntryView.xaml b/SS14.Launcher/Views/MainWindowTabs/ServerEntryView.xaml
index bf3aec63a..704dae9ab 100644
--- a/SS14.Launcher/Views/MainWindowTabs/ServerEntryView.xaml
+++ b/SS14.Launcher/Views/MainWindowTabs/ServerEntryView.xaml
@@ -4,7 +4,6 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mainWindowTabs="clr-namespace:SS14.Launcher.ViewModels.MainWindowTabs"
xmlns:models="clr-namespace:SS14.Launcher.Models"
- xmlns:controls="clr-namespace:SS14.Launcher.Controls"
xmlns:views="clr-namespace:SS14.Launcher.Views"
xmlns:loc="clr-namespace:SS14.Launcher.Localization"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
@@ -13,95 +12,60 @@
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
+
-
-
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
diff --git a/SS14.Launcher/Views/MainWindowTabs/ServerList.xaml b/SS14.Launcher/Views/MainWindowTabs/ServerList.xaml
new file mode 100644
index 000000000..9c752383d
--- /dev/null
+++ b/SS14.Launcher/Views/MainWindowTabs/ServerList.xaml
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SS14.Launcher/Views/MainWindowTabs/ServerList.xaml.cs b/SS14.Launcher/Views/MainWindowTabs/ServerList.xaml.cs
index fd611416e..d8bf2a147 100644
--- a/SS14.Launcher/Views/MainWindowTabs/ServerList.xaml.cs
+++ b/SS14.Launcher/Views/MainWindowTabs/ServerList.xaml.cs
@@ -1,16 +1,48 @@
using System;
+using System.Collections;
using Avalonia;
-using Avalonia.Controls.Primitives;
-using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
using Avalonia.Controls;
-using Avalonia.Metadata;
-using Serilog;
+using Avalonia.Controls.Presenters;
+using Avalonia.LogicalTree;
using SS14.Launcher.ViewModels.MainWindowTabs;
namespace SS14.Launcher.Views.MainWindowTabs;
-public sealed partial class ServerList : TemplatedControl
+public sealed partial class ServerList : UserControl
{
+ public ServerList()
+ {
+ InitializeComponent();
+
+ MyDataGrid.PointerReleased += (sender, args) =>
+ {
+ if (sender is not DataGrid)
+ {
+ Console.WriteLine(sender);
+ MyDataGrid.SelectedItem = null;
+ }
+ else
+ {
+ Console.WriteLine(sender);
+ }
+ };
+
+ MyDataGrid.SelectionChanged += (_, args) =>
+ {
+ foreach (ServerEntryViewModel rem in args.RemovedItems)
+ {
+ rem.IsExpanded = false;
+ }
+
+ foreach (ServerEntryViewModel add in args.AddedItems)
+ {
+ add.IsExpanded = true;
+ }
+ };
+ }
+
public static readonly DirectProperty ShowHeaderProperty =
AvaloniaProperty.RegisterDirect(
nameof(ShowHeader),
@@ -60,32 +92,12 @@ public bool SpinnerVisible
set => SetAndRaise(SpinnerVisibleProperty, ref _spinnerVisible, value);
}
- public static readonly DirectProperty> ListProperty =
- AvaloniaProperty.RegisterDirect>(
- nameof(List),
- o => o.List,
- (o, v) => o.List = v
- );
-
- private IReadOnlyCollection _serverList = Array.Empty();
-
- public IReadOnlyCollection List
- {
- get => _serverList;
- set => SetAndRaise(ListProperty, ref _serverList, value);
- }
-
- public static readonly StyledProperty