Changeset 17405 for branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/JsonItemVM.cs
- Timestamp:
- 01/21/20 17:14:46 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/ViewModels/JsonItemVM.cs
r17404 r17405 7 7 8 8 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 9 public delegate void OnSelectionChangeHandler(JsonItemVM sender, bool selection); 10 public delegate void OnChildAddedHandler(JsonItemVM sender, JsonItemVM child); 11 9 12 public class JsonItemVM { 10 13 public JsonItem Item { get; set; } 11 14 12 public bool Selected { get; set; } = true; 15 private IList<JsonItemVM> children = new List<JsonItemVM>(); 16 public IEnumerable<JsonItemVM> Children { 17 get => children; 18 } 19 20 public JsonItemVM Parent { get; set; } 21 22 private bool selected = true; 23 public bool Selected { 24 get => selected; 25 set { 26 selected = value; 27 OnSelectionChange?.Invoke(this, Selected); 28 } 29 } 30 31 public event OnSelectionChangeHandler OnSelectionChange; 32 public event OnChildAddedHandler OnChildAdded; 13 33 14 34 public JsonItemVM(JsonItem item) { 15 35 this.Item = item; 16 36 } 37 38 public void AddChild(JsonItemVM vm) { 39 children.Add(vm); 40 vm.Parent = this; 41 OnChildAdded?.Invoke(this, vm); 42 } 17 43 } 18 44 }
Note: See TracChangeset
for help on using the changeset viewer.