private void EditControl_OnComplete(bool userCanceled, EventArgs e) { _editControl.Dispose(); _editControl = null; if (!userCanceled) { ExecuteMethod(LoadDocumentTemplates); } ToggleMainControlsEnabled(true); }
/// <summary> /// Allow the user to edit some of the template attriutes /// Show the edit control, allow user to update attributes on a single item /// </summary> private void PerformEditTemplate() { ListViewItem item = listViewDocumentTemplates.SelectedItems[0]; var template = item.Tag as DocumentTemplateEdit; // new instance of the edit control _editControl = new EditTemplateControl(Service, template) { // center me Top = Convert.ToInt32(Parent.Height / 2) - 110, Left = Convert.ToInt32(Parent.Width / 2) - 160, Parent = this }; // disable the main UI so they don't monkey with stuff ToggleMainControlsEnabled(false); // handle the on complete event so we can reload and clean up control _editControl.OnComplete += EditControl_OnComplete; _editControl.BringToFront(); _editControl.Show(); }