private void MenuStatistics_Click(object sender, RoutedEventArgs e) { //If found tab was Statistics, selected for Tabcontrol var index = TabControlManagement.GetIndexByTitle(MainTabControl, UsecaseStringContants.statistics); if (index >= 0) { MainTabControl.SelectedIndex = index; } //If not found tab was Statistics, add and selected else { StatisticsUserControl statisticsUserControl = new StatisticsUserControl(); CustomTabItem customTabItem = new CustomTabItem() { Title = UsecaseStringContants.statistics, Content = statisticsUserControl }; MainTabControl.Items.Add(customTabItem); MainTabControl.SelectedItem = customTabItem; } CurrenTabTitle.Content = UsecaseStringContants.statistics; this.Title = UsecaseStringContants.statistics; }
/// <summary> /// Switch to the screen statistics. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ButtonStatistics_Click(object sender, EventArgs e) { StatisticsUserControl statisticsUserControl = new StatisticsUserControl(); SwitchView(statisticsUserControl, ((Button)sender)); }