示例#1
0
        public Folder Show(Folder folder, string category)
        {
            this.newFolder = folder == null;
            this.cat       = category;
            this.CreateListClasses();
            if (folder != null)
            {
                textName.Text = folder.Name;
                foreach (ObjectClass obj in folder.Classes)
                {
                    if (obj.CreatingObjects)
                    {
                        listClasses.SetItemChecked(listClasses.Items.IndexOf(obj), true);
                    }
                }
            }

            if (ShowDialog() == DialogResult.OK)
            {
                if (folder == null)
                {
                    folder = Database.Folders.Create(textName.Text, this.cat);
                }
                else
                {
                    folder.Name = textName.Text;
                    folder.ClearClasses();
                }

                folder.AddRangeClass(listClasses.CheckedItems);
                this.Database.Folders.Update(folder);

                return(folder);
            }
            else
            {
                return(null);
            }
        }