예제 #1
0
        private void GraphItemsOnCollectionChangedWith(NotifyCollectionChangedEventArgs changeArgs)
        {
            if (changeArgs.NewItems != null)
            {
                foreach (var item in changeArgs.NewItems.OfType <ViewModel>())
                {
                    if (item == null)
                    {
                        InvertApplication.Log("Graph Item is null");
                    }

                    var drawer = InvertGraphEditor.Container.CreateDrawer <IDrawer>(item);

                    if (drawer == null)
                    {
                        InvertApplication.Log("Drawer is null");
                    }

                    Children.Add(drawer);

                    _cachedChildren = Children.OrderBy(p => p.ZOrder).ToArray();
                    drawer.Refresh((IPlatformDrawer)InvertGraphEditor.PlatformDrawer);
                }
            }
            if (changeArgs.OldItems != null && changeArgs.OldItems.Count > 0)
            {
                var c = Children.Count;
                Children.RemoveAll(p => changeArgs.OldItems.Contains(p.ViewModelObject));
                var d = Children.Count;
                if (c != d)
                {
                    _cachedChildren = Children.OrderBy(p => p.ZOrder).ToArray();
                }
            }
        }
예제 #2
0
 //    if (CurrentEvent.keyCode == KeyCode.Return)
 //    {
 //        if (DiagramViewModel.SelectedNode != null && DiagramViewModel.SelectedNode.IsEditing)
 //        {
 //            DiagramViewModel.SelectedNode.EndEditing();
 private void GraphItemsOnCollectionChangedWith(object sender, NotifyCollectionChangedEventArgs e)
 {
     GraphItemsOnCollectionChangedWith(e);
 }