コード例 #1
0
        public VisualElementOperationVariable(
            VisualElementGeneric parent, TreeViewLineCache cache, AdminShell.AdministrationShellEnv env,
            AdminShell.Referable parentContainer, AdminShell.OperationVariable opvar,
            AdminShell.OperationVariable.Direction dir)
            : base()
        {
            this.Parent       = parent;
            this.Cache        = cache;
            this.theEnv       = env;
            this.theContainer = parentContainer;
            this.theOpVar     = opvar;
            this.theDir       = dir;

            this.Background = Brushes.White;
            this.Border     = Brushes.White;
            this.TagBg      = (SolidColorBrush)System.Windows.Application.Current.Resources["DarkestAccentColor"];
            this.TagFg      = Brushes.White;

            this.TagString = "In";
            if (this.theDir == AdminShell.OperationVariable.Direction.Out)
            {
                this.TagString = "Out";
            }
            if (this.theDir == AdminShell.OperationVariable.Direction.InOut)
            {
                this.TagString = "InOut";
            }

            this.TagBg = (SolidColorBrush)(new BrushConverter().ConvertFrom("#707070"));;
            this.TagFg = Brushes.White;
            RefreshFromMainData();
            RestoreFromCache();
        }
コード例 #2
0
ファイル: VisualAasxElements.cs プロジェクト: i-Asset/basyx
 public VisualElementEnvironmentItem(VisualElementGeneric parent, TreeViewLineCache cache, AdminShell.PackageEnv package, AdminShell.AdministrationShellEnv env, ItemType itemType)
     : base()
 {
     this.Parent      = parent;
     this.Cache       = cache;
     this.thePackage  = package;
     this.theEnv      = env;
     this.theItemType = itemType;
     this.Background  = (SolidColorBrush)(new BrushConverter().ConvertFrom("#B0B0B0"));
     this.Border      = (SolidColorBrush)(new BrushConverter().ConvertFrom("#404040"));
     this.Caption     = $"\"{ItemTypeNames[(int)itemType]}\"";
     this.Info        = "";
     this.IsTopLevel  = true;
     this.TagString   = "Env";
     if (theItemType == ItemType.EmptySet)
     {
         this.TagString = "\u2205";
         this.Caption   = "No information available";
     }
     if (theItemType == ItemType.Package && thePackage != null)
     {
         this.TagString = "\u25a2";
         this.Info     += "" + thePackage.Filename;
     }
     this.TagBg = this.Border;
     this.TagFg = Brushes.White;
     RestoreFromCache();
 }
コード例 #3
0
        public VisualElementPluginExtension(
            VisualElementGeneric parent,
            TreeViewLineCache cache,
            AdminShellPackageEnv package,
            AdminShell.Referable referable,
            Plugins.PluginInstance plugin,
            AasxIntegrationBase.AasxPluginResultVisualExtension ext)
            : base()
        {
            this.Parent       = parent;
            this.Cache        = cache;
            this.thePackage   = package;
            this.theReferable = referable;
            this.thePlugin    = plugin;
            this.theExt       = ext;

            this.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#A0A0A0"));
            this.Border     = (SolidColorBrush)(new BrushConverter().ConvertFrom("#707070"));
            this.TagBg      = (SolidColorBrush)System.Windows.Application.Current.Resources["DarkestAccentColor"];
            this.TagFg      = Brushes.White;

            this.TagString = "" + ext?.Tag;

            RefreshFromMainData();
            RestoreFromCache();
        }
