コード例 #1
0
        private void ByByWindow(object sender, EventArgs e)
        {
            if (sender == EmpForm)
            {
                EmpForm = null;
            }
            if (sender == PayForm)
            {
                PayForm = null;
            }
            if (sender == TrainForm)
            {
                TrainForm = null;
            }
            if (sender == SkedForm)
            {
                SkedForm = null;
            }

            ListWindows(null, null);
        }
コード例 #2
0
        private void OpenWindow(object sender, EventArgs e)
        {
            MenuItem m;

            if (sender is MenuItem)
            {
                m = (MenuItem)sender;
            }
            else
            {
                return;
            }

            if (m == mnuEmp)
            {
                if (EmpForm == null)
                {
                    EmpForm       = new Employee();
                    EmpForm.Load += new EventHandler(this.ListWindows);
                    //         EmpForm.GotFocus  += new EventHandler(this.ListWindows);
                    EmpForm.Click    += new EventHandler(this.ListWindows);
                    EmpForm.Disposed += new EventHandler(this.ByByWindow);
                    EmpForm.Show();
                }
                else
                {
                    EmpForm.Focus();
                }
            }

            if (m == mnuTrain)
            {
                if (TrainForm == null)
                {
                    TrainForm       = new Training();
                    TrainForm.Load += new EventHandler(this.ListWindows);
//          TrainForm.GotFocus  += new EventHandler(this.ListWindows);
                    TrainForm.Click    += new EventHandler(this.ListWindows);
                    TrainForm.Disposed += new EventHandler(this.ByByWindow);
                    TrainForm.Show();
                }
                else
                {
                    TrainForm.Focus();
                }
            }

            if (m == mnuPayroll)
            {
                if (PayForm == null)
                {
                    PayForm       = new Payroll();
                    PayForm.Load += new EventHandler(this.ListWindows);
//          PayForm.GotFocus  += new EventHandler(this.ListWindows);
                    PayForm.Click    += new EventHandler(this.ListWindows);
                    PayForm.Disposed += new EventHandler(this.ByByWindow);
                    PayForm.Show();
                }
                else
                {
                    PayForm.Focus();
                }
            }

            if (m == mnuSked)
            {
                if (SkedForm == null)
                {
                    SkedForm       = new Scheduling();
                    SkedForm.Load += new EventHandler(this.ListWindows);
//          SkedForm.GotFocus  += new EventHandler(this.ListWindows);
                    SkedForm.Click    += new EventHandler(this.ListWindows);
                    SkedForm.Disposed += new EventHandler(this.ByByWindow);
                    SkedForm.Show();
                }
                else
                {
                    SkedForm.Focus();
                }
            }
        }