private void Edit(int rowIndex)
        {
            DataGridViewRow row = this.gridData.Rows[rowIndex];

            if (row.Tag != null)
            {
                ObjectData       data = (ObjectData)row.Tag;
                FormDataAbstract form;
                if (!string.IsNullOrEmpty(data.ObjectClass.Form))
                {
                    XmlDocument doc = new XmlDocument();
                    try
                    {
                        doc.LoadXml(data.ObjectClass.Form);
                        form = new FormUserData(this, Database, doc);
                    }
                    catch (XmlException)
                    {
                        form = new FormDataObject(this, Database);
                    }
                }
                else
                {
                    form = new FormDataObject(this, Database);
                }

                if (form.ModifyObjectData(data))
                {
                    this.UpdateObjectData(row, data);
                }
            }
        }
        public ObjectData Add(ObjectClass objectClass, bool selectData)
        {
            FormDataAbstract form;

            if (!string.IsNullOrEmpty(objectClass.Form))
            {
                XmlDocument doc = new XmlDocument();
                try
                {
                    doc.LoadXml(objectClass.Form);
                    form = new FormUserData(this, Database, doc);
                }
                catch (XmlException)
                {
                    form = new FormDataObject(this, Database);
                }
            }
            else
            {
                form = new FormDataObject(this, Database);
            }

            if (form.CreateObjectData(objectClass))
            {
                this.BeginUpdate();
                try
                {
                    if (this.filter != null && form.Obj.Filter(this.filter))
                    {
                        this.AddRow(form.Obj);
                    }
                    else
                    {
                        bool objectInCategory = App.Folder.CurrentCategory == form.Obj.ObjectClass.Category;
                        App.Folder.CreateTree(this.folder);
                        if (!string.IsNullOrEmpty(this.filterText))
                        {
                            App.Folder.SelectFolder(this.folder, this.filterText, string.Empty);
                        }
                        else if (objectInCategory)
                        {
                            if (this.folder == null || form.Obj.Filter(this.folder, this.filterText))
                            {
                                this.AddRow(form.Obj);
                            }
                        }
                    }
                }
                finally
                {
                    this.EndUpdate();
                }

                if (selectData)
                {
                    this.SelectObjectData(form.Obj);
                }

                return(form.Obj);
            }

            return(null);
        }