private void FormDefineEditor_Load(object sender, EventArgs e) { try { this.BlockIdList = BlockDefinitionStore.LoadBlockDefinitions(); this.Tree = CategoryTree.Load(CategoryTree.CATEGORY_TREE_FILE); this.AddSubCategories(this.Tree.SubCategories, 0); var table = new DataTable(); table.Columns.Add("UID"); table.Columns.Add("Name"); table.Columns.Add("Wdith"); table.Columns.Add("Height"); table.Columns.Add("Length"); table.Columns.Add("Definitions"); table.Columns.Add("Category"); table.Columns.Add("Grouped"); table.Columns.Add("IsSubconstruction"); foreach (var item in this.BlockIdList.Values) { table.Rows.Add(new object[] { item.Uid, item.Name, item.Width, item.Height, item.Length, item.Defined, item.Category, item.Grouped, item.IsSubconstruction }); } this.dataGridView1.DataSource = table; } catch (Exception ex) { Console.WriteLine(ex.ToString()); MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void FormBlockErase_Load(object sender, EventArgs e) { try { this.Tree = CategoryTree.Load(CategoryTree.CATEGORY_TREE_FILE); this.Blueprint.LoadBlocks(); this.BlockDefinitions = this.Blueprint.BlockDefinitions; // BlockDefinitionStore.LoadBlockDefinitions(); this.treeBlocks.Nodes.Clear(); this.AddTreeNode(this.Tree, null); { var node = new TreeNode("unknown"); var list = this.BlockDefinitions.Where(w => string.IsNullOrEmpty(w.Value.Category)).ToList(); foreach (var item in list) { var block = this.BlockDefinitions[item.Key]; node.Nodes.Add(block.Name).Tag = block; } this.treeBlocks.Nodes.Add(node); } { var node = new TreeNode("undefined"); this.treeBlocks.Nodes.Add(node); } this.cmbColor.Items.Clear(); for (int i = 0; i < 32; i++) { var index = this.cmbColor.Items.Add(i); } this.cmbColor.SelectedIndex = 0; this.chkObjects.Items.Clear(); this.chkObjects.Items.Add("main object", true); this.chkObjects.Items.Add("sub object", true); this.lblName.Text = this.Blueprint.Name; this.FillCondition(); this.pictureBox1.Image = this.Blueprint.GetBmp(this.BlockDefinitions, this.TargetCondition, this.inputZoom.Value); } catch (Exception ex) { Console.WriteLine(ex.ToString()); MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }