예제 #1
0
 /// <summary>
 /// Create new event data.
 /// </summary>
 /// <param name="container">Identification of the container</param>
 /// <param name="reason">The reason</param>
 /// <param name="thisRef">Changed Referable itself</param>
 /// <param name="parentRef">A Referable, which contains the changed Referable.</param>
 /// <param name="createAtIndex">If create, at which index; else: -1</param>
 /// <param name="info">Human readable information</param>
 public PackCntChangeEventData(PackageContainerBase container,
                               PackCntChangeEventReason reason,
                               AdminShell.Referable thisRef   = null,
                               AdminShell.Referable parentRef = null,
                               int createAtIndex = -1,
                               string info       = null)
 {
     Container  = container;
     Reason     = reason;
     ThisElem   = thisRef;
     ParentElem = parentRef;
     NewIndex   = createAtIndex;
     Info       = info;
 }
예제 #2
0
        public void DispMultiElementCutCopyPasteHelper(
            AnyUiPanel stack,
            ModifyRepo repo,
            AdminShell.AdministrationShellEnv env,
            AdminShell.IAasElement parentContainer,
            CopyPasteBuffer cpb,
            ListOfVisualElementBasic entities,
            string label = "Buffer:")
        {
            // access
            if (parentContainer == null || cpb == null || entities == null)
            {
                return;
            }

            // use an action
            this.AddAction(
                stack, label,
                new[] { "Cut", "Copy" }, repo,
                actionTags: new[] { "aas-multi-elem-cut", "aas-multi-elem-copy" },
                action: (buttonNdx) =>
            {
                if (buttonNdx == 0 || buttonNdx == 1)
                {
                    // store info
                    cpb.Clear();
                    cpb.Valid     = true;
                    cpb.Duplicate = buttonNdx == 1;

                    cpb.Items = new ListOfCopyPasteItem();
                    foreach (var el in entities)
                    {
                        if (el is VisualElementSubmodelElement vesme &&
                            parentContainer is AdminShell.Referable pcref)
                        {
                            var sme = vesme.theWrapper?.submodelElement;
                            AdminShell.EnumerationPlacmentBase placement = null;
                            if (parentContainer is AdminShell.IEnumerateChildren enc)
                            {
                                placement = enc.GetChildrenPlacement(sme);
                            }
                            cpb.Items.Add(new CopyPasteItemSME(env, pcref,
                                                               vesme.theWrapper, sme, placement));
                        }

                        if (el is VisualElementSubmodelRef vesmr)
                        {
                            cpb.Items.Add(new CopyPasteItemSubmodel(parentContainer, vesmr.theSubmodelRef,
                                                                    vesmr.theSubmodelRef, vesmr.theSubmodel));
                        }

                        if (el is VisualElementSubmodel vesm)
                        {
                            cpb.Items.Add(new CopyPasteItemSubmodel(parentContainer, vesm.theSubmodel,
                                                                    null, vesm.theSubmodel));
                        }

                        if (el is VisualElementOperationVariable veopv &&
                            parentContainer is AdminShell.Referable pcref2)
                        {
                            if (veopv.theOpVar?.value != null)
                            {
                                cpb.Items.Add(new CopyPasteItemSME(env, pcref2,
                                                                   veopv.theOpVar.value, veopv.theOpVar.value?.submodelElement));
                            }
                        }

                        if (el is VisualElementConceptDescription vecd)
                        {
                            cpb.Items.Add(new CopyPasteItemIdentifiable(parentContainer, vecd.theCD));
                        }

                        if (el is VisualElementAsset veass)
                        {
                            cpb.Items.Add(new CopyPasteItemIdentifiable(parentContainer, veass.theAsset));
                        }

                        if (el is VisualElementAdminShell veaas)
                        {
                            cpb.Items.Add(new CopyPasteItemIdentifiable(parentContainer, veaas.theAas));
                        }
                    }