private void OnButtonClick(object sender, System.EventArgs e) { //Button click event handler Button btn = (Button)sender; switch (btn.Text) { case "&New...": dlgInputBox dlgInp = new dlgInputBox("Name of view:", this.mSelectedView.ViewName, "New View"); if (dlgInp.ShowDialog(this) == DialogResult.OK) { LayoutView view = this.mViews.Item(); view.ViewName = dlgInp.Value; dlgLayout dlgNew = new dlgLayout(view); if (dlgNew.ShowDialog(this) == DialogResult.OK) { this.mViews.Add(view); } } break; case "&Copy...": break; case "&Modify...": dlgLayout dlgMod = new dlgLayout(this.mSelectedView); if (dlgMod.ShowDialog(this) == DialogResult.OK) { this.mSelectedView.Update(dlgMod.LayoutData); } break; case "&Rename...": dlgInputBox dlgInput = new dlgInputBox("New name of view:", this.mSelectedView.ViewName, "Rename View"); if (dlgInput.ShowDialog(this) == DialogResult.OK) { this.mSelectedView.ViewName = dlgInput.Value; } break; case "&Delete": if (MessageBox.Show(this, "Delete the selected view?", "Delete View", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this.mViews.Remove(this.mSelectedView); } break; case "&Apply View": this.mViews.SetActiveView(this.mSelectedView.ViewName); break; case "&Close": this.Close(); break; } }
public void CustomizeCurrentView() { //Allow user customization of the current view try { dlgLayout dlg = new dlgLayout(this.mViews.ActiveView); if (dlg.ShowDialog(this) == DialogResult.OK) { this.mViews.ActiveView.Update(dlg.LayoutData); } } catch (Exception ex) { reportError(ex); } }