private void SwitchInternal(ManagerPagePanel panel) { foreach (var p in this.panels) { p.Visible = p == panel; } }
public void Switch(ManagerPagePanel panel) { if (panel == null) { throw new ArgumentNullException(nameof(panel)); } ManagerPagePanel currentPagePanel = this.CurrentPagePanel; if (this.panels.Contains(panel)) { panel.Enabled = true; if (currentPagePanel == panel) { return; } this.CurrentPagePanel = panel; this.OnCurrentPagePanelChanged(new ManagerPagePanelChangedEventArgs(currentPagePanel, panel)); ManagerPageType currentPage = this.CurrentPage; this.CurrentPage = panel.ManagerPageType; this.OnCurrentPageChanged(new ChangedEventArgs <ManagerPageType>(currentPage, panel.ManagerPageType)); this.SwitchInternal(panel); } }
public void Switch(ManagerPageType page) { if (!this.IsSupport(page)) { return; } ManagerPageType currentPage = this.CurrentPage; ManagerPagePanel panel = this.panels.FirstOrDefault(p => { if (page == ManagerPageType.LogoutSucceeded) { return(p.ManagerPageType == ManagerPageType.LoginInfo); } else { return(p.ManagerPageType == page); } }); if (panel != null && this.panels.Contains(panel)) { panel.Enabled = true; if (currentPage == page) { return; } ManagerPagePanel currentPagePanel = this.CurrentPagePanel; this.CurrentPagePanel = panel; this.OnCurrentPagePanelChanged(new ManagerPagePanelChangedEventArgs(currentPagePanel, panel)); this.CurrentPage = page; this.OnCurrentPageChanged(new ChangedEventArgs <ManagerPageType>(currentPage, page)); this.SwitchInternal(panel); } }
bool ICollection <ManagerPagePanel> .Remove(ManagerPagePanel item) { return(this.panels.Remove(item ?? throw new ArgumentNullException(nameof(item)))); }
bool ICollection <ManagerPagePanel> .Contains(ManagerPagePanel item) { return(this.panels.Contains(item)); }
void ICollection <ManagerPagePanel> .Add(ManagerPagePanel item) { this.panels.Add(item ?? throw new ArgumentNullException(nameof(item))); }