Server Monitor Changes

- fixed the display of the map name.
- added the ports as a grid column.
- language file update
This commit is contained in:
Brett Hewitson 2022-06-22 22:53:41 +10:00
parent 09659d9ae2
commit f51e92c5a2
17 changed files with 175 additions and 51 deletions

View file

@ -412,6 +412,7 @@
<sys:String x:Key="ServerMonitor_SelectedColumnLabel">Selected</sys:String>
<sys:String x:Key="ServerMonitor_ProfileColumnLabel">Profile</sys:String>
<sys:String x:Key="ServerMonitor_ServerColumnLabel">Server</sys:String>
<sys:String x:Key="ServerMonitor_PortsColumnLabel">Ports</sys:String>
<sys:String x:Key="ServerMonitor_MapColumnLabel">Map</sys:String>
<sys:String x:Key="ServerMonitor_ModsColumnLabel">Mods</sys:String>
<sys:String x:Key="ServerMonitor_VersionColumnLabel">Version</sys:String>

View file

@ -193,6 +193,7 @@ namespace ServerManagerTool.Lib
{
SetValue(ServerPortProperty, value);
ServerPeerPort = value + 1;
UpdatePortsString();
}
}
@ -201,7 +202,11 @@ namespace ServerManagerTool.Lib
public int ServerPeerPort
{
get { return (int)GetValue(ServerPeerPortProperty); }
set { SetValue(ServerPeerPortProperty, value); }
set
{
SetValue(ServerPeerPortProperty, value);
UpdatePortsString();
}
}
public static readonly DependencyProperty QueryPortProperty = DependencyProperty.Register(nameof(QueryPort), typeof(int), typeof(ServerProfile), new PropertyMetadata(27015));
@ -210,7 +215,18 @@ namespace ServerManagerTool.Lib
public int QueryPort
{
get { return (int)GetValue(QueryPortProperty); }
set { SetValue(QueryPortProperty, value); }
set
{
SetValue(QueryPortProperty, value);
UpdatePortsString();
}
}
public static readonly DependencyProperty PortsStringProperty = DependencyProperty.Register(nameof(PortsString), typeof(string), typeof(ServerProfile), new PropertyMetadata(String.Empty));
public string PortsString
{
get { return (string)GetValue(PortsStringProperty); }
set { SetValue(PortsStringProperty, value); }
}
public static readonly DependencyProperty ServerMapProperty = DependencyProperty.Register(nameof(ServerMap), typeof(string), typeof(ServerProfile), new PropertyMetadata(String.Empty));
@ -1201,6 +1217,11 @@ namespace ServerManagerTool.Lib
return true;
}
public void UpdatePortsString()
{
this.PortsString = $"{this.ServerPort}, {this.ServerPeerPort}, {this.QueryPort}";
}
public bool UpdateSchedules()
{
SaveLauncher();
@ -1532,6 +1553,8 @@ namespace ServerManagerTool.Lib
this.ClearValue(ServerPeerPortProperty);
this.ClearValue(QueryPortProperty);
UpdatePortsString();
this.ClearValue(ServerMapProperty);
this.ClearValue(ServerMapSaveFileNameProperty);
this.ClearValue(ServerModIdsProperty);

View file

@ -16,7 +16,7 @@ namespace ServerManagerTool.Lib.ViewModel
if (valueString == null)
return string.Empty;
var name = GlobalizedApplication.Instance.GetResourceString(valueString);
var name = GlobalizedApplication.Instance.GetResourceString($"Map_{valueString}");
if (!string.IsNullOrWhiteSpace(name))
return name;
@ -27,7 +27,7 @@ namespace ServerManagerTool.Lib.ViewModel
var mapName = ModUtils.GetMapName(valueString);
// check if the name is stored in the globalization file
name = GlobalizedApplication.Instance.GetResourceString(mapName);
name = GlobalizedApplication.Instance.GetResourceString($"Map_{mapName}");
if (!string.IsNullOrWhiteSpace(name))
return name;

View file

@ -524,13 +524,13 @@
</Button>
<Label Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Content="{DynamicResource ServerSettings_ServerPortLabel}" ToolTip="{DynamicResource ServerSettings_ServerPortTooltip}" Foreground="{DynamicResource UnSyncedSetting}"/>
<TextBox Grid.Row="1" Grid.Column="1" Margin="1" Width="100" VerticalContentAlignment="Center" HorizontalAlignment="Left" Text="{Binding ServerPort, Mode=TwoWay, Converter={cc:IntRangeValueConverter 1, 65535}, UpdateSourceTrigger=PropertyChanged, NotifyOnSourceUpdated=True}" SourceUpdated="ServerPort_SourceUpdated" ToolTip="{DynamicResource ServerSettings_ServerPortTooltip}"/>
<TextBox Grid.Row="1" Grid.Column="1" Margin="1" Width="100" VerticalContentAlignment="Center" HorizontalAlignment="Left" Text="{Binding ServerPort, Mode=TwoWay, Converter={cc:IntRangeValueConverter 1, 65535}, UpdateSourceTrigger=PropertyChanged, NotifyOnSourceUpdated=True}" SourceUpdated="Ports_SourceUpdated" ToolTip="{DynamicResource ServerSettings_ServerPortTooltip}"/>
<Label Grid.Row="1" Grid.Column="2" VerticalAlignment="Center" Content="{DynamicResource ServerSettings_ServerPeerPortLabel}" ToolTip="{DynamicResource ServerSettings_ServerPeerPortTooltip}" Foreground="{DynamicResource UnSyncedSetting}"/>
<TextBox Grid.Row="1" Grid.Column="3" Margin="1" Width="100" VerticalContentAlignment="Center" HorizontalAlignment="Left" Text="{Binding ServerPeerPort}" ToolTip="{DynamicResource ServerSettings_ServerPeerPortTooltip}" IsEnabled="False"/>
<Label Grid.Row="1" Grid.Column="4" VerticalAlignment="Center" Content="{DynamicResource ServerSettings_QueryPortLabel}" ToolTip="{DynamicResource ServerSettings_QueryPortTooltip}" Foreground="{DynamicResource UnSyncedSetting}"/>
<TextBox Grid.Row="1" Grid.Column="5" Margin="1" Width="100" VerticalContentAlignment="Center" HorizontalAlignment="Left" Text="{Binding QueryPort, Converter={cc:IntRangeValueConverter 1, 65535}}" ToolTip="{DynamicResource ServerSettings_QueryPortTooltip}"/>
<TextBox Grid.Row="1" Grid.Column="5" Margin="1" Width="100" VerticalContentAlignment="Center" HorizontalAlignment="Left" Text="{Binding QueryPort, Converter={cc:IntRangeValueConverter 1, 65535}, UpdateSourceTrigger=PropertyChanged, NotifyOnSourceUpdated=True}" SourceUpdated="Ports_SourceUpdated" ToolTip="{DynamicResource ServerSettings_QueryPortTooltip}"/>
</Grid>
</GroupBox>

View file

@ -1026,10 +1026,11 @@ namespace ServerManagerTool
Settings.ValidateServerName();
}
private void ServerPort_SourceUpdated(object sender, DataTransferEventArgs e)
private void Ports_SourceUpdated(object sender, DataTransferEventArgs e)
{
// force the porperty to be updated.
// force the property to be updated.
Settings.ServerPort = Settings.ServerPort;
Settings.UpdatePortsString();
}
private void MapName_SourceUpdated(object sender, DataTransferEventArgs e)

