internal static void LoadGrid(MainWindow window, string line) { string[] splitted = line.Split(Space0); ImageGrid imageGrid = ImageGrid.FromString(splitted[1], window); int id = int.Parse(imageGrid.id.Substring(5)); TabItem newTab = new TabItem { Background = window.Transparent, Foreground = window.White, VerticalContentAlignment = VerticalAlignment.Stretch, HorizontalContentAlignment = HorizontalAlignment.Stretch, }; newTab.Visibility = Visibility.Visible; StackPanel stack = new StackPanel { Orientation = Orientation.Vertical, }; StackPanel sp = new StackPanel { Orientation = Orientation.Horizontal }; TextBox tb = new TextBox { Text = imageGrid.name, Background = window.Transparent, Foreground = window.White, Margin = new Thickness(0, 0, 5, 0), FontWeight = FontWeights.Bold, VerticalAlignment = VerticalAlignment.Center, Width = 130, }; sp.Children.Add(tb); tb.TextChanged += ((s, e) => imageGrid.name = tb.Text); StackPanel cp = new StackPanel { Orientation = Orientation.Vertical }; CheckBox cbtraining = new CheckBox { Content = "Training", Foreground = window.White, Name = "train" + id, }; cbtraining.Checked += window.Cbtraining_Checked; cbtraining.Unchecked += window.Cbtraining_Unchecked; cp.Children.Add(cbtraining); CheckBox cbtesting = new CheckBox { Content = "Testing", Foreground = window.White, Name = "test" + id, }; cbtesting.Checked += window.Cbtesting_Checked; cbtesting.Unchecked += window.Cbtesting_Unchecked; cp.Children.Add(cbtesting); if (bool.Parse(splitted[2])) { cbtesting.IsChecked = true; } if (bool.Parse(splitted[3])) { cbtraining.IsChecked = true; } sp.Children.Add(cp); Button deleteImage = new Button { Content = "x", Name = "deleteIm" + id, Background = window.SteelRed, Foreground = window.White, Margin = new Thickness(5, 0, 0, 0), Width = 20, Height = 20, VerticalAlignment = VerticalAlignment.Center }; deleteImage.Click += window.DeleteImage; sp.Children.Add(deleteImage); stack.Children.Add(sp); StackPanel SubOptions = new StackPanel { Orientation = Orientation.Vertical, Name = "sub", Background = window.Transparent, VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch, Margin = new Thickness(55, 5, 5, 5), }; stack.Children.Add(SubOptions); newTab.Header = stack; window.ImageTab.Items.Add(newTab); newTab.Name = "tab_" + id; Grid grid = new Grid { Background = window.DarkBackground, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, }; grid.ColumnDefinitions.Add(new ColumnDefinition()); grid.RowDefinitions.Add(new RowDefinition()); grid.Children.Add(imageGrid.grid); Grid.SetColumn(imageGrid.grid, 0); Grid.SetRow(imageGrid.grid, 0); newTab.Content = grid; window.ImageTab.SelectedItem = newTab; CheckBox checkbox = new CheckBox { Name = "BaseLayer" + id, Content = "Base Layer", Foreground = window.White, IsChecked = true, }; checkbox.Checked += ((s, e) => { foreach (ImageTile it in imageGrid.tiles) { it.baseImage.Visibility = Visibility.Visible; } }); checkbox.Unchecked += ((s, e) => { foreach (ImageTile it in imageGrid.tiles) { it.baseImage.Visibility = Visibility.Hidden; } }); SubOptions.Children.Add(checkbox); CheckBox checkbox2 = new CheckBox { Name = "Heightmap" + id, Content = "Heightmap", Foreground = window.White, IsChecked = true, }; checkbox2.Checked += ((s, e) => { foreach (ImageTile it in imageGrid.tiles) { it.heightmap.Visibility = Visibility.Visible; } }); checkbox2.Unchecked += ((s, e) => { foreach (ImageTile it in imageGrid.tiles) { it.heightmap.Visibility = Visibility.Hidden; } }); SubOptions.Children.Add(checkbox2); MainWindow.imageGridIdCount = Math.Max(id + 1, MainWindow.imageGridIdCount + 1); }