コード例 #4
0
        public VisualElementEnvironmentItem(
            VisualElementGeneric parent, TreeViewLineCache cache, AdminShellPackageEnv package,
            AdminShell.AdministrationShellEnv env, ItemType itemType)
            : base()
        {
            this.Parent      = parent;
            this.Cache       = cache;
            this.thePackage  = package;
            this.theEnv      = env;
            this.theItemType = itemType;

            this.Background = (SolidColorBrush)System.Windows.Application.Current.Resources["DarkAccentColor"];
            this.Border     = (SolidColorBrush)System.Windows.Application.Current.Resources["DarkestAccentColor"];
            this.TagBg      = (SolidColorBrush)System.Windows.Application.Current.Resources["DarkestAccentColor"];
            this.TagFg      = Brushes.White;

            this.Caption    = $"\"{ItemTypeNames[(int)itemType]}\"";
            this.Info       = "";
            this.IsTopLevel = true;
            this.TagString  = "Env";
            if (theItemType == ItemType.EmptySet)
            {
                this.TagString = "\u2205";
                this.Caption   = "No information available";
            }
            if (theItemType == ItemType.Package && thePackage != null)
            {
                this.TagString = "\u25a2";
                this.Info     += "" + thePackage.Filename;
            }
            RestoreFromCache();
        }
コード例 #5
0
ファイル: VisualAasxElements.cs プロジェクト: i-Asset/basyx
 public VisualElementAdminShell(VisualElementGeneric parent, TreeViewLineCache cache, AdminShell.AdministrationShellEnv env, AdminShell.AdministrationShell aas)
     : base()
 {
     this.Parent     = parent;
     this.Cache      = cache;
     this.theEnv     = env;
     this.theAas     = aas;
     this.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#88A6D2"));
     this.Border     = (SolidColorBrush)(new BrushConverter().ConvertFrom("#4370B3"));
     this.TagString  = "AAS";
     this.TagBg      = this.Border;
     this.TagFg      = Brushes.White;
     RefreshFromMainData();
     RestoreFromCache();
 }
コード例 #6
0
ファイル: VisualAasxElements.cs プロジェクト: i-Asset/basyx
 public VisualElementSupplementalFile(VisualElementGeneric parent, TreeViewLineCache cache, AdminShell.PackageEnv package, AdminShell.PackageSupplementaryFile sf)
     : base()
 {
     this.Parent     = parent;
     this.Cache      = cache;
     this.thePackage = package;
     this.theFile    = sf;
     this.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#D0D0D0"));
     this.Border     = (SolidColorBrush)(new BrushConverter().ConvertFrom("#606060"));
     this.TagString  = "\u25a4";
     this.TagBg      = (SolidColorBrush)(new BrushConverter().ConvertFrom("#707070"));;
     this.TagFg      = Brushes.White;
     RefreshFromMainData();
     RestoreFromCache();
 }
コード例 #7
0
ファイル: VisualAasxElements.cs プロジェクト: i-Asset/basyx
        public static void GenerateVisualElementsFromShellEnvAddElements(TreeViewLineCache cache, AdminShell.AdministrationShellEnv env, VisualElementGeneric parent, AdminShell.Referable parentContainer, AdminShell.SubmodelElementWrapper el)
        {
            var ti = new VisualElementSubmodelElement(parent, cache, env, parentContainer, el);

            parent.Members.Add(ti);
            var elc = el.submodelElement as AdminShell.SubmodelElementCollection;

            if (elc != null)
            {
                foreach (var elcc in elc.value)
                {
                    GenerateVisualElementsFromShellEnvAddElements(cache, env, ti, elc, elcc);
                }
            }
        }
コード例 #8
0
ファイル: VisualAasxElements.cs プロジェクト: i-Asset/basyx
 public VisualElementConceptDescription(VisualElementGeneric parent, TreeViewLineCache cache, AdminShell.AdministrationShellEnv env, AdminShell.ConceptDescription cd)
     : base()
 {
     this.Parent     = parent;
     this.Cache      = cache;
     this.theEnv     = env;
     this.theCD      = cd;
     this.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#D0D0D0"));
     this.Border     = (SolidColorBrush)(new BrushConverter().ConvertFrom("#606060"));
     this.TagString  = "CD";
     this.TagBg      = (SolidColorBrush)(new BrushConverter().ConvertFrom("#707070"));;
     this.TagFg      = Brushes.White;
     RefreshFromMainData();
     RestoreFromCache();
 }
