public void SetPage(string name, UserControl mainPage) { if (this.currentPanel != null) { this.currentPanel.Visibility = Visibility.Hidden; } ContainerPage containerPage = (ContainerPage)this.GetPage(name); if (containerPage == null) { containerPage = new ContainerPage(); this.theGrid.Children.Add(containerPage); containerPage.SetValue(Grid.ColumnProperty, 2); containerPage.SetValue(Grid.RowProperty, 2); this.pageDict.Add(name, containerPage); // -------------------------------------- if (name == PanelManager.StationIntroduction) { containerPage.AddTab(name, "自动站", mainPage); // TODO: add other tab } else if (name == PanelManager.CurrentCommStatus) { containerPage.AddTab(name, "通信状态", mainPage); // TODO: add other tab } else if (name == PanelManager.HistoryCommStatus) { containerPage.AddTab(name, "历史通信状态", mainPage); // TODO: add other tab } else if (name == PanelManager.DataCounter) { containerPage.AddTab(name, "数据统计", mainPage); // TODO: add other tab } else if (name == PanelManager.DevicesRunStatus) { containerPage.AddTab(name, "设备管理", mainPage); // TODO: add other tab } else if (name == PanelManager.CinderellaRunStatus) { containerPage.AddTab(name, "Cinderella管理", mainPage); } } else { containerPage.SetValue(Grid.ColumnProperty, 2); containerPage.SetValue(Grid.RowProperty, 2); containerPage.Visibility = Visibility.Visible; } currentPanel = containerPage; }
public void SetPage(string name, UserControl mainPage) { ContainerPage containerPage = (ContainerPage)this.GetPage(name); if (containerPage == null) { containerPage = new ContainerPage(); this.theGrid.Children.Add(containerPage); containerPage.SetValue(Grid.ColumnProperty, 2); containerPage.SetValue(Grid.RowProperty, 2); this.pageDict.Add(name, containerPage); // -------------------------------------- if (name == PanelManager.StationIntroduction) { containerPage.AddTab(name, "自动站", mainPage); // TODO: add other tab } else if (name == PanelManager.CurrentCommStatus) { containerPage.AddTab(name, "通信状态", mainPage); // TODO: add other tab } else if (name == PanelManager.HistoryCommStatus) { containerPage.AddTab(name, "历史通信状态", mainPage); // TODO: add other tab } else if (name == PanelManager.DataCounter) { containerPage.AddTab(name, "数据统计", mainPage); // TODO: add other tab } else if (name == PanelManager.DevicesRunStatus) { containerPage.AddTab(name, "设备管理", mainPage); // TODO: add other tab } else if (name == PanelManager.CinderellaRunStatus) { containerPage.AddTab(name, "Cinderella管理", mainPage); } } else { containerPage.SetValue(Grid.ColumnProperty, 2); containerPage.SetValue(Grid.RowProperty, 2); containerPage.Visibility = Visibility.Visible; } if (this.currentPanel != null) { this.currentPanel.Visibility = Visibility.Hidden; } currentPanel = containerPage; }