public DataModel() { var fields = from field in typeof(FunctionId).GetFields() where !field.IsSpecialName select field; var builder = new ArrayBuilder <ActivityLevel?>(); var features = new Dictionary <string, ActivityLevel>(); var root = new ActivityLevel("All"); foreach (var field in fields) { var value = (int)field.GetRawConstantValue(); var name = field.Name; var featureNames = name.Split('_'); var featureName = featureNames.Length > 1 ? featureNames[0] : "Uncategorized"; if (!features.TryGetValue(featureName, out var parent)) { parent = new ActivityLevel(featureName, root, createChildList: true); features[featureName] = parent; } builder.SetItem(value, new ActivityLevel(name, parent, createChildList: false)); } _activities = builder.ToImmutable(); root.SortChildren(); RootNode = root; }
internal StatusIndicator(ActivityLevel activityLevel) { InitializeComponent(); _activityLevel = activityLevel; _changedSinceLastUpdate = activityLevel.IsActive; }
public DataModel() { var functions = from f in typeof(FunctionId).GetFields() where !f.IsSpecialName select f; var count = functions.Count(); _activities = new ActivityLevel[count]; var features = new Dictionary <string, ActivityLevel>(); var root = new ActivityLevel("All"); foreach (var function in functions) { var value = (int)function.GetRawConstantValue(); var name = function.Name; var featureNames = name.Split('_'); var featureName = featureNames.Length > 1 ? featureNames[0] : "Uncategorized"; ActivityLevel parent; if (!features.TryGetValue(featureName, out parent)) { parent = new ActivityLevel(featureName, root, createChildList: true); features[featureName] = parent; } _activities[value - 1] = new ActivityLevel(name, parent, createChildList: false); } root.SortChildren(); this.RootNode = root; }
internal StatusIndicator(ActivityLevel activityLevel) { InitializeComponent(); this.activityLevel = activityLevel; this.changedSinceLastUpdate = activityLevel.IsActive; }
public DataModel() { var functions = from f in typeof(FunctionId).GetFields() where !f.IsSpecialName select f; var count = functions.Count(); this.activities = new ActivityLevel[count]; var features = new Dictionary<string, ActivityLevel>(); var root = new ActivityLevel("All"); foreach (var function in functions) { var value = (int)function.GetRawConstantValue(); var name = function.Name; var featureNames = name.Split('_'); var featureName = featureNames.Length > 1 ? featureNames[0] : "Uncategorized"; ActivityLevel parent; if (!features.TryGetValue(featureName, out parent)) { parent = new ActivityLevel(featureName, root, createChildList: true); features[featureName] = parent; } activities[value - 1] = new ActivityLevel(name, parent, createChildList: false); } root.SortChildren(); this.RootNode = root; }
public ActivityLevel(string name, ActivityLevel parent, bool createChildList) { this.Name = name; _parent = parent; _parent._children.Add(this); if (createChildList) { _children = new List<ActivityLevel>(); } }
public ActivityLevel(string name, ActivityLevel parent, bool createChildList) { this.Name = name; this.parent = parent; this.parent.children.Add(this); if (createChildList) { this.children = new List <ActivityLevel>(); } }