コード例 #9
0
ファイル: VisualAasxElements.cs プロジェクト: i-Asset/basyx
 public VisualElementReference(VisualElementGeneric parent, TreeViewLineCache cache, AdminShell.AdministrationShellEnv env, AdminShell.Reference rf)
     : base()
 {
     this.Parent       = parent;
     this.Cache        = cache;
     this.theEnv       = env;
     this.theReference = rf;
     this.Background   = (SolidColorBrush)(new BrushConverter().ConvertFrom("#D0D0D0"));
     this.Border       = (SolidColorBrush)(new BrushConverter().ConvertFrom("#606060"));
     this.TagString    = "\u2b95";
     this.TagBg        = this.Border;
     this.TagFg        = Brushes.White;
     RefreshFromMainData();
     RestoreFromCache();
 }
コード例 #10
0
ファイル: VisualAasxElements.cs プロジェクト: i-Asset/basyx
 public VisualElementView(VisualElementGeneric parent, TreeViewLineCache cache, AdminShell.AdministrationShellEnv env, AdminShell.View vw)
     : base()
 {
     this.Parent     = parent;
     this.Cache      = cache;
     this.theEnv     = env;
     this.theView    = vw;
     this.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom("#C0C0C0"));
     this.Border     = (SolidColorBrush)(new BrushConverter().ConvertFrom("#404040"));
     this.TagString  = "View";
     this.TagBg      = this.Border;
     this.TagFg      = Brushes.White;
     RefreshFromMainData();
     RestoreFromCache();
 }
コード例 #11
0
ファイル: VisualAasxElements.cs プロジェクト: i-Asset/basyx
 public VisualElementSubmodelRef(VisualElementGeneric parent, TreeViewLineCache cache, AdminShell.AdministrationShellEnv env, AdminShell.SubmodelRef smr, AdminShell.Submodel sm)
     : base()
 {
     this.Parent         = parent;
     this.Cache          = cache;
     this.theEnv         = env;
     this.theSubmodelRef = smr;
     this.theSubmodel    = sm;
     this.Background     = (SolidColorBrush)(new BrushConverter().ConvertFrom("#CBD8EB"));
     this.Border         = (SolidColorBrush)(new BrushConverter().ConvertFrom("#4370B3"));
     this.TagString      = "Sub";
     this.TagBg          = this.Border;
     this.TagFg          = Brushes.White;
     RefreshFromMainData();
     RestoreFromCache();
 }
コード例 #12
0
ファイル: VisualAasxElements.cs プロジェクト: i-Asset/basyx
        public VisualElementSubmodelElement(VisualElementGeneric parent, TreeViewLineCache cache, AdminShell.AdministrationShellEnv env, AdminShell.Referable parentContainer, AdminShell.SubmodelElementWrapper wrap)
            : base()
        {
            this.Parent       = parent;
            this.Cache        = cache;
            this.theEnv       = env;
            this.theContainer = parentContainer;
            this.theWrapper   = wrap;
            this.Background   = Brushes.White;
            this.Border       = Brushes.White;

            this.TagString = "Elem";
            if (wrap != null && wrap.submodelElement != null)
            {
                if (wrap.submodelElement is AdminShell.Property)
                {
                    this.TagString = "Prop";
                }
                if (wrap.submodelElement is AdminShell.File)
                {
                    this.TagString = "File";
                }
                if (wrap.submodelElement is AdminShell.Blob)
                {
                    this.TagString = "Blob";
                }
                if (wrap.submodelElement is AdminShell.ReferenceElement)
                {
                    this.TagString = "Ref";
                }
                if (wrap.submodelElement is AdminShell.RelationshipElement)
                {
                    this.TagString = "Rel";
                }
                if (wrap.submodelElement is AdminShell.SubmodelElementCollection)
                {
                    this.TagString = "Coll";
                }
            }

            this.TagBg = (SolidColorBrush)(new BrushConverter().ConvertFrom("#707070"));;
            this.TagFg = Brushes.White;
            RefreshFromMainData();
            RestoreFromCache();
        }
