private void PropertyGrid_OnValueChanged(object s, PropertyValueChangedEventArgs e)
        {
            // Check if property 'Hash' needs to be updated
            if (PropertyGrid_Item.SelectedObject is EntityDataStorageLoader)
            {
                if (e.ChangedItem.Label.Equals("Hash"))
                {
                    string NewEntityName = string.Format("Entity [{0}]", e.ChangedItem.Value);
                    TreeView_Tables.SelectedNode.Text = NewEntityName;
                    TreeView_Tables.SelectedNode.Name = NewEntityName;
                }
                else
                {
                    EntityDataStorageLoader EDSLoader = (PropertyGrid_Item.SelectedObject as EntityDataStorageLoader);
                    string NewEntityName = string.Format("Entity [{0}]", EDSLoader.Hash);

                    Debug.Assert(EDSLoader.TableHashes.Length == TreeView_Tables.SelectedNode.Nodes.Count, "WARNING: This editor does not support deleting/adding new tables. " +
                                 "The length of 'TableHashes' NEEDS to equal the same amount of child nodes attached to " + NewEntityName);

                    int Index = 0;
                    foreach (TreeNode ChildNode in TreeView_Tables.SelectedNode.Nodes)
                    {
                        string NewTableName = string.Format("Table [{0}]", EDSLoader.TableHashes[Index]);
                        ChildNode.Text = NewTableName;
                        ChildNode.Name = NewTableName;

                        Index++;
                    }
                }
            }
        }
        private void LoadAndBuildData()
        {
            tables = new EntityDataStorageLoader();
            tables.ReadFromFile(edsFile.FullName, false);

            CreateTable();
        }
Ejemplo n.º 3
0
        private void BuildData()
        {
            tables = new EntityDataStorageLoader();
            tables.ReadFromFile(edsFile.FullName, false);

            TreeNode entityNode = new TreeNode("Entity");

            entityNode.Tag = tables;
            TreeView_Tables.Nodes.Add(entityNode);

            if (tables.Tables != null)
            {
                for (int i = 0; i < tables.Tables.Length; i++)
                {
                    TreeNode node = new TreeNode("Table_" + i);
                    node.Tag = tables.Tables[i];
                    entityNode.Nodes.Add(node);
                }
            }
        }