示例#1
0
        public void Initialize(Exolutio.Controller.Controller controller, PIMClass PIMClass, PIMAttribute initialSelectedAttribute = null)
        {
            this.controller = controller;
            this.PIMClass   = PIMClass;

            this.Title = string.Format(this.Title, PIMClass);

            tbName.Text = PIMClass.Name;
            //tbElementLabel.Text = PIMClass.ElementName;
            //cbAbstract.IsChecked = PIMClass.IsAbstract;
            //cbAnyAttribute.IsChecked = PIMClass.AllowAnyAttribute;

            typeColumn.ItemsSource = PIMClass.ProjectVersion.GetAvailablePIMTypes();

            fakeAttributesList = new ObservableCollection <FakePIMAttribute>();

            fakeAttributes = new FakeAttributeCollection(fakeAttributesList, PIMClass);
            fakeAttributesList.CollectionChanged += delegate { UpdateApplyEnabled(); };
            gridAttributes.ItemsSource            = fakeAttributesList;

            if (initialSelectedAttribute != null)
            {
                gridAttributes.SelectedItem = fakeAttributesList.SingleOrDefault(fa => fa.SourceAttribute == initialSelectedAttribute);
            }

            dialogReady      = true;
            bApply.IsEnabled = false;
        }
示例#2
0
        public void Initialize(Exolutio.Controller.Controller controller, PSMClass psmClass)
        {
            this.controller = controller;
            this.psmClass   = psmClass;

            //this.Title = string.Format(this.Title, psmClass);

            tbName.Text = psmClass.Name;
            //tbElementLabel.Text = psmClass.ElementName;
            //cbAbstract.IsChecked = psmClass.IsAbstract;
            //cbAnyAttribute.IsChecked = psmClass.AllowAnyAttribute;

            /*
             * typeColumn.ItemsSource = psmClass.ProjectVersion.AttributeTypes;
             * if (psmClass.Interpretation != null)
             * {
             *  CompositeCollection coll = new CompositeCollection();
             *  //coll.Add("(None)");
             *  coll.Add(new CollectionContainer { Collection = ((PIMClass)psmClass.Interpretation).PIMAttributes });
             *  interpretationColumn.ItemsSource = coll;
             * }
             */

            ObservableCollection <FakePSMAttribute> fakeAttributesList = new ObservableCollection <FakePSMAttribute>();

            foreach (PSMAttribute psmAttribute in psmClass.PSMAttributes)
            {
                fakeAttributesList.Add(new FakePSMAttribute(psmAttribute));
            }

            bool classEmpty = psmClass.PSMAttributes.Count == 0;

            if (psmClass.Interpretation != null)
            {
                foreach (PIMAttribute attribute in ((PIMClass)psmClass.Interpretation).PIMAttributes)
                {
                    if (!fakeAttributesList.Any(p => p.SourceAttribute != null && p.SourceAttribute.Interpretation == attribute))
                    {
                        fakeAttributesList.Add(new FakePSMAttribute(attribute)
                        {
                            Checked = classEmpty
                        });
                    }
                }
            }
            fakeAttributes = new PagedCollectionView(fakeAttributesList);
            fakeAttributesList.CollectionChanged += delegate { UpdateApplyEnabled(); };
            gridAttributes.ItemsSource            = fakeAttributesList;

            dialogReady = true;
        }
示例#3
0
        public void Initialize(Exolutio.Controller.Controller controller, ProjectVersion projectVersion, PSMSchema psmSchema)
        {
            this.controller     = controller;
            this.projectVersion = projectVersion;

            this.cbPSMSchema.ItemsSource = projectVersion.PSMSchemas;
            if (psmSchema != null)
            {
                this.cbPSMSchema.SelectedItem = psmSchema;
            }

            IEnumerable <AttributeType> existingPIMTypes = this.projectVersion.GetAvailablePIMTypes();

            baseTypeColumnPIM.ItemsSource = existingPIMTypes;
            ObservableCollection <FakeAttributeType> fakePIMAttributeTypesList = new ObservableCollection <FakeAttributeType>();

            fakePIMAttributeTypes = new FakeAttributeTypeCollection(fakePIMAttributeTypesList, existingPIMTypes);
            fakePIMAttributeTypesList.CollectionChanged += delegate { UpdateApplyEnabled(); };
            gridPIMAttributeTypes.ItemsSource            = fakePIMAttributeTypesList;

            if (psmSchema != null)
            {
                PSMSchema = psmSchema;
                IEnumerable <AttributeType> existingPSMTypes = PSMSchema.GetAvailablePSMTypes();
                baseTypeColumnPSM.ItemsSource = existingPSMTypes;
                ObservableCollection <FakeAttributeType> fakePSMAttributeTypesList =
                    new ObservableCollection <FakeAttributeType>();
                fakePSMAttributeTypes = new FakeAttributeTypeCollection(fakePSMAttributeTypesList, existingPSMTypes);
                fakePSMAttributeTypesList.CollectionChanged += delegate { UpdateApplyEnabled(); };
                gridPSMAttributeTypes.ItemsSource            = fakePSMAttributeTypesList;
            }
            else
            {
                PSMSchema = null;
            }

            dialogReady      = true;
            bApply.IsEnabled = false;
        }