コード例 #13
0
        public VisualElementReference(
            VisualElementGeneric parent, TreeViewLineCache cache, AdminShell.AdministrationShellEnv env,
            AdminShell.Reference rf)
            : base()
        {
            this.Parent       = parent;
            this.Cache        = cache;
            this.theEnv       = env;
            this.theReference = rf;

            this.Background = Brushes.White;
            this.Border     = Brushes.White;
            this.TagBg      = (SolidColorBrush)System.Windows.Application.Current.Resources["DarkestAccentColor"];
            this.TagFg      = Brushes.White;

            this.TagString = "\u2b95";
            RefreshFromMainData();
            RestoreFromCache();
        }
コード例 #14
0
        public VisualElementSubmodelRef(
            VisualElementGeneric parent, TreeViewLineCache cache, AdminShell.AdministrationShellEnv env,
            AdminShell.SubmodelRef smr, AdminShell.Submodel sm)
            : base()
        {
            this.Parent         = parent;
            this.Cache          = cache;
            this.theEnv         = env;
            this.theSubmodelRef = smr;
            this.theSubmodel    = sm;

            this.Background = (SolidColorBrush)System.Windows.Application.Current.Resources["LightAccentColor"];
            this.Border     = (SolidColorBrush)System.Windows.Application.Current.Resources["DarkestAccentColor"];
            this.TagBg      = (SolidColorBrush)System.Windows.Application.Current.Resources["DarkestAccentColor"];
            this.TagFg      = Brushes.White;

            this.TagString = "SM";
            RefreshFromMainData();
            RestoreFromCache();
        }
コード例 #15
0
        public VisualElementAdminShell(
            VisualElementGeneric parent, TreeViewLineCache cache, AdminShellPackageEnv package,
            AdminShell.AdministrationShellEnv env, AdminShell.AdministrationShell aas)
            : base()
        {
            this.Parent     = parent;
            this.Cache      = cache;
            this.thePackage = package;
            this.theEnv     = env;
            this.theAas     = aas;

            this.Background = (SolidColorBrush)System.Windows.Application.Current.Resources["DarkAccentColor"];
            this.Border     = (SolidColorBrush)System.Windows.Application.Current.Resources["DarkestAccentColor"];
            this.TagBg      = (SolidColorBrush)System.Windows.Application.Current.Resources["DarkestAccentColor"];
            this.TagFg      = Brushes.White;

            this.TagString = "AAS";
            RefreshFromMainData();
            RestoreFromCache();
        }
コード例 #16
0
        public VisualElementSubmodelElement(
            VisualElementGeneric parent, TreeViewLineCache cache, AdminShell.AdministrationShellEnv env,
            AdminShell.Referable parentContainer, AdminShell.SubmodelElementWrapper wrap)
            : base()
        {
            this.Parent       = parent;
            this.Cache        = cache;
            this.theEnv       = env;
            this.theContainer = parentContainer;
            this.theWrapper   = wrap;

            this.Background = Brushes.White;
            this.Border     = Brushes.White;
            this.TagBg      = (SolidColorBrush)System.Windows.Application.Current.Resources["DarkestAccentColor"];
            this.TagFg      = Brushes.White;

            this.TagString = wrap.GetElementAbbreviation();

            RefreshFromMainData();
            RestoreFromCache();
        }
