private async void Application_Startup(object sender, StartupEventArgs e) { CreateCommonObjects(); // Apply appearence theme ApplyThemeSetting(); if (e.Args.Length == 1) { var selectedFile = e.Args[0]; // 0 = directly play, 1 = open in replaybook if (_settingsManager.Settings.FileAction == Settings.Models.FileAction.Play) { StartDialogHost(); await _player.PlayReplay(selectedFile).ConfigureAwait(true); Application.Current.Shutdown(); } else if (_settingsManager.Settings.FileAction == Settings.Models.FileAction.Open) { StartSingleReplayWindow(selectedFile); } else { } } else { StartMainWindow(); } }
private async void Application_Startup(object sender, StartupEventArgs e) { CreateCommonObjects(); // Apply appearence theme ApplyThemeSetting(); // Apply language setting LanguageHelper.SetProgramLanguage(_settingsManager.Settings.ProgramLanguage); // Load data RuneHelper.LoadRunes(_settingsManager.Settings.ProgramLanguage); #if DEBUG _log.Error("Debug mode, writing log"); #endif if (e.Args.Length == 1) { var selectedFile = e.Args[0]; // 0 = directly play, 1 = open in replaybook if (_settingsManager.Settings.FileAction == Settings.Models.FileAction.Play) { StartDialogHost(); await _player.PlayReplay(selectedFile).ConfigureAwait(true); Application.Current.Shutdown(); } else if (_settingsManager.Settings.FileAction == Settings.Models.FileAction.Open) { StartSingleReplayWindow(selectedFile); } else { } } else { StartMainWindow(); } }
public async Task <Process> PlayReplay(ReplayPreview preview) { _log.Information($"Playing replay..."); if (preview == null) { throw new ArgumentNullException(nameof(preview)); } var process = await _player.PlayReplay(preview.Location).ConfigureAwait(true); // if process is null, replay failed to play for whatever reason if (process != null) { preview.IsPlaying = true; // add event handler for when the replay stops process.Exited += (object processSender, System.EventArgs processEventArgs) => { preview.IsPlaying = false; }; } return(process); }