Beispiel #1
0
        /// <summary>
        /// Call the Loading event for the usercontrol
        /// </summary>
        private void ControlOnLoad(ControlsEnum ctrl)
        {
            switch (ctrl)
            {
            case ControlsEnum.HOME:
                homeCtrl.CtrlHome_Load(null, null);
                return;

            case ControlsEnum.CHECKOUT:
                checkoutCtrl.CtrlCheckout_Load(null, null);
                return;

            case ControlsEnum.SUMMARY:
                summaryCtrl.CtrlSummary_Load(null, null);
                return;

            case ControlsEnum.CARD_PAYMENT:
                cardCtrl.CtrlCardPayment_Load(null, null);
                return;

            case ControlsEnum.CASH_PAYMENT:
                cashCtrl.CtrlCashPayment_Load(null, null);
                return;

            case ControlsEnum.THANKS:
                thanksCtrl.CtrlThanks_Load(null, null);
                return;

            default:
                return;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Create a new instance for the user control
        /// </summary>
        private Control CreateControl(ControlsEnum ctrl)
        {
            switch (ctrl)
            {
            case ControlsEnum.HOME:
                return(homeCtrl.Controls.Owner);

            case ControlsEnum.CHECKOUT:
                return(checkoutCtrl.Controls.Owner);

            case ControlsEnum.SUMMARY:
                return(summaryCtrl.Controls.Owner);

            case ControlsEnum.CARD_PAYMENT:
                return(cardCtrl.Controls.Owner);

            case ControlsEnum.CASH_PAYMENT:
                return(cashCtrl.Controls.Owner);

            case ControlsEnum.SETTING:
                return(settingCtrl.Controls.Owner);

            case ControlsEnum.THANKS:
                return(thanksCtrl.Controls.Owner);

            default:
                return(null);
            }
        }
 private Control CreateControl(ControlsEnum ctrl, PlayerInfo playerinfo)
 {
     switch (ctrl)
     {
         case ControlsEnum.MAIN_CONTROL:
             return new Main(playerinfo);
         default:
             return null;
     }
 }
 private Control CreateControl(ControlsEnum ctrl)
 {
     switch (ctrl)
     {
         case ControlsEnum.LOGIN_CONTROL:
             return new Signin();
         case ControlsEnum.SIGNUP_CONTROL:
             return new Signup();
         default:
             return null;
     }
 }
        public void ShowControl(ControlsEnum ctrl, PlayerInfo playerinfo)
        {
            Control new_ctrl = null;

            if (controls.ContainsKey(ctrl))
            {
                new_ctrl = controls[ctrl];
            }
            else
            {
                new_ctrl = CreateControl(ctrl, playerinfo);
                controls[ctrl] = new_ctrl;
            }

            new_ctrl.Parent = this;
            new_ctrl.Dock = DockStyle.Fill;
            new_ctrl.BringToFront();
            new_ctrl.Show();
        }
Beispiel #6
0
        public void ShowControl(ControlsEnum ctrl)
        {
            Control new_ctrl = null;

            //If our dictionary already contains instance of
            if (controls.ContainsKey(ctrl))
            {
                new_ctrl = controls[ctrl];
                ControlOnLoad(ctrl);
            }
            else
            {
                new_ctrl       = CreateControl(ctrl);
                controls[ctrl] = new_ctrl;
            }

            new_ctrl.Parent = pnlMain;
            new_ctrl.Dock   = DockStyle.Fill;
            new_ctrl.BringToFront();
            new_ctrl.Show();
        }
Beispiel #7
0
        private void enableOrDisableControls(ControlsEnum currentControl)
        {
            switch (currentControl)
            {
            case ControlsEnum.Initialize:
                this.PauseButton.Enabled  = false;
                this.ResumeButton.Enabled = false;
                this.ClearButton.Enabled  = false;
                break;

            case ControlsEnum.Start:
                this.randomShapesTextBox.Enabled = false;
                this.CirclesTextBox.Enabled      = false;
                this.RectanglesTextBox.Enabled   = false;
                this.PauseButton.Enabled         = true;
                this.ResumeButton.Enabled        = false;
                this.ClearButton.Enabled         = true;
                break;

            case ControlsEnum.Pause:
                this.PauseButton.Enabled  = false;
                this.ResumeButton.Enabled = true;
                break;

            case ControlsEnum.Resume:
                this.PauseButton.Enabled  = true;
                this.ResumeButton.Enabled = false;
                break;

            case ControlsEnum.CLear:
                this.PauseButton.Enabled  = false;
                this.ResumeButton.Enabled = false;

                this.randomShapesTextBox.Enabled = true;
                this.CirclesTextBox.Enabled      = true;
                this.RectanglesTextBox.Enabled   = true;
                break;
            }
        }