void btnUseThisExisting_Click(object sender, RoutedEventArgs e) { try { int id = 0; int.TryParse(txtMALID.Text, out id); if (id <= 0) { MessageBox.Show(Shoko.Commons.Properties.Resources.Search_InvalidMAL, Shoko.Commons.Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); txtMALID.Focus(); return; } if (string.IsNullOrEmpty(txtMALTitle.Text.Trim())) { MessageBox.Show(Shoko.Commons.Properties.Resources.Search_EnterTitle, Shoko.Commons.Properties.Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error); txtMALTitle.Focus(); return; } // prompt to select details Window wdw = GetWindow(this); Cursor = Cursors.Wait; SelectMALStartForm frm = new SelectMALStartForm(); frm.Owner = wdw; frm.Init(AnimeID, AnimeName_MAL, txtMALTitle.Text.Trim(), id, null, null); bool?result = frm.ShowDialog(); if (result.Value) { DialogResult = true; Cursor = Cursors.Arrow; Close(); } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { Cursor = Cursors.Arrow; } }
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_MALAnime_Response)) { Cursor = Cursors.Wait; VM_MALAnime_Response searchResult = obj as VM_MALAnime_Response; // prompt to select details Window wdw = GetWindow(this); Cursor = Cursors.Wait; SelectMALStartForm frm = new SelectMALStartForm(); frm.Owner = wdw; frm.Init(AnimeID, AnimeName_MAL, searchResult.title, searchResult.id, null, null); bool?result = frm.ShowDialog(); if (result.Value) { DialogResult = true; Cursor = Cursors.Arrow; Close(); } } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } finally { Cursor = Cursors.Arrow; } }