private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (tabRepository.SelectedItem != null) { foreach (TabItem tab in tabRepository.Items) { foreach (object ctrl in ((StackPanel)(tab.Header)).Children) { if (ctrl.GetType() == typeof(TextBlock)) { if (tabRepository.SelectedItem == tab) { ((TextBlock)ctrl).Foreground = (SolidColorBrush)FindResource("$SelectionColor_Pink"); } else { ((TextBlock)ctrl).Foreground = (SolidColorBrush)FindResource("$Color_DarkBlue"); } ((TextBlock)ctrl).FontWeight = FontWeights.Bold; } } } } } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "Error in Action Edit Page tabs style", ex); } // We do load on demand if (tabRepository.SelectedItem == tbActivitiesGroups) { if (((string)tbActivitiesGroups.Tag) != "Done") { ActivitiesGroupsRepoPage = new ActivitiesGroupsRepositoryPage(WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder <ActivitiesGroup>(), mBusinessFlow); frmActivitiesGroups.Content = ActivitiesGroupsRepoPage; // Mark that this tab is loaded with info tbActivitiesGroups.Tag = "Done"; } } if (tabRepository.SelectedItem == tbiActivities) { if (((string)tbiActivities.Tag) != "Done") { ActivitiesRepoPage = new ActivitiesRepositoryPage(WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder <Activity>(), mBusinessFlow); frmActivities.Content = ActivitiesRepoPage; // Mark that this tab is loaded with info tbiActivities.Tag = "Done"; } } if (tabRepository.SelectedItem == tbiActions) { if (((string)tbiActions.Tag) != "Done") { ActionsRepoPage = new ActionsRepositoryPage(WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder <Act>()); frmActions.Content = ActionsRepoPage; // Mark that this tab is loaded with info tbiActions.Tag = "Done"; } } if (tabRepository.SelectedItem == tbiVariables) { if (((string)tbiVariables.Tag) != "Done") { VariablesRepoPage = new VariablesRepositoryPage(WorkSpace.Instance.SolutionRepository.GetRepositoryItemRootFolder <VariableBase>()); frmVariables.Content = VariablesRepoPage; // Mark that this tab is loaded with info tbiVariables.Tag = "Done"; } } }
private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (tabRepository.SelectedItem != null) { foreach (TabItem tab in tabRepository.Items) { foreach (object ctrl in ((StackPanel)(tab.Header)).Children) { if (ctrl.GetType() == typeof(TextBlock)) { if (tabRepository.SelectedItem == tab) { ((TextBlock)ctrl).Foreground = (SolidColorBrush)FindResource("@Skin1_ColorB"); } else { ((TextBlock)ctrl).Foreground = (SolidColorBrush)FindResource("@Skin1_ColorA"); } ((TextBlock)ctrl).FontWeight = FontWeights.Bold; } } } } } catch (Exception ex) { Reporter.ToLog(eLogLevel.ERROR, "Error in Action Edit Page tabs style", ex); } // We do looad on demand if (tabRepository.SelectedItem == tbiActivitiesGroups) { if (((string)tbiActivitiesGroups.Tag) != "Done") { ActivitiesGroupsRepoPage = new ActivitiesGroupsRepositoryPage(App.UserProfile.Solution.Folder + @"\SharedRepository\ActivitiesGroups", mBusinessFlow); frmActivitiesGroups.Content = ActivitiesGroupsRepoPage; // Mark that this tab is loaded with info tbiActivitiesGroups.Tag = "Done"; } } if (tabRepository.SelectedItem == tbiActivities) { if (((string)tbiActivities.Tag) != "Done") { ActivitiesRepoPage = new ActivitiesRepositoryPage(App.UserProfile.Solution.Folder + @"\SharedRepository\Activities", mBusinessFlow); frmActivities.Content = ActivitiesRepoPage; // Mark that this tab is loaded with info tbiActivities.Tag = "Done"; } } if (tabRepository.SelectedItem == tbiActions) { if (((string)tbiActions.Tag) != "Done") { ActionsRepoPage = new ActionsRepositoryPage(App.UserProfile.Solution.Folder + @"\SharedRepository\Actions"); frmActions.Content = ActionsRepoPage; // Mark that this tab is loaded with info tbiActions.Tag = "Done"; } } if (tabRepository.SelectedItem == tbiVariables) { if (((string)tbiVariables.Tag) != "Done") { VariablesRepoPage = new VariablesRepositoryPage(App.UserProfile.Solution.Folder + @"\SharedRepository\Variables"); frmVariables.Content = VariablesRepoPage; // Mark that this tab is loaded with info tbiVariables.Tag = "Done"; } } }