Esempio n. 1
0
        private void DetailsToolPanel_AddClicked(object arg1, RoutedEventArgs arg2)
        {
            /*- if (!ProductDirector.ConfirmImmediateApply("IdeaEditing.DetailAdd", "ApplyDialogChangesDirectly"))
             *      return; */

            var DetailOptions = new List <IRecognizableElement>();

            DetailOptions.Add(new SimplePresentationElement(AttachmentDetailDesignator.KindTitle, AttachmentDetailDesignator.KindName, AttachmentDetailDesignator.KindSummary, AttachmentDetailDesignator.KindPictogram));
            DetailOptions.Add(new SimplePresentationElement(LinkDetailDesignator.KindTitle, LinkDetailDesignator.KindName, LinkDetailDesignator.KindSummary, LinkDetailDesignator.KindPictogram));

            if (ProductDirector.ValidateEditionPermission(AppExec.LIC_EDITION_LITE, "designate Table detail", false))
            {
                DetailOptions.Add(new SimplePresentationElement(TableDetailDesignator.KindTitle, TableDetailDesignator.KindName, TableDetailDesignator.KindSummary, TableDetailDesignator.KindPictogram));
            }

            var DetailToCreate = Display.DialogMultiOption("Designation of Detail", "Select the type of detail to be designated...", "",
                                                           null, true, TableDetailDesignator.KindName, DetailOptions.ToArray());

            if (DetailToCreate == null)
            {
                return;
            }

            var SelectedDetailOption         = DetailOptions.FirstOrDefault(det => det.TechName == DetailToCreate);
            var DesignationName              = SelectedDetailOption.Name + " - Detail Definition " + (this.DetailsSource.Count + 1).ToString();
            DetailDefinitionCard NewEditCard = null;
            var Owner = Ownership.Create <IdeaDefinition, Idea>(this.SourceDefinitor);

            DetailDesignator CreatedDesignation = null;

            if (DetailToCreate == TableDetailDesignator.KindName)
            {
                CreatedDesignation = DomainServices.CreateTableDesignation(this.SourceEngine, Owner, DesignationName);
            }
            else
            if (DetailToCreate == AttachmentDetailDesignator.KindName)
            {
                CreatedDesignation = DomainServices.CreateAttachmentDesignation(Owner, DesignationName);
            }
            else
            if (DetailToCreate == LinkDetailDesignator.KindName)
            {
                CreatedDesignation = DomainServices.CreateLinkDesignation(Owner, DesignationName);
            }

            if (CreatedDesignation == null)
            {
                return;
            }

            NewEditCard = new DetailDefinitionCard(false, new Assignment <DetailDesignator>(CreatedDesignation, this.DetailsSourceIsGlobal));

            this.DetailsSource.Add(NewEditCard);
            this.DetailsListBox.SelectedItem = NewEditCard;
        }