View file

@ -20,6 +20,7 @@
<br/>
<ul>
<li>Availability Status - Changed the Waiting for Publication status into two new statuses, to clarify the issue.</li>
<li>Server Monitor - Added a Ports column that shows the main server ports.</li>
<li>3rd Party Libraries - updated all library to latest versions.</li>
</ul>
</p>

View file

@ -20,6 +20,7 @@
<br/>
<ul>
<li>Availability Status - Changed the Waiting for Publication status into two new statuses, to clarify the issue.</li>
<li>Server Monitor - Added a Ports column that shows the main server ports.</li>
</ul>
</p>
</div>

View file

@ -4,14 +4,14 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:tb="http://www.hardcodet.net/taskbar"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:sm="clr-namespace:ServerManagerTool"
xmlns:cctl="clr-namespace:ServerManagerTool.Common.Controls;assembly=ServerManager.Common"
xmlns:clib="clr-namespace:ServerManagerTool.Common.Lib;assembly=ServerManager.Common"
xmlns:ce="clr-namespace:ServerManagerTool.Common.Enums;assembly=ServerManager.Common"
xmlns:com="clr-namespace:ServerManagerTool.Common;assembly=ServerManager.Common"
xmlns:controls="clr-namespace:ServerManagerTool.Common.Controls;assembly=ServerManager.Common"
xmlns:ce="clr-namespace:ServerManagerTool.Common.Enums;assembly=ServerManager.Common"
xmlns:clib="clr-namespace:ServerManagerTool.Common.Lib;assembly=ServerManager.Common"
xmlns:com="clr-namespace:ServerManagerTool.Common;assembly=ServerManager.Common"
xmlns:vm="clr-namespace:ServerManagerTool.Lib.ViewModel"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
mc:Ignorable="d"
MinWidth="600" MinHeight="500" Width="900" Height="500" Left="50" Top="50" ResizeMode="CanResize"
Loaded="ServerMonitorWindow_Loaded" SizeChanged="ServerMonitorWindow_SizeChanged" StateChanged="ServerMonitorWindow_StateChanged" LocationChanged="ServerMonitorWindow_LocationChanged"
@ -275,7 +275,7 @@
</DataGridTemplateColumn.CellStyle>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="Auto" MinWidth="100">
<DataGridTemplateColumn Width="Auto" MinWidth="50">
<DataGridTemplateColumn.Header>
<TextBlock Text="{DynamicResource ServerMonitor_MapColumnLabel}" />
</DataGridTemplateColumn.Header>
@ -292,6 +292,23 @@
</DataGridTemplateColumn.CellStyle>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="Auto" MinWidth="50">
<DataGridTemplateColumn.Header>
<TextBlock Text="{DynamicResource ServerMonitor_PortsColumnLabel}" />
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Label Content="{Binding Profile.PortsString}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellStyle>
<Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</DataGridTemplateColumn.CellStyle>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="Auto" MinWidth="50">
<DataGridTemplateColumn.Header>
<TextBlock Text="{DynamicResource ServerMonitor_ModsColumnLabel}" />
@ -309,7 +326,7 @@
</DataGridTemplateColumn.CellStyle>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="Auto" MinWidth="80">
<DataGridTemplateColumn Width="Auto" MinWidth="50">
<DataGridTemplateColumn.Header>
<TextBlock Text="{DynamicResource ServerMonitor_VersionColumnLabel}" />
</DataGridTemplateColumn.Header>
@ -326,7 +343,7 @@
</DataGridTemplateColumn.CellStyle>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="Auto" MinWidth="80">
<DataGridTemplateColumn Width="Auto" MinWidth="50">
<DataGridTemplateColumn.Header>
<TextBlock Text="{DynamicResource ServerMonitor_PlayersColumnLabel}" />
</DataGridTemplateColumn.Header>