Пример #1
0
        public static AdminShell.View CreateStochasticViewOnSubmodels(AdminShell.Submodel[] sms, string idShort)
        {
            // create
            var vw = new AdminShell.View();

            vw.idShort = idShort;

            // over all submodel elements
            if (sms != null)
            {
                foreach (var sm in sms)
                {
                    // parent-ize submodel
                    sm.SetAllParents();

                    // loop in
                    foreach (var sme in sm.submodelElements)
                    {
                        CreateStochasticViewOnSubmodelsRecurse(vw, sm, sme.submodelElement);
                    }
                }
            }
            // done
            return(vw);
        }
Пример #2
0
        private static void CreateStochasticViewOnSubmodelsRecurse(AdminShell.View vw, AdminShell.Submodel submodel, AdminShell.SubmodelElement sme)
        {
            if (vw == null || sme == null)
            {
                return;
            }

            var isSmc = (sme is AdminShell.SubmodelElementCollection);

            // spare out some of the leafs of the tree ..
            if (!isSmc)
            {
                if (Math.Abs(sme.idShort.GetHashCode() % 100) > 50)
                {
                    return;
                }
            }

            // ok, create
            var ce = new AdminShell.ContainedElementRef();

            sme.CollectReferencesByParent(ce.Keys);
            vw.AddContainedElement(ce.Keys);
            // recurse
            if (isSmc)
            {
                foreach (var sme2wrap in (sme as AdminShell.SubmodelElementCollection).value)
                {
                    CreateStochasticViewOnSubmodelsRecurse(vw, submodel, sme2wrap.submodelElement);
                }
            }
        }
Пример #3
0
 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();
 }
        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)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 = "View";
            RefreshFromMainData();
            RestoreFromCache();
        }