mirror of
https://github.com/Myxelium/BeetleWire_UI.git
synced 2026-04-09 06:09:38 +00:00
59 lines
1.8 KiB
C#
59 lines
1.8 KiB
C#
using BeetleWire_UI.Pages;
|
|
using BeetleWire_UI.Services;
|
|
using Microsoft.UI.Xaml;
|
|
using Microsoft.UI.Xaml.Controls;
|
|
|
|
namespace BeetleWire_UI;
|
|
|
|
public sealed partial class MainWindow : Window
|
|
{
|
|
public MainWindow()
|
|
{
|
|
this.InitializeComponent();
|
|
ExtendsContentIntoTitleBar = true;
|
|
|
|
ContentFrame.Navigate(typeof(ClientPage), this);
|
|
}
|
|
|
|
private void NavView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
|
|
{
|
|
if (args.SelectedItemContainer is NavigationViewItem selectedItem)
|
|
{
|
|
var tag = selectedItem.Tag.ToString();
|
|
switch (tag)
|
|
{
|
|
case "client":
|
|
ContentFrame.Navigate(typeof(ClientPage), this);
|
|
break;
|
|
case "server":
|
|
ContentFrame.Navigate(typeof(ServerPage), this);
|
|
break;
|
|
case "connections":
|
|
ContentFrame.Navigate(typeof(ConnectionsPage));
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void StopServerButton_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
ConnectionManager.Instance.StopServer();
|
|
ServerStatusPanel.Visibility = Visibility.Collapsed;
|
|
}
|
|
|
|
private void DisconnectClientButton_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
ConnectionManager.Instance.DisconnectClient();
|
|
ClientStatusPanel.Visibility = Visibility.Collapsed;
|
|
}
|
|
|
|
public void UpdateServerStatus(bool isRunning)
|
|
{
|
|
ServerStatusPanel.Visibility = isRunning ? Visibility.Visible : Visibility.Collapsed;
|
|
}
|
|
|
|
public void UpdateClientStatus(bool isConnected)
|
|
{
|
|
ClientStatusPanel.Visibility = isConnected ? Visibility.Visible : Visibility.Collapsed;
|
|
}
|
|
} |