public void AddTab(string tabName, GroupOverview groupOverview, Group group = null) { if (groupEditors.Count == 0) { header = new Border() { Height = 30, Margin = new Thickness(10), BorderThickness = new Thickness(0, 1, 0, 1), BorderBrush = new SolidColorBrush(Colors.White) }; TextBlock textBlock = new TextBlock { Text = "Editors", FontSize = 16, Foreground = new SolidColorBrush(Colors.White), VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center }; header.Child = textBlock; Tabs.Children.Add(header); } if (CheckIfTabExists(tabName) && group != null) { } else { tabName = AddNewWhenTabExists(tabName); string tabNameWithoutSpaces = System.Text.RegularExpressions.Regex.Replace(tabName, @"\s+", ""); Border tab = new Border() { Name = $"Btn{tabNameWithoutSpaces}", Height = 40 }; tab.MouseEnter += Tab_MouseEnter; tab.MouseLeave += Tab_MouseLeave; tab.MouseLeftButtonUp += Tab_MouseUp; TextBlock textBlock = new TextBlock { Text = tabName, FontSize = 16, Foreground = new SolidColorBrush(Colors.White), Margin = new Thickness(10, 0, 10, 0), TextAlignment = TextAlignment.Center, VerticalAlignment = VerticalAlignment.Center, TextTrimming = TextTrimming.CharacterEllipsis }; tab.Child = textBlock; Tabs.Children.Add(tab); if (group != null) { groupEditors.Add(new GroupEditor(groupOverview, tab, group)); } else { groupEditors.Add(new GroupEditor(groupOverview, tab, tabName)); } SetActiveTab(tabNameWithoutSpaces, groupEditors[groupEditors.Count - 1]); } }
public CtlGroup(GroupOverview groupOverview, Group group, MainWindow mainWindow) { InitializeComponent(); GroupOverview = groupOverview; Group = group; MainWindow = mainWindow; LblBackgroundColor.Background = new SolidColorBrush(ImageFunctions.FromString(Group.BackgroundColor)); ImgGroupIcon.Source = Group.LoadGroupImage(); LblGroupname.Text = Group.Name; if (!Directory.Exists($@"{Paths.GroupsPath}\{Group.Name}\Icons\")) { Group.CacheImages(); } foreach (Shortcut shortcut in Group.ShortcutList) { CreateShortcut(shortcut); } }