private void GoToScreen(Constants.Screen screen) { UserControl newControl = null; switch (screen) { case Constants.Screen.StartScreen: newControl = new ParticipantNumberControl(this); this.tsbOptions.Enabled = true; break; case Constants.Screen.ReadyScreen: this.tsbOptions.Enabled = false; ParticipantNumberControl c = currentControl as ParticipantNumberControl; participantNumber = c.ParticipantNumber; ReadyScreenControl temp = new ReadyScreenControl(this); temp.ParticipantNumber = participantNumber; newControl = temp; break; case Constants.Screen.Proficiency: this.tsbOptions.Enabled = false; Session.Instance.start(participantNumber); ProficiencyControl pc = new ProficiencyControl(this); newControl = pc; break; case Constants.Screen.Instructions: this.tsbOptions.Enabled = false; newControl = new Instructions(this); break; case Constants.Screen.Memorize: this.tsbOptions.Enabled = false; newControl = new Memorize(this); break; case Constants.Screen.ForcedPractice: this.tsbOptions.Enabled = false; newControl = new ForcedPractice(this); break; case Constants.Screen.Verify: this.tsbOptions.Enabled = false; newControl = new Verify(this); break; case Constants.Screen.Entry: this.tsbOptions.Enabled = false; newControl = new Entry(this); break; case Constants.Screen.Recall: this.tsbOptions.Enabled = false; newControl = new Recall(this); break; case Constants.Screen.ThankYou: this.tsbOptions.Enabled = false; newControl = new Thankyou(this); break; case Constants.Screen.Settings: this.tsbOptions.Enabled = false; newControl = new Settings(this); break; default: this.tsbOptions.Enabled = false; newControl = null; break; } if (newControl != null) { BaseControl bc = currentControl as BaseControl; if (bc != null) { bc.ExitControl(); } newControl.Dock = DockStyle.Fill; if (mainPanel.Controls.Count != 0) { mainPanel.Controls.Clear(); } mainPanel.Controls.Add(newControl); _currentScreen = screen; currentControl = newControl; } else { MessageBox.Show("Attempt to add null control to main panel.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public override void execute() { _previousScreen = _reciever.CurrentScreen; _reciever.CurrentScreen = _target; }
public CommandGoToScreen(BaseForm reciever, Constants.Screen target) { _reciever = reciever; _target = target; }
private void GoToScreen(Constants.Screen screen) { UserControl newControl = null; switch(screen) { case Constants.Screen.StartScreen: newControl = new ParticipantNumberControl(this); this.tsbOptions.Enabled = true; break; case Constants.Screen.ReadyScreen: this.tsbOptions.Enabled = false; ParticipantNumberControl c = currentControl as ParticipantNumberControl; participantNumber = c.ParticipantNumber; ReadyScreenControl temp = new ReadyScreenControl(this); temp.ParticipantNumber = participantNumber; newControl = temp; break; case Constants.Screen.Proficiency: this.tsbOptions.Enabled = false; Session.Instance.start(participantNumber); ProficiencyControl pc = new ProficiencyControl(this); newControl = pc; break; case Constants.Screen.Instructions: this.tsbOptions.Enabled = false; newControl = new Instructions(this); break; case Constants.Screen.Memorize: this.tsbOptions.Enabled = false; newControl = new Memorize(this); break; case Constants.Screen.ForcedPractice: this.tsbOptions.Enabled = false; newControl = new ForcedPractice(this); break; case Constants.Screen.Verify: this.tsbOptions.Enabled = false; newControl = new Verify(this); break; case Constants.Screen.Entry: this.tsbOptions.Enabled = false; newControl = new Entry(this); break; case Constants.Screen.Recall: this.tsbOptions.Enabled = false; newControl = new Recall(this); break; case Constants.Screen.ThankYou: this.tsbOptions.Enabled = false; newControl = new Thankyou(this); break; case Constants.Screen.Settings: this.tsbOptions.Enabled = false; newControl = new Settings(this); break; default: this.tsbOptions.Enabled = false; newControl = null; break; } if (newControl != null) { BaseControl bc = currentControl as BaseControl; if (bc != null) bc.ExitControl(); newControl.Dock = DockStyle.Fill; if (mainPanel.Controls.Count != 0) { mainPanel.Controls.Clear(); } mainPanel.Controls.Add(newControl); _currentScreen = screen; currentControl = newControl; } else { MessageBox.Show("Attempt to add null control to main panel.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }