From 2dfc898e8a2265bf35190a082629ddfa34596689 Mon Sep 17 00:00:00 2001 From: RuKira Date: Fri, 20 Mar 2026 22:48:04 -0400 Subject: [PATCH] Multi Client Support - Needs Update Post Socket to support Multiple "Clients" not in a single Bus. --- RelayClient/App.xaml.cs | 30 ++++++++++-- RelayClient/ChatSimulator.cs | 25 ++++++++++ RelayClient/MainPage.xaml | 64 ++++++++++++++------------ RelayClient/MainPage.xaml.cs | 88 ++++++++++++++++++++++++++++++++---- 4 files changed, 164 insertions(+), 43 deletions(-) create mode 100644 RelayClient/ChatSimulator.cs diff --git a/RelayClient/App.xaml.cs b/RelayClient/App.xaml.cs index 3da581d..0311048 100644 --- a/RelayClient/App.xaml.cs +++ b/RelayClient/App.xaml.cs @@ -1,9 +1,9 @@ -using Microsoft.Extensions.DependencyInjection; - -namespace RelayClient; +namespace RelayClient; public partial class App : Application { + private bool _openedSecondWindow; + public App() { InitializeComponent(); @@ -11,6 +11,28 @@ public partial class App : Application protected override Window CreateWindow(IActivationState? activationState) { - return new Window(new AppShell()); + var keeperWindow = new Window(new MainPage("Keeper317")) + { + Title = "Relay Client - Keeper317" + }; + + keeperWindow.Created += KeeperWindow_Created; + + return keeperWindow; + } + + private void KeeperWindow_Created(object? sender, EventArgs e) + { + if (_openedSecondWindow) + return; + + _openedSecondWindow = false; + + var kiraWindow = new Window(new MainPage("Ru_Kira")) + { + Title = "Relay Client - Ru_Kira" + }; + + Current?.OpenWindow(kiraWindow); } } \ No newline at end of file diff --git a/RelayClient/ChatSimulator.cs b/RelayClient/ChatSimulator.cs new file mode 100644 index 0000000..21771b5 --- /dev/null +++ b/RelayClient/ChatSimulator.cs @@ -0,0 +1,25 @@ +namespace RelayClient; + +public static class ChatSimulator +{ + public static event Action? MessageSent; + + public static void Send(string senderUsername, string text) + { + var message = new ChatMessage + { + SenderUsername = senderUsername, + Text = text, + Timestamp = DateTime.Now + }; + + MessageSent?.Invoke(message); + } +} + +public sealed class ChatMessage +{ + public required string SenderUsername { get; set; } + public required string Text { get; set; } + public required DateTime Timestamp { get; set; } +} \ No newline at end of file diff --git a/RelayClient/MainPage.xaml b/RelayClient/MainPage.xaml index f8b87d0..18006dc 100644 --- a/RelayClient/MainPage.xaml +++ b/RelayClient/MainPage.xaml @@ -1,36 +1,40 @@  - + - - - + -