Ejemplo n.º 1
0
        private void OnItemClick(object sender, System.EventArgs e)
        {
            //Menu services
            IToolbar      window      = null;
            IPSPToolbar   pspwindow   = null;
            IQuoteToolbar quotewindow = null;

            try {
                ToolStripItem menu = (ToolStripItem)sender;
                switch (menu.Name)
                {
                case "msFileNew":
                case "tsbNew":
                    window = (IToolbar)this.mActiveForm;
                    window.New();
                    break;

                case "msFileOpen":
                case "tsbOpen":
                    window = (IToolbar)this.mActiveForm;
                    window.Open();
                    break;

                case "msFileCancel":
                case "tsbCancel":
                    window = (IToolbar)this.mActiveForm;
                    window.Cancel();
                    break;

                case "msFileSave":
                case "tsbSave":
                    break;

                case "msFileSaveAs":
                    SaveFileDialog dlgSave = new SaveFileDialog();
                    dlgSave.AddExtension     = true;
                    dlgSave.Filter           = "Excel files (*.xls)|*.xls|All files (*.*)|*.*";
                    dlgSave.FilterIndex      = 0;
                    dlgSave.Title            = "Export...";
                    dlgSave.FileName         = "";
                    dlgSave.CheckFileExists  = false;
                    dlgSave.OverwritePrompt  = true;
                    dlgSave.InitialDirectory = System.IO.Directory.GetCurrentDirectory();
                    if (dlgSave.ShowDialog(this) == DialogResult.OK)
                    {
                        window = (IToolbar)this.mActiveForm;
                        window.Save(dlgSave.FileName);
                    }
                    break;

                case "msFilePageSetup":
                    UltraGridPrinter.PageSettings();
                    break;

                case "msFilePrint":
                    window = (IToolbar)this.mActiveForm;
                    window.Print(true);
                    break;

                case "tsbPrint":
                    window = (IToolbar)this.mActiveForm;
                    window.Print(false);
                    break;

                case "msFilePreview":
                    window = (IToolbar)this.mActiveForm;
                    window.PrintPreview();
                    break;

                case "msFileExit":
                    this.Close();
                    break;

                case "msViewRefresh":
                case "tsbRefresh":
                    this.Cursor = Cursors.WaitCursor;
                    this.mMessageMgr.AddMessage("Refreshing...");
                    this.mActiveForm.Refresh();
                    break;

                case "msViewFont":
                    FontDialog fd = new FontDialog();
                    fd.FontMustExist = true;
                    fd.Font          = this.Font;
                    if (fd.ShowDialog() == DialogResult.OK)
                    {
                        this.Font = this.msMain.Font = this.tsMain.Font = this.tsNav.Font = this.ssMain.Font = fd.Font;
                    }
                    break;

                case "msViewToolbar":
                    this.msViewToolbar.Checked = (!this.msViewToolbar.Checked);
                    this.tsMain.Visible        = this.msViewToolbar.Checked;
                    break;

                case "msViewStatusBar":
                    this.msViewStatusBar.Checked = (!this.msViewStatusBar.Checked);
                    this.ssMain.Visible          = this.msViewStatusBar.Checked;
                    break;

                case "msApprove":
                case "tsbApprove":
                    pspwindow = (IPSPToolbar)this.mActiveForm;
                    pspwindow.ApproveClient();
                    break;

                case "msDeny":
                case "tsbDeny":
                    pspwindow = (IPSPToolbar)this.mActiveForm;
                    pspwindow.DenyClient();
                    break;

                case "msPrintLabels":
                case "tsbPrintLabels":
                    pspwindow = (IPSPToolbar)this.mActiveForm;
                    pspwindow.PrintLabels();
                    break;

                case "msPrintPaperwork":
                case "tsbPrintPaperwork":
                    pspwindow = (IPSPToolbar)this.mActiveForm;
                    pspwindow.PrintPaperwork();
                    break;

                case "tsbApproveQuote":
                    quotewindow = (IQuoteToolbar)this.mActiveForm;
                    quotewindow.ApproveQuote();
                    break;

                case "tsbTenderQuote":
                    quotewindow = (IQuoteToolbar)this.mActiveForm;
                    quotewindow.TenderQuote();
                    break;

                case "tsbViewTender":
                    quotewindow = (IQuoteToolbar)this.mActiveForm;
                    quotewindow.ViewTender();
                    break;

                case "tsbBookQuote":
                    quotewindow = (IQuoteToolbar)this.mActiveForm;
                    quotewindow.BookQuote();
                    break;

                case "msToolsConfig":
                    App.ShowConfig();
                    break;

                case "msWinCascade": this.LayoutMdi(MdiLayout.Cascade); break;

                case "msWinTileH": this.LayoutMdi(MdiLayout.TileHorizontal); break;

                case "msWinTileV": this.LayoutMdi(MdiLayout.TileVertical); break;

                case "msHelpAbout": new dlgAbout(App.Description, App.Version, App.Copyright, App.Configuration).ShowDialog(this); break;
                }
            }
            catch (Exception ex) { App.ReportError(ex, true, LogLevel.Error); }
            finally { setUserServices(); this.Cursor = Cursors.Default; }
        }