/// <summary> /// Handles the changing of panels to view /// </summary> /// <param name="viewToLoad">The new view to be presented</param> /// <param name="cameFrom">The view from where the call to this was made</param> public void ChangePanel(PanelViewControl viewToLoad, PanelViewControl cameFrom) { this.Controls.Remove(cameFrom); this.Controls.Add(viewToLoad); PrevViewStack.Push(cameFrom); CurrentView = viewToLoad; }
/// <summary> /// Go back to the previous panel that was presented. /// </summary> public void GoBackToPreviuosPanel() { try { PreviousView = PrevViewStack.Pop(); this.Controls.Remove(CurrentView); this.Controls.Add(PreviousView); CurrentView = PreviousView; } catch (InvalidOperationException) { GoBackToStartMenu(); } }