Added better status detection for stopping servers

This commit is contained in:
Brett Hewitson 2021-12-20 18:37:11 +10:00
parent 034a6228d7
commit 3c822fa982
14 changed files with 183 additions and 46 deletions

View file

@ -433,7 +433,7 @@
<Setter Property="ToolTip" Value="{DynamicResource ServerSettings_RuntimeStatusRunningLabel}"/>
</DataTrigger>
<DataTrigger Binding="{Binding Runtime.Status}" Value="{x:Static enum:ServerStatus.Stopping}">
<Setter Property="Source" Value="{com:Icon Path=/ConanServerManager;component/Art/StatusOn.ico,Size=32}"/>
<Setter Property="Source" Value="{com:Icon Path=/ConanServerManager;component/Art/StatusStarting.ico,Size=32}"/>
<Setter Property="ToolTip" Value="{DynamicResource ServerSettings_RuntimeStatusStoppingLabel}"/>
</DataTrigger>
<DataTrigger Binding="{Binding Runtime.Status}" Value="{x:Static enum:ServerStatus.Stopped}">

View file

@ -1,17 +1,16 @@
using ServerManagerTool.Common;
using ServerManagerTool.Common.Utils;
using ServerManagerTool.Enums;
using ServerManagerTool.Lib;
using ServerManagerTool.Plugin.Common;
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using ServerManagerTool.Common;
using ServerManagerTool.Common.Utils;
using ServerManagerTool.Enums;
using ServerManagerTool.Lib;
using ServerManagerTool.Plugin.Common;
using WPFSharp.Globalizer;
using static ServerManagerTool.Lib.ServerApp;
namespace ServerManagerTool
{
@ -228,6 +227,13 @@ namespace ServerManagerTool
SendAlerts = true,
ServerProcess = RestartServer ? ServerProcessType.Restart : ServerProcessType.Shutdown,
ProgressCallback = (p, m, n) => { TaskUtils.RunOnUIThreadAsync(() => { this.AddMessage(m, n); }).DoNotWait(); },
ServerStatusChangeCallback = (ServerStatus serverStatus) =>
{
TaskUtils.RunOnUIThreadAsync(() =>
{
Server.Runtime.UpdateServerStatus(serverStatus, serverStatus != ServerStatus.Unknown);
}).Wait();
}
};
// if restarting the serverm, then check and update the public IP address