protected void EditSnippet(Snippet snippet) { Snippet editableSnippet = new Snippet(snippet); SnippetDetails details = new SnippetDetails(); details.Settings = this.Settings; details.DataContext = editableSnippet; bool?result = details.ShowDialog(); if ((result.HasValue) && (result.Value)) { snippet.CopyFrom(editableSnippet); } }
protected void NewSnippet() { Snippet snippet = new Snippet(); SnippetDetails details = new SnippetDetails(); details.Settings = this.Settings; details.DataContext = snippet; bool?result = details.ShowDialog(); if ((result.HasValue) && (result.Value)) { this.Settings.Snippets.Add(snippet); } }