Example #1
0
 //Interface
 public TrailerLogAutoRefreshService(winTrailerLog postback)
 {
     //
     this.mTimer                      = new System.Windows.Forms.Timer();
     this.mTimer.Interval             = global::Argix.Properties.Settings.Default.AutoRefreshTimer;
     this.mTimer.Tick                += new EventHandler(OnTick);
     this.mWorker                     = new BackgroundWorker();
     this.mWorker.DoWork             += new DoWorkEventHandler(OnAutoRefresh);
     this.mWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(postback.OnAutoRefreshCompleted);
 }
Example #2
0
        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; }
        }