コード例 #17
0
ファイル: VisualAasxElements.cs プロジェクト: i-Asset/basyx
        public static List <VisualElementGeneric> GenerateVisualElementsFromShellEnv(TreeViewLineCache cache, AdminShell.AdministrationShellEnv env, AdminShell.PackageEnv package = null, bool editMode = false, int expandMode = 0)
        {
            // clear tree
            var res = new List <VisualElementGeneric>();

            // valid?
            if (env == null)
            {
                return(res);
            }

            // need some attach points
            VisualElementEnvironmentItem tiPackage = null, tiEnv = null, tiShells = null, tiAssets = null, tiCDs = null;

            // many operytions -> make it bulletproof
            try
            {
                if (editMode)
                {
                    // package
                    tiPackage = new VisualElementEnvironmentItem(null /* Parent */, cache, package, env, VisualElementEnvironmentItem.ItemType.Package);
                    tiPackage.SetIsExpandedIfNotTouched(true);
                    res.Add(tiPackage);

                    // env
                    tiEnv = new VisualElementEnvironmentItem(tiPackage, cache, package, env, VisualElementEnvironmentItem.ItemType.Env);
                    tiEnv.SetIsExpandedIfNotTouched(expandMode > 0);
                    tiPackage.Members.Add(tiEnv);

                    // shells
                    tiShells = new VisualElementEnvironmentItem(tiEnv, cache, package, env, VisualElementEnvironmentItem.ItemType.Shells);
                    tiShells.SetIsExpandedIfNotTouched(expandMode > 0);
                    tiEnv.Members.Add(tiShells);

                    // assets
                    tiAssets = new VisualElementEnvironmentItem(tiEnv, cache, package, env, VisualElementEnvironmentItem.ItemType.Assets);
                    tiAssets.SetIsExpandedIfNotTouched(expandMode > 0);
                    tiEnv.Members.Add(tiAssets);

                    // concept descriptions
                    tiCDs = new VisualElementEnvironmentItem(tiEnv, cache, package, env, VisualElementEnvironmentItem.ItemType.ConceptDescriptions);
                    tiCDs.SetIsExpandedIfNotTouched(expandMode > 0);
                    tiEnv.Members.Add(tiCDs);
                }

                // over all Admin shells
                foreach (var aas in env.AdministrationShells)
                {
                    // item
                    var tiAas = new VisualElementAdminShell(null, cache, env, aas);
                    tiAas.SetIsExpandedIfNotTouched(expandMode > 0);

                    // add item
                    if (editMode)
                    {
                        tiAas.Parent = tiShells;
                        tiShells.Members.Add(tiAas);
                    }
                    else
                    {
                        res.Add(tiAas);
                    }

                    // have submodels?
                    if (aas.submodelRefs != null)
                    {
                        foreach (var smr in aas.submodelRefs)
                        {
                            var sm = env.FindSubmodel(smr);
                            if (sm == null)
                            {
                                Log.Error("Cannot find some submodel!");
                                continue;
                            }
                            // item
                            var tiSm = new VisualElementSubmodelRef(tiAas, cache, env, smr, sm);
                            tiSm.SetIsExpandedIfNotTouched(expandMode > 1);
                            // recursively into the submodel elements
                            if (sm.submodelElements != null)
                            {
                                foreach (var sme in sm.submodelElements)
                                {
                                    GenerateVisualElementsFromShellEnvAddElements(cache, env, tiSm, sm, sme);
                                }
                            }
                            // add
                            tiAas.Members.Add(tiSm);
                        }
                    }

                    // have views?
                    if (aas.views != null && aas.views.views != null)
                    {
                        foreach (var vw in aas.views.views)
                        {
                            // item
                            var tiVw = new VisualElementView(tiAas, cache, env, vw);
                            tiVw.SetIsExpandedIfNotTouched(expandMode > 1);
                            // recursion -> submodel elements
                            if (vw.containedElements != null && vw.containedElements.reference != null)
                            {
                                foreach (var ce in vw.containedElements.reference)
                                {
                                    var tiRf = new VisualElementReference(tiVw, cache, env, ce);
                                    tiVw.Members.Add(tiRf);
                                }
                            }
                            // add
                            tiAas.Members.Add(tiVw);
                        }
                    }
                }

                // if edit mode, then display further ..
                if (editMode)
                {
                    // over all assets
                    foreach (var asset in env.Assets)
                    {
                        // item
                        var tiAsset = new VisualElementAsset(tiAssets, cache, env, asset);
                        tiAssets.Members.Add(tiAsset);
                    }

                    // over all concept descriptions
                    foreach (var cd in env.ConceptDescriptions)
                    {
                        // item
                        var tiCD = new VisualElementConceptDescription(tiCDs, cache, env, cd);
                        tiCDs.Members.Add(tiCD);
                    }
                }

                // package as well?
                if (editMode && package != null && tiPackage != null)
                {
                    // file folder
                    var tiFiles = new VisualElementEnvironmentItem(tiPackage, cache, package, env, VisualElementEnvironmentItem.ItemType.SupplFiles);
                    tiFiles.SetIsExpandedIfNotTouched(expandMode > 0);
                    tiPackage.Members.Add(tiFiles);

                    // single files
                    var files = package.GetListOfSupplementaryFiles();
                    foreach (var fi in files)
                    {
                        tiFiles.Members.Add(new VisualElementSupplementalFile(tiFiles, cache, package, fi));
                    }
                }
            } catch (Exception ex)
            {
                Log.Error(ex, "Generating tree of visual elements");
            }

            // end
            return(res);
        }
