/// <summary> /// Selects the given nodes. /// </summary> /// <param name="items"></param> private void SetSelectedObjects(IEnumerable <Item> items) { // Updates selection SelectedObjects = items == null ? new List <Item>() : new List <Item>(items); // Selects the proper nodes if (SelectedObjects.Count() == 1) { // If the object is not already selected Item obj = SelectedObjects.First(); tvItems.SelectNodeWithTag(obj); } // Notify subscribers SelectionChanged?.ThreadSafeInvoke(this, new EventArgs()); }
/// <summary> /// Called whenever the selection changes, /// fires the approriate event. /// </summary> private void OnSelectionChanged() { SelectionChanged?.ThreadSafeInvoke(this, new EventArgs()); }