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); }
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); } } }
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(); }