示例#1
0
        private void CreateNewObjectButton_Click(object sender, EventArgs e)
        {
            if (NewObjectNameTextBox.Text == "")
            {
                MessageBox.Show("Please enter a name for the new object");
                return;
            }

            String newObjectName = m_MainForm.m_CurrentObjectsFolderName  +NewObjectNameTextBox.Text +".xml";

            if (ExposedObject.ObjectExists(newObjectName))
            {
                MessageBox.Show("An object with same name exists, change the name");
                return;
            }

            String objectTypeName = ObjectTypesComboBox.SelectedItem.ToString();

            ObjectType newObjectType = (ObjectType)m_MainForm.m_Database.GetDataType(objectTypeName);

            ObjectsTreeView objectsTreeView = m_MainForm.GetObjectsTree();

            ExposedObject newObject = new ExposedObject(newObjectType, newObjectName);
            newObject.Save();

            m_MainForm.RefreshNodes();
            this.Close();

            // check for repeated names...

            // create a new object object of the desired type and name..
            // the name will be contatenaded from the active path
        }