private void CommandBinding_UseThis(object sender, ExecutedRoutedEventArgs e) { Window parentWindow = GetWindow(this); object obj = e.Parameter; if (obj == null) { return; } try { if (obj.GetType() == typeof(VM_TVDB_Series_Search_Response)) { Cursor = Cursors.Wait; VM_TVDB_Series_Search_Response searchResult = obj as VM_TVDB_Series_Search_Response; // prompt to select season Window wdw = GetWindow(this); Cursor = Cursors.Wait; SelectTvDBSeasonForm frm = new SelectTvDBSeasonForm(); frm.Owner = wdw; frm.Init(AnimeID, AnimeName, enEpisodeType.Episode, 1, searchResult.SeriesID, 1, 1, searchResult.SeriesName, Anime, null); bool?result = frm.ShowDialog(); if (result.Value) { SelectedTvDBID = searchResult.SeriesID; DialogResult = true; Cursor = Cursors.Arrow; Close(); } } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { Cursor = Cursors.Arrow; } }
void btnUseThisExisting_Click(object sender, RoutedEventArgs e) { try { int id = 0; int.TryParse(txtSeriesID.Text, out id); if (id <= 0) { MessageBox.Show(Shoko.Commons.Properties.Resources.Search_InvalidTvDB, Shoko.Commons.Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); txtSeriesID.Focus(); return; } Cursor = Cursors.Wait; // prompt to select season Window wdw = GetWindow(this); Cursor = Cursors.Wait; SelectTvDBSeasonForm frm = new SelectTvDBSeasonForm(); frm.Owner = wdw; frm.Init(AnimeID, AnimeName, enEpisodeType.Episode, 1, id, 1, 1, AnimeName, Anime, null); bool?result = frm.ShowDialog(); if (result.Value) { SelectedTvDBID = id; DialogResult = true; Cursor = Cursors.Arrow; Close(); } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { Cursor = Cursors.Arrow; } }