// Updates the preview and settings group boxes private void updatePanels(BlockPanel block, SettingsBlock settingsBlock) { // If block is null, then display no preivew and no settings, otherwise... if (block != null) { // Clears the preview box, creates a block based on user input and inserts it in the dead middle of the preview group box previewGroupBox.Controls.Clear(); UserControl previewControl = block; previewGroupBox.Controls.Add(previewControl); previewControl.Location = new Point((previewGroupBox.Height / 2) - (previewControl.Size.Height / 2), (previewGroupBox.Width / 2) - (previewControl.Size.Width / 2)); // Clears the settings box, creates a settings block based on user input and inserts it into the settings group box settingsGroupBox.Controls.Clear(); UserControl newSettings = settingsBlock; newSettings.Location = new Point(1, 16); settingsGroupBox.Controls.Add((UserControl)newSettings); } else { // Clears both group boxes previewGroupBox.Controls.Clear(); settingsGroupBox.Controls.Clear(); // Adds a "No settings..." label if no item is selected in the combo box Label newLabel = new Label(); newLabel.Text = "The currently selected item has no settings or defaults to configure."; newLabel.Dock = DockStyle.Fill; newLabel.AutoSize = false; settingsGroupBox.Controls.Add(newLabel); } }
public void prepareForLoad() { this.blocksArray = new List <BlockPanel>(); for (int x = 0; x < this.stringBlocksArray.Count; x++) { Type type = Type.GetType(this.stringBlocksArray[x][0]); BlockPanel newBlock = (BlockPanel)Activator.CreateInstance(type); newBlock.applyProperties(this.stringBlocksArray[x]); this.blocksArray.Add(newBlock); } }
// Function that gets called from the add panels window to add a panel to the scene public void addBlockPanel(BlockPanel panel) { this.currentScene.addBlock(panel); updateForm(); }
public void addBlock(BlockPanel block) { block.setScenePath(this.folderPath); this.blocksArray.Add(block); }