public async Task <object> CommandRunGameExecute(object parameter) { startingGame = true; CommandManager.InvalidateRequerySuggested(); IWinAPI winApi = trackerFactory.GetWinAPI(); bool isLauncherRunning = winApi.IsLauncherProcessRunning(); if (winApi.GetEslProcess() == null && !winApi.IsLauncherProcessRunning()) { System.Diagnostics.Process.Start("bethesdanet://run/5"); trackerFactory.GetMessanger().Send(new ApplicationShowBalloonTip("ESL Tracker", "Starting game...")); await Task.Delay(TimeSpan.FromSeconds(60)); //wait 10 sec if (winApi.GetEslProcess() == null) { trackerFactory.GetMessanger().Send(new ApplicationShowBalloonTip("ESL Tracker", "There is probelm staring game, please check Bethesda.net Laucher.")); } } else if (trackerFactory.GetWinAPI().IsLauncherProcessRunning()) { trackerFactory.GetMessanger().Send(new ApplicationShowBalloonTip("ESL Tracker", "Bethesda.net Laucher is running - use it to start game.")); } else { trackerFactory.GetMessanger().Send(new ApplicationShowBalloonTip("ESL Tracker", "Game is already running")); } startingGame = false; CommandManager.InvalidateRequerySuggested(); return(null); }
public async Task <Process> StartGame(IWinAPI winApi, IMessenger messanger) { bool isLauncherRunning = winApi.IsLauncherProcessRunning(); Process proc = null; if (winApi.GetEslProcess() == null) { proc = LaunchGameFromPlatform(); if (proc != null) { var launcher = proc.StartInfo.FileName.Substring(0, proc.StartInfo.FileName.IndexOf(":", StringComparison.InvariantCulture)); messanger.Send(new ApplicationShowBalloonTip("ESL Tracker", "Starting game using " + launcher)); await Task.Delay(TimeSpan.FromSeconds(60)); //wait 10 sec if (winApi.GetEslProcess() == null) { messanger.Send(new ApplicationShowBalloonTip("ESL Tracker", "There is problem staring game, please check " + launcher)); } } else { messanger.Send(new ApplicationShowBalloonTip("ESL Tracker", "No installed launcher detected (BethesdaNet or Steam).")); } } else { messanger.Send(new ApplicationShowBalloonTip("ESL Tracker", "Game is already running")); } return(proc); }
private bool CommandRunGameCanExecute(object arg) { return((!startingGame) && (winApi.GetEslProcess() == null)); }
private bool CommandRunGameCanExecute(object arg) { IWinAPI winApi = trackerFactory.GetWinAPI(); return(!startingGame && winApi.GetEslProcess() == null); }