private async void Window_Loaded(object sender, RoutedEventArgs e) { if (!(this.DataContext is MainWindowViewModel context)) { return; } var replay = await _files.GetSingleFile(ReplayFileLocation).ConfigureAwait(true); if (replay == null) { _log.Error($"Failed to load file {ReplayFileLocation}"); MessageBox.Show((string)TryFindResource("FailedToLoadReplayText"), (string)TryFindResource("ErrorTitle"), MessageBoxButton.OK, MessageBoxImage.Error); Application.Current.Shutdown(); } else { // Let the view model know about the replay var previewReplay = context.AddReplay(replay); var replayDetail = new ReplayDetail(replay, previewReplay); DetailView.DataContext = replayDetail; (DetailView.FindName("BlankContent") as Grid).Visibility = Visibility.Hidden; (DetailView.FindName("ReplayContent") as Grid).Visibility = Visibility.Visible; await context.LoadItemThumbnails(replayDetail).ConfigureAwait(true); await context.LoadSinglePreviewPlayerThumbnails(previewReplay).ConfigureAwait(true); } }