コード例 #18
0
        public static List <VisualElementGeneric> GenerateVisualElementsFromShellEnv(
            TreeViewLineCache cache, AdminShell.AdministrationShellEnv env, AdminShellPackageEnv package = null,
            bool editMode = false, int expandMode = 0)
        {
            // clear tree
            var res = new List <VisualElementGeneric>();

            // valid?
            if (env == null)
            {
                return(res);
            }

            // need some attach points
            VisualElementEnvironmentItem tiPackage = null, tiEnv = null, tiShells = null, tiAssets = null, tiCDs = null;

            // tracking references of Submodels
            var referencedSubmodels = new List <AdminShell.Submodel>();

            // interested plug-ins
            var pluginsToCheck = new List <Plugins.PluginInstance>();

            if (Plugins.LoadedPlugins != null)
            {
                foreach (var lpi in Plugins.LoadedPlugins.Values)
                {
                    // ReSharper disable EmptyGeneralCatchClause
                    try
                    {
                        var x =
                            lpi.InvokeAction(
                                "get-check-visual-extension") as AasxIntegrationBase.AasxPluginResultBaseObject;
                        if (x != null && (bool)x.obj)
                        {
                            pluginsToCheck.Add(lpi);
                        }
                    }
                    catch { }
                    // ReSharper enable EmptyGeneralCatchClause
                }
            }

            // many operytions -> make it bulletproof
            try
            {
                if (editMode)
                {
                    // package
                    tiPackage = new VisualElementEnvironmentItem(
                        null /* Parent */, cache, package, env, VisualElementEnvironmentItem.ItemType.Package);
                    tiPackage.SetIsExpandedIfNotTouched(true);
                    res.Add(tiPackage);

                    // env
                    tiEnv = new VisualElementEnvironmentItem(
                        tiPackage, cache, package, env, VisualElementEnvironmentItem.ItemType.Env);
                    tiEnv.SetIsExpandedIfNotTouched(expandMode > 0);
                    tiPackage.Members.Add(tiEnv);

                    // shells
                    tiShells = new VisualElementEnvironmentItem(
                        tiEnv, cache, package, env, VisualElementEnvironmentItem.ItemType.Shells);
                    tiShells.SetIsExpandedIfNotTouched(expandMode > 0);
                    tiEnv.Members.Add(tiShells);

                    // assets
                    tiAssets = new VisualElementEnvironmentItem(
                        tiEnv, cache, package, env, VisualElementEnvironmentItem.ItemType.Assets);
                    tiAssets.SetIsExpandedIfNotTouched(expandMode > 0);
                    tiEnv.Members.Add(tiAssets);

                    // concept descriptions
                    tiCDs = new VisualElementEnvironmentItem(
                        tiEnv, cache, package, env, VisualElementEnvironmentItem.ItemType.ConceptDescriptions);
                    tiCDs.SetIsExpandedIfNotTouched(expandMode > 0);
                    tiEnv.Members.Add(tiCDs);
                }

                // over all Admin shells
                foreach (var aas in env.AdministrationShells)
                {
                    // item
                    var tiAas = new VisualElementAdminShell(null, cache, package, env, aas);
                    tiAas.SetIsExpandedIfNotTouched(expandMode > 0);

                    // add item
                    if (editMode)
                    {
                        tiAas.Parent = tiShells;
                        tiShells.Members.Add(tiAas);
                    }
                    else
                    {
                        res.Add(tiAas);
                    }

                    // have submodels?
                    if (aas.submodelRefs != null)
                    {
                        foreach (var smr in aas.submodelRefs)
                        {
                            var sm = env.FindSubmodel(smr);
                            if (sm == null)
                            {
                                Log.Error("Cannot find some submodel!");
                            }
                            else
                            {
                                referencedSubmodels.Add(sm);
                            }

                            // item (even if sm is null)
                            var tiSm = new VisualElementSubmodelRef(tiAas, cache, env, smr, sm);
                            tiSm.SetIsExpandedIfNotTouched(expandMode > 1);

                            // check for visual extensions
                            foreach (var lpi in pluginsToCheck)
                            {
                                // ReSharper disable EmptyGeneralCatchClause
                                try
                                {
                                    var ext = lpi.InvokeAction(
                                        "call-check-visual-extension", sm)
                                              as AasxIntegrationBase.AasxPluginResultVisualExtension;
                                    if (ext != null)
                                    {
                                        var tiExt = new VisualElementPluginExtension(
                                            tiSm, cache, package, sm, lpi, ext);
                                        tiSm.Members.Add(tiExt);
                                    }
                                }
                                catch { }
                                // ReSharper enable EmptyGeneralCatchClause
                            }

                            // recursively into the submodel elements
                            if (sm != null)
                            {
                                if (sm.submodelElements != null)
                                {
                                    foreach (var sme in sm.submodelElements)
                                    {
                                        GenerateVisualElementsFromShellEnvAddElements(cache, env, tiSm, sm, sme);
                                    }
                                }
                            }

                            // add
                            tiAas.Members.Add(tiSm);
                        }
                    }

                    // have views?
                    if (aas.views != null && aas.views.views != null)
                    {
                        foreach (var vw in aas.views.views)
                        {
                            // item
                            var tiVw = new VisualElementView(tiAas, cache, env, vw);
                            tiVw.SetIsExpandedIfNotTouched(expandMode > 1);
                            // recursion -> submodel elements
                            if (vw.containedElements != null && vw.containedElements.reference != null)
                            {
                                foreach (var ce in vw.containedElements.reference)
                                {
                                    var tiRf = new VisualElementReference(tiVw, cache, env, ce);
                                    tiVw.Members.Add(tiRf);
                                }
                            }
                            // add
                            tiAas.Members.Add(tiVw);
                        }
                    }
                }

                // if edit mode, then display further ..
                if (editMode)
                {
                    // over all assets
                    foreach (var asset in env.Assets)
                    {
                        // item
                        var tiAsset = new VisualElementAsset(tiAssets, cache, env, asset);
                        tiAssets.Members.Add(tiAsset);
                    }

                    // over all concept descriptions
                    foreach (var cd in env.ConceptDescriptions)
                    {
                        // item
                        var tiCD = new VisualElementConceptDescription(tiCDs, cache, env, cd);
                        tiCDs.Members.Add(tiCD);
                    }

                    // alternative code deleted
                    {
                        // head
                        var tiAllSubmodels = new VisualElementEnvironmentItem(
                            tiEnv, cache, package, env, VisualElementEnvironmentItem.ItemType.AllSubmodels);
                        tiAllSubmodels.SetIsExpandedIfNotTouched(expandMode > 0);
                        tiEnv.Members.Add(tiAllSubmodels);

                        // show all Submodels
                        foreach (var sm in env.Submodels)
                        {
                            var tiSm = new VisualElementSubmodel(tiAllSubmodels, cache, env, sm);
                            tiSm.SetIsExpandedIfNotTouched(expandMode > 1);
                            tiAllSubmodels.Members.Add(tiSm);
                        }
                    }
                }

                // package as well?
                if (editMode && package != null && tiPackage != null)
                {
                    // file folder
                    var tiFiles = new VisualElementEnvironmentItem(
                        tiPackage, cache, package, env, VisualElementEnvironmentItem.ItemType.SupplFiles);
                    tiFiles.SetIsExpandedIfNotTouched(expandMode > 0);
                    tiPackage.Members.Add(tiFiles);

                    // single files
                    var files = package.GetListOfSupplementaryFiles();
                    foreach (var fi in files)
                    {
                        tiFiles.Members.Add(new VisualElementSupplementalFile(tiFiles, cache, package, fi));
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Generating tree of visual elements");
            }

            // end
            return(res);
        }
コード例 #19
0
 /// <summary>
 /// Activates the caching of the "expanded" states of the tree, even if the tree is multiple
 /// times rebuilt via <code>RebuildAasxElements</code>.
 /// </summary>
 public void ActivateElementStateCache()
 {
     this.treeViewLineCache = new TreeViewLineCache();
 }
コード例 #20
0
        public static void GenerateVisualElementsFromShellEnvAddElements(
            TreeViewLineCache cache, AdminShell.AdministrationShellEnv env, VisualElementGeneric parent,
            AdminShell.Referable parentContainer, AdminShell.SubmodelElementWrapper el)
        {
            var ti = new VisualElementSubmodelElement(parent, cache, env, parentContainer, el);

            parent.Members.Add(ti);

            // Recurse: SMC
            if (el.submodelElement is AdminShell.SubmodelElementCollection elc && elc.value != null)
            {
                foreach (var elcc in elc.value)
                {
                    GenerateVisualElementsFromShellEnvAddElements(cache, env, ti, elc, elcc);
                }
            }

            // Recurse: Entity
            // ReSharper disable ExpressionIsAlwaysNull
            if (el.submodelElement is AdminShell.Entity ele && ele.statements != null)
            {
                foreach (var eles in ele.statements)
                {
                    GenerateVisualElementsFromShellEnvAddElements(cache, env, ti, ele, eles);
                }
            }
            // ReSharper enable ExpressionIsAlwaysNull

            // Recurse: Operation
            if (el.submodelElement is AdminShell.Operation elo)
            {
                if (elo.inputVariable != null)
                {
                    foreach (var vin in elo.inputVariable)
                    {
                        ti.Members.Add(
                            new VisualElementOperationVariable(
                                ti, cache, env, el.submodelElement, vin, AdminShell.OperationVariable.Direction.In));
                    }
                }
                if (elo.outputVariable != null)
                {
                    foreach (var vout in elo.outputVariable)
                    {
                        ti.Members.Add(
                            new VisualElementOperationVariable(
                                ti, cache, env, el.submodelElement, vout, AdminShell.OperationVariable.Direction.Out));
                    }
                }
                if (elo.inoutputVariable != null)
                {
                    foreach (var vout in elo.inoutputVariable)
                    {
                        ti.Members.Add(
                            new VisualElementOperationVariable(
                                ti, cache, env, el.submodelElement, vout,
                                AdminShell.OperationVariable.Direction.InOut));
                    }
                }
            }

            // Recurse: AnnotatedRelationshipElement
            if (el.submodelElement is AdminShell.AnnotatedRelationshipElement ela && ela.annotations != null)
            {
                foreach (var elaa in ela.annotations)
                {
                    GenerateVisualElementsFromShellEnvAddElements(cache, env, ti, ela, elaa);
                }
            }
        }