/// <summary> /// Called when the status of a registered UIPage has been changed. /// </summary> /// <param name="sender">The sender of the event.</param> /// <param name="newStatus">The new status of the sender.</param> private void OnPageStatusChanged(UIPage sender, UIPage.Status newStatus) { if (!this.registeredPages.Contains(sender)) { throw new InvalidOperationException("Unregistered UIPage!"); } if (sender == this.activePage && newStatus == UIPage.Status.Inactivating) { TraceManager.WriteAllTrace("UIPage inactivating", UITraceFilters.INFO); } else if (sender == this.activePage && newStatus == UIPage.Status.Inactive) { this.workspace.DetachSensitive(this.activePage); this.workspace.Detach(this.activePage); UIPage inactivatedPage = this.activePage; this.activePage = null; TraceManager.WriteAllTrace("UIPage inactivated", UITraceFilters.INFO); if (this.PageInactivated != null) { this.PageInactivated(inactivatedPage); } } else if (sender != this.activePage && this.activePage == null && newStatus == UIPage.Status.Active) { this.activePage = sender; this.workspace.Attach(this.activePage); this.workspace.AttachSensitive(this.activePage); TraceManager.WriteAllTrace("UIPage activated", UITraceFilters.INFO); } else { throw new InvalidOperationException("Invalid UIPage operation!"); } }
static void OnPageStatusChanged(UIPage sender, UIPage.Status newState) { if (newState == UIPage.Status.Inactive) { if (sender == pageA) { pageB.Activate(); panelBA.Show(); panelBB.Show(); panelBC.Show(); panelBD.Show(); pageB.Deactivate(); } else if (sender == pageB) { pageA.Activate(); panelAA.Show(); panelAB.Show(); panelAC.Show(); panelAD.Show(); pageA.Deactivate(); } } }