示例#1
0
 private void RemoveSelectableElements(ISelectableElement rootElement)
 {
     foreach (var prop in rootElement.GetType().GetProperties().Where(IsPropertyObservable))
     {
         var value = (INotifyCollectionChanged)prop.GetValue(rootElement);
         RemoveCollection(value);
     }
 }
示例#2
0
 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;
     }
 }
示例#3
0
        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();
        }
示例#4
0
        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;
                }
            }
        }
示例#5
0
        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();
        }
示例#6
0
        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();
        }
示例#7
0
        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;
            }
        }