2024-05-21 20:15:19 +01:00
|
|
|
|
using SPT.Launcher.Helpers;
|
|
|
|
|
using SPT.Launcher.Models;
|
|
|
|
|
using SPT.Launcher.ViewModels;
|
2023-03-03 19:25:33 +00:00
|
|
|
|
using ReactiveUI;
|
|
|
|
|
|
2024-05-21 20:15:19 +01:00
|
|
|
|
namespace SPT.Launcher.Attributes
|
2023-03-03 19:25:33 +00:00
|
|
|
|
{
|
|
|
|
|
public class RequireServerConnected : NavigationPreCondition
|
|
|
|
|
{
|
|
|
|
|
public override NavigationPreConditionResult TestPreCondition(IScreen Host)
|
|
|
|
|
{
|
|
|
|
|
if (ServerManager.PingServer()) return NavigationPreConditionResult.FromSuccess();
|
|
|
|
|
|
|
|
|
|
string error = string.Format(LocalizationProvider.Instance.server_unavailable_format_1, LauncherSettingsProvider.Instance.Server.Name);
|
|
|
|
|
|
|
|
|
|
return NavigationPreConditionResult.FromError(error, new ConnectServerViewModel(Host));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|