Exemple #1
0
 //Interface
 public ConsigneeAutoRefreshService(winConsignees 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);
 }
Exemple #2
0
        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; }
        }