mirror of
https://github.com/sp-tarkov/launcher.git
synced 2025-02-13 09:30:45 -05:00
20 lines
672 B
C#
20 lines
672 B
C#
using SPT.Launcher.Helpers;
|
|
using SPT.Launcher.Models;
|
|
using SPT.Launcher.ViewModels;
|
|
using ReactiveUI;
|
|
|
|
namespace SPT.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));
|
|
}
|
|
}
|
|
}
|