private void OnMenuClick(object sender, System.EventArgs e) { //Event handler for menu selection Issue issue = null; try { ToolStripDropDownItem menu = (ToolStripDropDownItem)sender; switch (menu.Text) { case MNU_NEW: issue = CustomerProxy.GetIssue(0); issue.FirstActionUserID = Environment.UserName; dlgIssue dlg = new dlgIssue(issue); dlg.Font = this.Font; if (dlg.ShowDialog() == DialogResult.OK) { this.Cursor = Cursors.WaitCursor; long iid = CustomerProxy.CreateIssue(issue); if (iid > 0) { this.ctxRefresh.PerformClick(); for (int i = 0; i < this.grdIssues.Rows.Count; i++) { int id = Convert.ToInt32(this.grdIssues.Rows[i].Cells["ID"].Value); if (id == iid) { this.grdIssues.Rows[i].Selected = true; this.grdIssues.DisplayLayout.Bands[0].Columns["LastActionCreated"].SortIndicator = SortIndicator.Descending; OnGridSelectionChanged(this.grdIssues, null); break; } } } } break; case MNU_OPEN: break; case MNU_SAVE: break; case MNU_SAVEAS: SaveFileDialog dlgSave = new SaveFileDialog(); dlgSave.AddExtension = true; dlgSave.Filter = "Export Files (*.xml) | *.xml | Excel Files (*.xls) | *.xls"; dlgSave.FilterIndex = 0; dlgSave.Title = "Save Issues As..."; dlgSave.FileName = ""; dlgSave.OverwritePrompt = true; if (dlgSave.ShowDialog(this) == DialogResult.OK) { this.Cursor = Cursors.WaitCursor; Application.DoEvents(); if (dlgSave.FileName.EndsWith("xls")) { new Argix.ExcelFormat().Transform(this.mIssues, dlgSave.FileName); } else { this.mIssues.WriteXml(dlgSave.FileName, XmlWriteMode.WriteSchema); } } break; case MNU_SETUP: UltraGridPrinter.PageSettings(); break; case MNU_PRINT: UltraGridPrinter.Print(this.grdIssues, this.grdIssues.Text, true); break; case MNU_PREVIEW: UltraGridPrinter.PrintPreview(this.grdIssues, this.grdIssues.Text); break; case MNU_REFRESH: this.Cursor = Cursors.WaitCursor; this.mGridSvcIssues.CaptureState("ID"); switch (this.cboView.Text) { case "Search Results": break; default: DataSet ds = CustomerProxy.GetIssues(); lock (this.mIssues) { this.mIssues.Clear(); this.mIssues.Merge(ds); } postIssueUpdates(); break; } this.mGridSvcIssues.RestoreState(); break; case MNU_CONTACTS: winContacts winC = new winContacts(); winC.Font = this.Font; winC.ShowDialog(); break; case MNU_PROPERTIES: break; } } catch (Exception ex) { reportError(ex); } finally { setUserServices(); this.Cursor = Cursors.Default; } }