private void RemoveSelectableElements(ISelectableElement rootElement) { foreach (var prop in rootElement.GetType().GetProperties().Where(IsPropertyObservable)) { var value = (INotifyCollectionChanged)prop.GetValue(rootElement); RemoveCollection(value); } }
private void AddElement(ISelectableElement element) { _elements.Add(element); element.PropertyChanged += element_PropertyChanged; AddSelectableElements(element); if (_elements.Any() && _elements.All(e => !e.Selected)) { _elements[0].Selected = true; } }
public void Deselect(ISelectableElement e) { // Debug.Log( "deselect " + e.GetType().ToString() ); if (e is FTrackEditor) { DeselectTrack((FTrackEditor)e); } else if (e is FEventEditor) { DeselectEvent((FEventEditor)e); } Repaint(); }
private void RemoveElement(ISelectableElement element) { _elements.Remove(element); RemoveSelectableElements(element); element.PropertyChanged -= element_PropertyChanged; if (SelectedElement == element) { SelectedElement = null; if (_elements.Count > 0) { _elements[0].Selected = true; } } }
public void Select(ISelectableElement e) { if (e.IsSelected()) { return; } if (e is FTrackEditor) { SelectTrack((FTrackEditor)e); } else if (e is FEventEditor) { SelectEvent((FEventEditor)e); } else if (e is FTimelineEditor) { SelectTimeline((FTimelineEditor)e); } Repaint(); }
public void SelectExclusive(ISelectableElement e) { if (e.IsSelected()) { return; } // Undo.IncrementCurrentGroup(); DeselectAll(); if (e is FTrackEditor) { SelectTrack((FTrackEditor)e); } else if (e is FEventEditor) { SelectEvent((FEventEditor)e); } // Undo.CollapseUndoOperations( Undo.GetCurrentGroup() ); Repaint(); }
private void element_PropertyChanged(object sender, PropertyChangedEventArgs e) { var currentElement = (ISelectableElement)sender; if (e.PropertyName != PropertyHelper.GetPropertyName(() => currentElement.Selected)) { return; } if (currentElement.Selected) { foreach (var selectedElement in _elements.Where(element => element != currentElement && element.Selected)) { selectedElement.Selected = false; } SelectedElement = currentElement; } else { SelectedElement = null; } }