Пример #1
0
        public ClassDialog(ClassController classController, ModelController controller)
        {
            InitializeComponent();
            this.modelController = controller;
            this.classController = classController;
            if (classController is PSMClass)
            {
                isPSM = true;
            }
            this.Title = string.Format(this.Title, modelClass);

            tbName.Text = modelClass.Name;
            tbOnto.Text = modelClass.OntologyEquivalent;
            SubpackagesGetter    subpackagesGetter = new SubpackagesGetter(controller.Model);
            Collection <Package> packages          = subpackagesGetter.GetSubpackages(null);

            cbPackages.ItemsSource  = packages;
            cbPackages.SelectedItem = modelClass.Package;
            if (isPSM)
            {
                cbPackages.IsEnabled = false;
                psmAttributes        = new ObservableCollection <PSMAttribute>();
                checkedPSMAttributes = new ObservableCollection <PSMAttribute>();
                foreach (PSMAttribute item in ((PSMClass)classController).PSMAttributes)
                {
                    psmAttributes.Add(item);
                    checkedPSMAttributes.Add(item);
                }
            }
            else
            {
                attributes        = new ObservableCollection <Property>();
                checkedAttributes = new ObservableCollection <Property>();
                foreach (Property item in modelClass.Attributes)
                {
                    attributes.Add(item);
                    checkedAttributes.Add(item);
                }

                typeColumn.ItemsSource = classController.Class.Package.AllTypes;
                ObservableCollection <FakeAttribute> fakeAttributesList = new ObservableCollection <FakeAttribute>();
                foreach (Property property in attributes)
                {
                    fakeAttributesList.Add(new FakeAttribute(property));
                }
                fakeAttributes = new FakeAttributeCollection(fakeAttributesList);
                fakeAttributesList.CollectionChanged += delegate { UpdateApplyEnabled(); };
                gridAttributes.ItemsSource            = fakeAttributesList;
                dialogReady = true;

                if (classController.Class is Model.AssociationClass)
                {
                    cPackage.Visibility = Visibility.Hidden;
                }
            }
        }
Пример #2
0
        public SimpleDataTypeDialog(ModelController controller)
        {
            InitializeComponent();

            this.modelController = controller;

            cbParent.ItemsSource = modelController.Model.Schema.PrimitiveTypes;
            SubpackagesGetter subpackagesGetter = new SubpackagesGetter(controller.Model);

            cbPackage.ItemsSource   = subpackagesGetter.GetSubpackages(null);
            cbPackage.SelectedIndex = 0;
            cbParent.SelectedIndex  = 1;
            canvas5.Visibility      = Visibility.Collapsed;
        }
Пример #3
0
        public PackageDialog(Model.Package package, ModelController controller)
        {
            InitializeComponent();

            this.controller = controller;
            this.package    = package;
            this.Title      = string.Format("Package: {0}", package.QualifiedName);

            oldName     = package.Name;
            tbName.Text = package.Name;

            SubpackagesGetter    subpackagesGetter = new SubpackagesGetter(controller.Model);
            Collection <Package> packages          = subpackagesGetter.GetSubpackages(package);

            cbPackages.ItemsSource  = packages;
            cbPackages.SelectedItem = package.NestingPackage;
        }