private void OnNavClick(object sender, EventArgs e) { //Event handler for menu/toolbar item clicked Form win = null; IToolbar window = null; this.Cursor = Cursors.WaitCursor; try { ToolStripItem item = (ToolStripItem)sender; switch (item.Name) { case "tsClients": this.mMessageMgr.AddMessage("Opening clients..."); for (int i = 0; i < this.MdiChildren.Length; i++) { Form _win = (Form)this.MdiChildren[i]; if (_win is winClients) { win = _win; win.Activate(); break; } } if (win == null) { win = new winClients(); win.MdiParent = this; win.Activated += new EventHandler(OnWindowActivated); win.Deactivate += new EventHandler(OnWindowDeactivated); win.FormClosing += new FormClosingEventHandler(OnWindowClosing); win.FormClosed += new FormClosedEventHandler(OnWindowClosed); window = (IToolbar)win; window.StatusMessage += new StatusEventHandler(OnStatusMessage); window.ServiceStatesChanged += new EventHandler(OnServiceStatesChanged); win.WindowState = FormWindowState.Maximized; win.Show(); } //win.WindowState = FormWindowState.Maximized; this.mActiveForm = win; break; case "tsShippers": this.mMessageMgr.AddMessage("Opening shippers..."); for (int i = 0; i < this.MdiChildren.Length; i++) { Form _win = (Form)this.MdiChildren[i]; if (_win is winShippers) { win = _win; win.Activate(); break; } } if (win == null) { win = new winShippers(); win.MdiParent = this; win.Activated += new EventHandler(OnWindowActivated); win.Deactivate += new EventHandler(OnWindowDeactivated); win.FormClosing += new FormClosingEventHandler(OnWindowClosing); win.FormClosed += new FormClosedEventHandler(OnWindowClosed); window = (IToolbar)win; window.StatusMessage += new StatusEventHandler(OnStatusMessage); window.ServiceStatesChanged += new EventHandler(OnServiceStatesChanged); win.WindowState = FormWindowState.Maximized; win.Show(); } //win.WindowState = FormWindowState.Maximized; this.mActiveForm = win; break; case "tsConsignees": this.mMessageMgr.AddMessage("Opening consignees..."); for (int i = 0; i < this.MdiChildren.Length; i++) { Form _win = (Form)this.MdiChildren[i]; if (_win is winConsignees) { win = _win; win.Activate(); break; } } if (win == null) { win = new winConsignees(); win.MdiParent = this; win.Activated += new EventHandler(OnWindowActivated); win.Deactivate += new EventHandler(OnWindowDeactivated); win.FormClosing += new FormClosingEventHandler(OnWindowClosing); win.FormClosed += new FormClosedEventHandler(OnWindowClosed); window = (IToolbar)win; window.StatusMessage += new StatusEventHandler(OnStatusMessage); window.ServiceStatesChanged += new EventHandler(OnServiceStatesChanged); win.WindowState = FormWindowState.Maximized; win.Show(); } //win.WindowState = FormWindowState.Maximized; this.mActiveForm = win; break; case "tsShipments": this.mMessageMgr.AddMessage("Opening shipments..."); for (int i = 0; i < this.MdiChildren.Length; i++) { Form _win = (Form)this.MdiChildren[i]; if (_win is winShipments) { win = _win; win.Activate(); break; } } if (win == null) { win = new winShipments(); win.MdiParent = this; win.Activated += new EventHandler(OnWindowActivated); win.Deactivate += new EventHandler(OnWindowDeactivated); win.FormClosing += new FormClosingEventHandler(OnWindowClosing); win.FormClosed += new FormClosedEventHandler(OnWindowClosed); window = (IToolbar)win; window.StatusMessage += new StatusEventHandler(OnStatusMessage); window.ServiceStatesChanged += new EventHandler(OnServiceStatesChanged); win.WindowState = FormWindowState.Maximized; win.Show(); } //win.WindowState = FormWindowState.Maximized; this.mActiveForm = win; break; case "tsQuickQuote": this.mMessageMgr.AddMessage("Opening quotes..."); for (int i = 0; i < this.MdiChildren.Length; i++) { Form _win = (Form)this.MdiChildren[i]; if (_win is winQuotes) { win = _win; win.Activate(); break; } } if (win == null) { win = new winQuotes(); win.MdiParent = this; win.Activated += new EventHandler(OnWindowActivated); win.Deactivate += new EventHandler(OnWindowDeactivated); win.FormClosing += new FormClosingEventHandler(OnWindowClosing); win.FormClosed += new FormClosedEventHandler(OnWindowClosed); window = (IToolbar)win; window.StatusMessage += new StatusEventHandler(OnStatusMessage); window.ServiceStatesChanged += new EventHandler(OnServiceStatesChanged); win.WindowState = FormWindowState.Maximized; win.Show(); } //win.WindowState = FormWindowState.Maximized; this.mActiveForm = win; break; case "tsReports": this.mMessageMgr.AddMessage("Opening quotes..."); for (int i = 0; i < this.MdiChildren.Length; i++) { Form _win = (Form)this.MdiChildren[i]; if (_win is winReports) { win = _win; win.Activate(); break; } } if (win == null) { win = new winReports(); win.MdiParent = this; win.Activated += new EventHandler(OnWindowActivated); win.Deactivate += new EventHandler(OnWindowDeactivated); win.FormClosing += new FormClosingEventHandler(OnWindowClosing); win.FormClosed += new FormClosedEventHandler(OnWindowClosed); window = (IToolbar)win; window.StatusMessage += new StatusEventHandler(OnStatusMessage); window.ServiceStatesChanged += new EventHandler(OnServiceStatesChanged); win.WindowState = FormWindowState.Maximized; win.Show(); } //win.WindowState = FormWindowState.Maximized; this.mActiveForm = win; break; } } catch (Exception ex) { App.ReportError(ex); } finally { setUserServices(); this.Cursor = Cursors.Default; } }
private void OnNavClick(object sender, EventArgs e) { //Event handler for menu/toolbar item clicked Form win = null; ISchedule schedule = null; try { ToolStripItem item = (ToolStripItem)sender; switch (item.Name) { case "tsClientInbound": this.mMessageMgr.AddMessage("Opening Client Inbound Schedule..."); for (int i = 0; i < this.MdiChildren.Length; i++) { Form _win = (Form)this.MdiChildren[i]; if (_win is winClientInbound) { win = _win; win.Activate(); break; } } if (win == null) { win = new winClientInbound(); win.MdiParent = this; win.Activated += new EventHandler(OnWindowActivated); win.Deactivate += new EventHandler(OnWindowDeactivated); win.FormClosing += new FormClosingEventHandler(OnWindowClosing); win.FormClosed += new FormClosedEventHandler(OnWindowClosed); schedule = (ISchedule)win; schedule.StatusMessage += new StatusEventHandler(OnStatusMessage); schedule.ServiceStatesChanged += new EventHandler(OnServiceStatesChanged); schedule.TemplatesVisible = this.msViewTemplates.Checked && RoleServiceGateway.IsDispatchSupervisor; win.WindowState = FormWindowState.Maximized; win.Show(); } //win.WindowState = FormWindowState.Maximized; this.mActiveForm = win; break; case "tsInbound": this.mMessageMgr.AddMessage("Opening Inbound Schedule..."); for (int i = 0; i < this.MdiChildren.Length; i++) { Form _win = (Form)this.MdiChildren[i]; if (_win is winInbound) { win = _win; win.Activate(); break; } } if (win == null) { win = new winInbound(); win.MdiParent = this; win.Activated += new EventHandler(OnWindowActivated); win.Deactivate += new EventHandler(OnWindowDeactivated); win.FormClosing += new FormClosingEventHandler(OnWindowClosing); win.FormClosed += new FormClosedEventHandler(OnWindowClosed); schedule = (ISchedule)win; schedule.StatusMessage += new StatusEventHandler(OnStatusMessage); schedule.ServiceStatesChanged += new EventHandler(OnServiceStatesChanged); schedule.TemplatesVisible = this.msViewTemplates.Checked && RoleServiceGateway.IsDispatchSupervisor; win.WindowState = FormWindowState.Maximized; win.Show(); } //win.WindowState = FormWindowState.Maximized; this.mActiveForm = win; break; case "tsOutbound": this.mMessageMgr.AddMessage("Opening Outbound Schedule..."); for (int i = 0; i < this.MdiChildren.Length; i++) { Form _win = (Form)this.MdiChildren[i]; if (_win is winOutbound) { win = _win; win.Activate(); break; } } if (win == null) { win = new winOutbound(); win.MdiParent = this; win.Activated += new EventHandler(OnWindowActivated); win.Deactivate += new EventHandler(OnWindowDeactivated); win.FormClosing += new FormClosingEventHandler(OnWindowClosing); win.FormClosed += new FormClosedEventHandler(OnWindowClosed); schedule = (ISchedule)win; schedule.StatusMessage += new StatusEventHandler(OnStatusMessage); schedule.ServiceStatesChanged += new EventHandler(OnServiceStatesChanged); schedule.TemplatesVisible = this.msViewTemplates.Checked && RoleServiceGateway.IsDispatchSupervisor; win.WindowState = FormWindowState.Maximized; win.Show(); } //win.WindowState = FormWindowState.Maximized; this.mActiveForm = win; break; case "tsPickupLog": this.mMessageMgr.AddMessage("Opening Pickup Log..."); for (int i = 0; i < this.MdiChildren.Length; i++) { Form _win = (Form)this.MdiChildren[i]; if (_win is winPickupLog) { win = _win; win.Activate(); break; } } if (win == null) { win = new winPickupLog(); win.MdiParent = this; win.Activated += new EventHandler(OnWindowActivated); win.Deactivate += new EventHandler(OnWindowDeactivated); win.FormClosing += new FormClosingEventHandler(OnWindowClosing); win.FormClosed += new FormClosedEventHandler(OnWindowClosed); schedule = (ISchedule)win; schedule.StatusMessage += new StatusEventHandler(OnStatusMessage); schedule.ServiceStatesChanged += new EventHandler(OnServiceStatesChanged); schedule.TemplatesVisible = this.msViewTemplates.Checked && RoleServiceGateway.IsDispatchSupervisor; win.WindowState = FormWindowState.Maximized; win.Show(); } //win.WindowState = FormWindowState.Maximized; this.mActiveForm = win; break; case "tsTrailerTracking": this.mMessageMgr.AddMessage("Opening Trailer Log..."); for (int i = 0; i < this.MdiChildren.Length; i++) { Form _win = (Form)this.MdiChildren[i]; if (_win is winTrailerLog) { win = _win; win.Activate(); break; } } if (win == null) { win = new winTrailerLog(); win.MdiParent = this; win.Activated += new EventHandler(OnWindowActivated); win.Deactivate += new EventHandler(OnWindowDeactivated); win.FormClosing += new FormClosingEventHandler(OnWindowClosing); win.FormClosed += new FormClosedEventHandler(OnWindowClosed); schedule = (ISchedule)win; schedule.StatusMessage += new StatusEventHandler(OnStatusMessage); schedule.ServiceStatesChanged += new EventHandler(OnServiceStatesChanged); schedule.TemplatesVisible = this.msViewTemplates.Checked && RoleServiceGateway.IsDispatchSupervisor; win.WindowState = FormWindowState.Maximized; win.Show(); } //win.WindowState = FormWindowState.Maximized; this.mActiveForm = win; break; case "tsLoadTenders": this.mMessageMgr.AddMessage("Opening PCS Load Tenders..."); for (int i = 0; i < this.MdiChildren.Length; i++) { Form _win = (Form)this.MdiChildren[i]; if (_win is winLoadTenderLog) { win = _win; win.Activate(); break; } } if (win == null) { win = new winLoadTenderLog(); win.MdiParent = this; win.Activated += new EventHandler(OnWindowActivated); win.Deactivate += new EventHandler(OnWindowDeactivated); win.FormClosing += new FormClosingEventHandler(OnWindowClosing); win.FormClosed += new FormClosedEventHandler(OnWindowClosed); schedule = (ISchedule)win; schedule.StatusMessage += new StatusEventHandler(OnStatusMessage); schedule.ServiceStatesChanged += new EventHandler(OnServiceStatesChanged); schedule.TemplatesVisible = this.msViewTemplates.Checked && RoleServiceGateway.IsDispatchSupervisor; win.WindowState = FormWindowState.Maximized; win.Show(); } //win.WindowState = FormWindowState.Maximized; this.mActiveForm = win; break; case "tsBBB": this.mMessageMgr.AddMessage("Opening BBB Schedule..."); for (int i = 0; i < this.MdiChildren.Length; i++) { Form _win = (Form)this.MdiChildren[i]; if (_win is winBBB) { win = _win; win.Activate(); break; } } if (win == null) { win = new winBBB(); win.MdiParent = this; win.Activated += new EventHandler(OnWindowActivated); win.Deactivate += new EventHandler(OnWindowDeactivated); win.FormClosing += new FormClosingEventHandler(OnWindowClosing); win.FormClosed += new FormClosedEventHandler(OnWindowClosed); schedule = (ISchedule)win; schedule.StatusMessage += new StatusEventHandler(OnStatusMessage); schedule.ServiceStatesChanged += new EventHandler(OnServiceStatesChanged); schedule.TemplatesVisible = this.msViewTemplates.Checked && RoleServiceGateway.IsDispatchSupervisor; win.WindowState = FormWindowState.Maximized; win.Show(); } //win.WindowState = FormWindowState.Maximized; this.mActiveForm = win; break; case "tsReports": this.mMessageMgr.AddMessage("Opening reports..."); for (int i = 0; i < this.MdiChildren.Length; i++) { Form _win = (Form)this.MdiChildren[i]; if (_win is winReports) { win = _win; win.Activate(); break; } } if (win == null) { win = new winReports(); win.MdiParent = this; win.Activated += new EventHandler(OnWindowActivated); win.Deactivate += new EventHandler(OnWindowDeactivated); win.FormClosing += new FormClosingEventHandler(OnWindowClosing); win.FormClosed += new FormClosedEventHandler(OnWindowClosed); schedule = (ISchedule)win; schedule.StatusMessage += new StatusEventHandler(OnStatusMessage); schedule.ServiceStatesChanged += new EventHandler(OnServiceStatesChanged); win.WindowState = FormWindowState.Maximized; win.Show(); } //win.WindowState = FormWindowState.Maximized; this.mActiveForm = win; break; } } catch (Exception ex) { App.ReportError(ex); } finally { setUserServices(); this.Cursor = Cursors.Default; } }