mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
188 lines
14 KiB
XML
188 lines
14 KiB
XML
<Window x:Class="ServerManagerTool.PlayerListWindow"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:cc="clr-namespace:ServerManagerTool.Common.Converters;assembly=ServerManager.Common"
|
|
xmlns:clib="clr-namespace:ServerManagerTool.Common.Lib;assembly=ServerManager.Common"
|
|
xmlns:com="clr-namespace:ServerManagerTool.Common;assembly=ServerManager.Common"
|
|
xmlns:en="clr-namespace:ServerManagerTool.Enums"
|
|
xmlns:rcon="clr-namespace:ServerManagerTool.Lib.ViewModel.RCON"
|
|
MinWidth="300" MinHeight="200" Width="300" Height="500" ResizeMode="CanResizeWithGrip" WindowStyle="ToolWindow"
|
|
SizeChanged="Window_SizeChanged" LocationChanged="Window_LocationChanged"
|
|
Name="PlayerList" Icon="../Art/favicon.ico" Title="{Binding PlayerListParameters.WindowTitle}">
|
|
<Window.Resources>
|
|
<ResourceDictionary>
|
|
<ResourceDictionary.MergedDictionaries>
|
|
<ResourceDictionary Source="..\Globalization\en-US\en-US.xaml"/>
|
|
<ResourceDictionary Source="..\Styles\Default.xaml"/>
|
|
</ResourceDictionary.MergedDictionaries>
|
|
|
|
<cc:EnumConverter x:Key="EnumConverter"/>
|
|
<cc:EnumFlagsConverter x:Key="EnumFlagsConverter"/>
|
|
<cc:IsNullOrWhiteSpaceValueConverter x:Key="IsNullOrWhiteSpaceValueConverter"/>
|
|
<cc:IsNullValueConverter x:Key="IsNullValueConverter"/>
|
|
<cc:NullValueConverter x:Key="NullValueConverter"/>
|
|
|
|
<SolidColorBrush x:Key="HeaderBrush" Color="#FFF0F0F0"/>
|
|
|
|
<Style x:Key="PlayerStatus" TargetType="Border">
|
|
<Setter Property="BorderBrush" Value="Gray"/>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding IsOnline}" Value="True">
|
|
<Setter Property="BorderBrush" Value="LightGreen"/>
|
|
</DataTrigger>
|
|
<MultiDataTrigger>
|
|
<MultiDataTrigger.Conditions>
|
|
<Condition Binding="{Binding IsOnline}" Value="False" />
|
|
<Condition Binding="{Binding IsValid}" Value="False" />
|
|
</MultiDataTrigger.Conditions>
|
|
<Setter Property="BorderBrush" Value="Orange"/>
|
|
</MultiDataTrigger>
|
|
<MultiDataTrigger>
|
|
<MultiDataTrigger.Conditions>
|
|
<Condition Binding="{Binding IsOnline}" Value="False" />
|
|
<Condition Binding="{Binding IsWhitelisted}" Value="True" />
|
|
</MultiDataTrigger.Conditions>
|
|
<Setter Property="BorderBrush" Value="#0066CC"/>
|
|
</MultiDataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
<Style x:Key="PlayerName" TargetType="Label">
|
|
<Setter Property="Content" Value="{Binding PlayerName}"/>
|
|
<Setter Property="ToolTip" Value="{Binding PlayerId}"/>
|
|
<Setter Property="Background" Value="AliceBlue"/>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding IsAdmin}" Value="True">
|
|
<Setter Property="FontWeight" Value="Bold"/>
|
|
<Setter Property="Foreground" Value="#0066CC"/>
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding IsAdmin}" Value="False">
|
|
<Setter Property="FontStyle" Value="Normal"/>
|
|
<Setter Property="Foreground" Value="Black"/>
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
<Style x:Key="TribeName" TargetType="Label">
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding TribeName, Converter={StaticResource IsNullOrWhiteSpaceValueConverter}}" Value="True">
|
|
<Setter Property="Content" Value="No tribe"/>
|
|
<Setter Property="FontStyle" Value="Italic"/>
|
|
<Setter Property="Foreground" Value="LightGray"/>
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding TribeName, Converter={StaticResource IsNullOrWhiteSpaceValueConverter}}" Value="False">
|
|
<Setter Property="Content" Value="{Binding PlayerData.Tribe.Name}"/>
|
|
<Setter Property="FontStyle" Value="Normal"/>
|
|
<Setter Property="Foreground" Value="Black"/>
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</ResourceDictionary>
|
|
</Window.Resources>
|
|
|
|
<Grid Background="{StaticResource GradientBackground}">
|
|
<DockPanel x:Name="dockPanel">
|
|
<Border DockPanel.Dock="Top" BorderThickness="1" BorderBrush="LightGray" Margin="2" Background="{StaticResource HeaderBrush}">
|
|
<DockPanel Margin="2,2,2,1" LastChildFill="False">
|
|
<StackPanel Orientation="Horizontal" DockPanel.Dock="Left">
|
|
<Menu VerticalAlignment="Center" Margin="1" Background="{StaticResource HeaderBrush}">
|
|
<MenuItem Header="{DynamicResource PlayerList_Menu_Players}">
|
|
<MenuItem Header="{DynamicResource PlayerList_Menu_Sort}">
|
|
<MenuItem Header="{DynamicResource PlayerList_Menu_SortName}" IsCheckable="True" Command="{Binding SortPlayersCommand}" CommandParameter="{x:Static en:PlayerSortType.Name}" IsChecked="{Binding PlayerSorting, Converter={StaticResource EnumConverter}, ConverterParameter=Name}"/>
|
|
<MenuItem Header="{DynamicResource PlayerList_Menu_SortTribe}" IsCheckable="True" Command="{Binding SortPlayersCommand}" CommandParameter="{x:Static en:PlayerSortType.Tribe}" IsChecked="{Binding PlayerSorting, Converter={StaticResource EnumConverter}, ConverterParameter=Tribe}"/>
|
|
<MenuItem Header="{DynamicResource PlayerList_Menu_SortLastUpdated}" IsCheckable="True" Command="{Binding SortPlayersCommand}" CommandParameter="{x:Static en:PlayerSortType.LastUpdated}" IsChecked="{Binding PlayerSorting, Converter={StaticResource EnumConverter}, ConverterParameter=LastUpdated}"/>
|
|
</MenuItem>
|
|
<MenuItem Header="{DynamicResource PlayerList_Menu_Filter}">
|
|
<MenuItem Header="{DynamicResource PlayerList_Menu_FilterOffline}" IsCheckable="True" Command="{Binding FilterPlayersCommand}" CommandParameter="{x:Static en:PlayerFilterType.Offline}" IsChecked="{Binding PlayerFiltering, Converter={StaticResource EnumFlagsConverter}, ConverterParameter=Offline, Mode=OneWay}"/>
|
|
<MenuItem Header="{DynamicResource PlayerList_Menu_FilterAdmin}" IsCheckable="True" Command="{Binding FilterPlayersCommand}" CommandParameter="{x:Static en:PlayerFilterType.Admin}" IsChecked="{Binding PlayerFiltering, Converter={StaticResource EnumFlagsConverter}, ConverterParameter=Admin, Mode=OneWay}"/>
|
|
<MenuItem Header="{DynamicResource PlayerList_Menu_FilterWhitelisted}" IsCheckable="True" Command="{Binding FilterPlayersCommand}" CommandParameter="{x:Static en:PlayerFilterType.Whitelisted}" IsChecked="{Binding PlayerFiltering, Converter={StaticResource EnumFlagsConverter}, ConverterParameter=Whitelisted, Mode=OneWay}"/>
|
|
<MenuItem Header="{DynamicResource PlayerList_Menu_FilterInvalid}" IsCheckable="True" Command="{Binding FilterPlayersCommand}" CommandParameter="{x:Static en:PlayerFilterType.Invalid}" IsChecked="{Binding PlayerFiltering, Converter={StaticResource EnumFlagsConverter}, ConverterParameter=Invalid, Mode=OneWay}"/>
|
|
</MenuItem>
|
|
</MenuItem>
|
|
</Menu>
|
|
</StackPanel>
|
|
</DockPanel>
|
|
</Border>
|
|
|
|
<DockPanel DockPanel.Dock="Right" MinWidth="200" Margin="1,1,2,1" DataContext="{Binding}">
|
|
<DockPanel DockPanel.Dock="Top">
|
|
<Label DockPanel.Dock="Left" Content="{DynamicResource General_FilterLabel}" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
|
<Button DockPanel.Dock="Right" Margin="5,0,5,0" Width="22" Height="22" HorizontalAlignment="Right" VerticalAlignment="Center" Click="FilterPlayerList_Click" ToolTip="{DynamicResource General_FilterButtonTooltip}">
|
|
<Image Source="{com:Icon Path=/Ark Server Manager;component/Art/Filter.ico,Size=32}"/>
|
|
</Button>
|
|
<TextBox DockPanel.Dock="Left" Text="{Binding PlayerListFilterString, Mode=TwoWay}" BorderBrush="LightGray" VerticalAlignment="Center" VerticalContentAlignment="Center" IsTabStop="True" Margin="0" Padding="2"/>
|
|
</DockPanel>
|
|
|
|
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal">
|
|
<Label Content="{DynamicResource PlayerList_ProfileCountLabel}" HorizontalAlignment="Center"/>
|
|
<Label Content="{Binding ServerPlayers.Players.Count, FallbackValue=0}" HorizontalAlignment="Center"/>
|
|
<Label Content="{DynamicResource PlayerList_ProfileInvalidCountLabel}" HorizontalAlignment="Center">
|
|
<Label.Style>
|
|
<Style BasedOn="{StaticResource {x:Type Label}}" TargetType="{x:Type Label}">
|
|
<Setter Property="Foreground" Value="Black"/>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding ServerPlayers.CountInvalidPlayers, FallbackValue=0, Converter={cc:GreaterThanIntValueConverter 0}}" Value="true">
|
|
<Setter Property="Foreground" Value="Red"/>
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</Label.Style>
|
|
</Label>
|
|
<Label Content="{Binding ServerPlayers.CountInvalidPlayers, FallbackValue=0}" HorizontalAlignment="Center">
|
|
<Label.Style>
|
|
<Style BasedOn="{StaticResource {x:Type Label}}" TargetType="{x:Type Label}">
|
|
<Setter Property="Foreground" Value="Black"/>
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding ServerPlayers.CountInvalidPlayers, FallbackValue=0, Converter={cc:GreaterThanIntValueConverter 0}}" Value="true">
|
|
<Setter Property="Foreground" Value="Red"/>
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</Label.Style>
|
|
</Label>
|
|
</StackPanel>
|
|
|
|
<ListBox DockPanel.Dock="Top" ItemsSource="{Binding ServerPlayers.Players}" BorderBrush="LightGray" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
|
|
<ListBox.Resources>
|
|
<clib:BindingProxy x:Key="proxy" Data="{Binding ElementName=PlayerList}"/>
|
|
</ListBox.Resources>
|
|
|
|
<ListBox.ItemContainerStyle>
|
|
<Style TargetType="ListBoxItem">
|
|
<Setter Property="ContextMenu">
|
|
<Setter.Value>
|
|
<ContextMenu>
|
|
<MenuItem Header="{DynamicResource PlayerList_Menu_ViewProfile}" Command="{Binding Source={StaticResource proxy}, Path=Data.ViewPlayerProfileCommand}" CommandParameter="{Binding}" />
|
|
<MenuItem Header="{DynamicResource PlayerList_Menu_ViewTribe}" Command="{Binding Source={StaticResource proxy}, Path=Data.ViewPlayerTribeCommand}" CommandParameter="{Binding}"/>
|
|
<Separator/>
|
|
<MenuItem Header="{DynamicResource PlayerList_Menu_CopyId}" Command="{Binding Source={StaticResource proxy}, Path=Data.CopyIDCommand}" CommandParameter="{Binding}"/>
|
|
<MenuItem Header="{DynamicResource PlayerList_Menu_CopyPlayerId}" Command="{Binding Source={StaticResource proxy}, Path=Data.CopyPlayerIDCommand}" CommandParameter="{Binding}"/>
|
|
</ContextMenu>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
</ListBox.ItemContainerStyle>
|
|
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate DataType="{x:Type rcon:PlayerInfo}">
|
|
<Border BorderThickness="2" Padding="1" Style="{DynamicResource PlayerStatus}">
|
|
<Grid>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="1*"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<StackPanel Grid.Column="1" HorizontalAlignment="Stretch">
|
|
<Label Padding="0,-1,0,-1" Style="{DynamicResource PlayerName}"/>
|
|
<StackPanel Orientation="Horizontal" Margin="0" >
|
|
<Label Content="{Binding CharacterName}" Padding="0,-1,0,-1"/>
|
|
<TextBlock Text="{Binding PlayerData.Level, StringFormat=({0})}" Margin="5,0,0,0" Padding="0,-1,0,-1" />
|
|
</StackPanel>
|
|
<Label Padding="0,-1,0,-1" Style="{DynamicResource TribeName}"/>
|
|
</StackPanel>
|
|
</Grid>
|
|
</Border>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
</DockPanel>
|
|
</DockPanel>
|
|
</Grid>
|
|
</Window>
|