0
0
mirror of https://github.com/sp-tarkov/launcher.git synced 2025-02-13 09:50:43 -05:00
launcher/project/Aki.Launcher/Attributes/RequireServerConnected.cs

20 lines
672 B
C#
Raw Normal View History

2023-03-03 19:25:33 +00:00
using Aki.Launcher.Helpers;
using Aki.Launcher.Models;
using Aki.Launcher.ViewModels;
using ReactiveUI;
namespace Aki.Launcher.Attributes
{
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));
}
}
}