Esempio n. 1
0
        private void ApplyChanges()
        {
            controller.BeginMacro();

            bool canContinue = ApplyClassChanges();

            if (canContinue)
            {
                canContinue = ApplyAttributeChanges();
            }
            if (canContinue)
            {
                canContinue = ApplyAssociationChanges();
            }

            if (!canContinue)
            {
                controller.CancelMacro();
            }
            else
            {
                error = false;
                CommandBase tmp = (CommandBase)controller.CreatedMacro;
                controller.CommitMacro();
            }

            Initialize(controller, psmClass);
            gridAttributes.Items.Refresh();
            gridAssociations.Items.Refresh();
        }
Esempio n. 2
0
        private void bApply_Click(object sender, RoutedEventArgs e)
        {
            bApply.Focus();

            error = false;

            controller.BeginMacro();

            var addedPIMAttributes = Process(projectVersion.GetAvailablePIMTypes(), projectVersion, PSMSchema, controller, fakePIMAttributeTypes);
            List <FakeAttributeType> addedPSMAttributes;

            if (fakePSMAttributeTypes != null)
            {
                addedPSMAttributes = Process(PSMSchema.GetAvailablePSMTypes(), projectVersion, PSMSchema, controller, fakePSMAttributeTypes);
            }
            else
            {
                addedPSMAttributes = null;
            }

            if (error)
            {
                controller.CancelMacro();
            }
            else
            {
                CommandBase tmp = (CommandBase)controller.CreatedMacro;
                controller.CommitMacro();
                if (string.IsNullOrEmpty(tmp.ErrorDescription))
                {
                    {
                        foreach (FakeAttributeType attribute in addedPIMAttributes)
                        {
                            attribute.SourceAttributeType = projectVersion.GetAvailablePIMTypes().Where
                                                                (property => property.Name == attribute.Name).SingleOrDefault();
                        }
                        addedPIMAttributes.RemoveAll(attribute => attribute.SourceAttributeType == null);
                    }

                    if (addedPSMAttributes != null)
                    {
                        foreach (FakeAttributeType attribute in addedPSMAttributes)
                        {
                            attribute.SourceAttributeType = PSMSchema.GetAvailablePSMTypes().Where
                                                                (property => property.Name == attribute.Name).SingleOrDefault();
                        }
                        addedPIMAttributes.RemoveAll(attribute => attribute.SourceAttributeType == null);
                    }

                    bApply.IsEnabled = false;
                    dialogReady      = true;
                    error            = false;
                }
                else
                {
                    error = true;
                }
            }
            gridPIMAttributeTypes.Items.Refresh();
        }