private void DoCancel(object sender, RoutedEventArgs e) { Snippet.Name = _name; Snippet.Shortcut = _shortcut; Snippet.Text = _text; this.Hide(); instance = null; }
private void DoDone(object sender, RoutedEventArgs e) { FocusManager.SetFocusedElement(this, null); this.Hide(); RaiseCommitValuesEvent(this); instance = null; }
public static SnippetEditor Show(Snippet s, Window owner) { if (instance == null) { instance = new SnippetEditor(); } instance.Owner = owner; instance.Snippet = s; instance.Show(); return(instance); }
public static SnippetEditor Show(Snippet s, Window owner) { if (instance == null) { instance = new SnippetEditor(); } instance.Owner = owner; instance.Snippet = s; instance.Show(); return instance; }
/// <summary> /// PropertyChangedCallback for Snippet /// </summary> private static void SnippetChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) { if (obj is SnippetEditor) { SnippetEditor owner = (SnippetEditor)obj; Snippet s = (args.NewValue as Snippet); // create a local backup of the editable properties (for the cancel operation) if (s != null) { owner._name = s.Name; owner._shortcut = s.Shortcut; owner._text = s.Text; } } }
protected override void OnClosed(EventArgs e) { instance = null; }