示例#1
0
        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);
            }
        }
示例#2
0
        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);
            }
        }