void OnCommitEdit(object sender, TextEditorEventArgs args) { if (!args.Cancelled) { SetNodeText(this.selectedNode, args.Text); } }
public bool EndEdit(bool cancel) { if (ending) { return(false); // don't let it be re-entrant! } ending = true; cset.EndEdit(cancel); try { if (this.currentEditor.Visible) { if (this.CommitEdit != null) { string value = (this.editor != null) ? this.editor.XmlValue : this.currentEditor.Text; TextEditorEventArgs args = new TextEditorEventArgs(value, cancel); CommitEdit(this, args); if (args.Cancelled && !cancel) { return(false); } } HideEdit(); } } catch (Exception e) { MessageBox.Show(e.Message, SR.EditErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } finally { ending = false; } return(true); }
public bool EndEdit(bool cancel) { if (ending) return false; // don't let it be re-entrant! ending = true; cset.EndEdit(cancel); try { if (this.currentEditor.Visible) { if (this.CommitEdit != null) { string value = (this.editor != null) ? this.editor.XmlValue : this.currentEditor.Text; TextEditorEventArgs args = new TextEditorEventArgs(value, cancel); CommitEdit(this, args); if (args.Cancelled && !cancel) return false; } HideEdit(); } } catch (Exception e) { MessageBox.Show(e.Message, SR.EditErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } finally { ending = false; } return true; }