Adds an admin-protocol client (token-authed TCP JSON on 127.0.0.1:AdminPort, reusing the server's .admin-token) that polls connected players and status every 3s, plus Kick/Ban on the selected player and a players/uptime readout.
105 lines
5.1 KiB
XML
105 lines
5.1 KiB
XML
<Window xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:vm="clr-namespace:CommonwealthOnline.Host.ViewModels"
|
|
x:Class="CommonwealthOnline.Host.Views.MainWindow"
|
|
x:DataType="vm:MainWindowViewModel"
|
|
Width="960" Height="700"
|
|
MinWidth="820" MinHeight="600"
|
|
Title="Commonwealth Online — Server Host"
|
|
Background="{StaticResource CoBackgroundBrush}">
|
|
|
|
<Grid RowDefinitions="Auto,*,Auto" Margin="18">
|
|
|
|
<Image Grid.Row="0" Source="/Assets/logo.png" Height="84"
|
|
HorizontalAlignment="Left" Margin="0,0,0,14" />
|
|
|
|
<Grid Grid.Row="1" ColumnDefinitions="330,*">
|
|
|
|
<StackPanel Grid.Column="0" Spacing="9" Margin="0,0,18,0">
|
|
<TextBlock Text="SERVER" Foreground="{StaticResource CoAccentBrush}"
|
|
FontWeight="Bold" FontSize="13" />
|
|
<TextBox Watermark="Server name" Text="{Binding ServerName}" />
|
|
<Grid ColumnDefinitions="*,*">
|
|
<TextBox Grid.Column="0" Watermark="Host" Text="{Binding Host}" Margin="0,0,4,0" />
|
|
<TextBox Grid.Column="1" Watermark="Port" Text="{Binding Port}" Margin="4,0,0,0" />
|
|
</Grid>
|
|
<Grid ColumnDefinitions="*,*">
|
|
<TextBox Grid.Column="0" Watermark="Max players" Text="{Binding MaxPlayers}" Margin="0,0,4,0" />
|
|
<TextBox Grid.Column="1" Watermark="Admin port" Text="{Binding AdminPort}" Margin="4,0,0,0" />
|
|
</Grid>
|
|
<TextBlock Text="LOG VERBOSITY" Foreground="{StaticResource CoAccentBrush}"
|
|
FontWeight="Bold" FontSize="12" Margin="0,4,0,0" />
|
|
<ComboBox HorizontalAlignment="Stretch"
|
|
ItemsSource="{Binding VerbosityOptions}"
|
|
SelectedItem="{Binding LogVerbosity}" />
|
|
<CheckBox Content="Enable GNS transport" IsChecked="{Binding EnableGnsTransport}"
|
|
Foreground="{StaticResource CoTextBrush}" />
|
|
<Button Content="Save config" Command="{Binding SaveCommand}"
|
|
HorizontalAlignment="Stretch" />
|
|
</StackPanel>
|
|
|
|
<Grid Grid.Column="1" RowDefinitions="*,Auto">
|
|
|
|
<Border Grid.Row="0" Background="{StaticResource CoSurfaceBrush}"
|
|
CornerRadius="4" Padding="10">
|
|
<ScrollViewer>
|
|
<ItemsControl ItemsSource="{Binding Log}">
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<TextBlock Text="{Binding}" Foreground="{StaticResource CoTextBrush}"
|
|
FontFamily="Cascadia Mono,Consolas,monospace" FontSize="12"
|
|
TextWrapping="Wrap" />
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</ScrollViewer>
|
|
</Border>
|
|
|
|
<Border Grid.Row="1" Background="{StaticResource CoSurfaceBrush}"
|
|
CornerRadius="4" Padding="10" Margin="0,10,0,0" Height="188">
|
|
<Grid RowDefinitions="Auto,*,Auto">
|
|
<DockPanel Grid.Row="0" Margin="0,0,0,6">
|
|
<TextBlock DockPanel.Dock="Left" Text="PLAYERS"
|
|
Foreground="{StaticResource CoAccentBrush}" FontWeight="Bold" FontSize="12" />
|
|
<TextBlock DockPanel.Dock="Right" Text="{Binding StatsText}"
|
|
Foreground="{StaticResource CoTextBrush}" FontSize="11"
|
|
HorizontalAlignment="Right" />
|
|
</DockPanel>
|
|
<ListBox Grid.Row="1" Background="Transparent"
|
|
ItemsSource="{Binding Players}" SelectedItem="{Binding SelectedPlayer}">
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<TextBlock Text="{Binding Display}" Foreground="{StaticResource CoTextBrush}"
|
|
FontFamily="Cascadia Mono,Consolas,monospace" FontSize="12" />
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
<StackPanel Grid.Row="2" Orientation="Horizontal" Spacing="8" Margin="0,6,0,0">
|
|
<Button Content="Kick" Command="{Binding KickCommand}" Padding="18,4" />
|
|
<Button Content="Ban" Command="{Binding BanCommand}" Padding="18,4"
|
|
Background="{StaticResource CoDangerBrush}" Foreground="White" />
|
|
</StackPanel>
|
|
</Grid>
|
|
</Border>
|
|
|
|
</Grid>
|
|
|
|
</Grid>
|
|
|
|
<Grid Grid.Row="2" ColumnDefinitions="Auto,*,Auto,Auto" Margin="0,14,0,0">
|
|
<TextBlock Grid.Column="0" Text="Status:" Foreground="{StaticResource CoTextBrush}"
|
|
VerticalAlignment="Center" Margin="0,0,6,0" />
|
|
<TextBlock Grid.Column="1" Text="{Binding StatusText}"
|
|
Foreground="{StaticResource CoAccentBrush}" FontWeight="Bold"
|
|
VerticalAlignment="Center" />
|
|
<Button Grid.Column="2" Content="Start" Command="{Binding StartCommand}"
|
|
Margin="0,0,8,0" Padding="26,7"
|
|
Background="{StaticResource CoAccentBrush}" Foreground="#0E120B" FontWeight="Bold" />
|
|
<Button Grid.Column="3" Content="Stop" Command="{Binding StopCommand}"
|
|
Padding="26,7"
|
|
Background="{StaticResource CoDangerBrush}" Foreground="White" FontWeight="Bold" />
|
|
</Grid>
|
|
|
|
</Grid>
|
|
</Window>
|