private void ActiveViews_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { switch (e.Action) { case NotifyCollectionChangedAction.Add: ActiveViews.Add(e.NewItems[0].ToString()); break; case NotifyCollectionChangedAction.Remove: ActiveViews.Remove(e.OldItems[0].ToString()); break; case NotifyCollectionChangedAction.Replace: break; case NotifyCollectionChangedAction.Move: break; case NotifyCollectionChangedAction.Reset: ActiveViews.Clear(); foreach (var view in region.ActiveViews) { ActiveViews.Add(view.ToString()); } break; default: break; } RemoveActiveViewCommand.RaiseCanExecuteChanged(); SelectedViewName = ActiveViews.FirstOrDefault(); }
public void RemoveAllViews() { foreach (IView view in Views) { Deactivate(view); ActiveViews.Remove(view); Views.Remove(view); } }
/// <summary> /// Marks the specified view as inactive. /// </summary> /// <param name="view">The view to deactivate.</param> public virtual void Deactivate(IView view) { if (view == null) { throw new ArgumentNullException(Resources.ViewShouldNotBeNull); } if (GetView(view.Name) == null) { throw new ArgumentException(Resources.ViewNotInRegionException); } ActiveViews.Remove(view); }
private static void Unregister(UTinyEntityView view) { if (!ActiveViews.Remove(view)) { return; } if (ActiveViews.Count == 0) { Undo.postprocessModifications -= HandlePostProcessModification; } // From this point, we know that the entity view is being destroyed. What we do not know is if the view is // being destroyed because we are unloading the scene or if the user deleted the entity through the hierarchy // or the scene view. var entity = view.EntityRef.Dereference(Registry); if (entity?.EntityGroup == null) { return; } var entityGroupRef = (UTinyEntityGroup.Reference)entity.EntityGroup; if (UnloadingEntityGroups.Contains(entityGroupRef)) { return; } entity.View = null; var graph = EntityGroupManager.GetSceneGraph(entityGroupRef); if (null == graph) { return; } graph.Delete(graph.FindNode(view.EntityRef)); UTinyHierarchyWindow.InvalidateSceneGraph(); }
/// <summary> /// Removes the specified view from the region. /// </summary> /// <param name="view">The view to remove.</param> public virtual void Remove(IView view) { this.ItemMetadataCollection.Remove(view); ActiveViews.Remove(view); Views.Remove(view); }