public override void Execute() { if (this.SceneViewModel.TextSelectionSet.IsActive) { this.SceneViewModel.TextSelectionSet.TextEditProxy.EditingElement.SelectAll(); } else { SelectionManagerPerformanceHelper.MeasurePerformanceUntilPipelinePostSceneUpdate(this.SceneViewModel.DesignerContext.SelectionManager, PerformanceEvent.SelectElement); ISceneElementCollection elementCollection = (ISceneElementCollection) new SceneElementCollection(); SceneElement selectionRoot = SelectAllCommand.GetSelectionRoot(this.SceneViewModel); if (selectionRoot != null) { foreach (SceneElement element in SceneElementHelper.GetElementTree(selectionRoot)) { if (this.IsSelectable(element, selectionRoot)) { elementCollection.Add(element); } } } this.SceneViewModel.ElementSelectionSet.SetSelection((ICollection <SceneElement>)elementCollection, (SceneElement)null); this.SceneViewModel.PathPartSelectionSet.Clear(); } }
public override void Execute() { ICollection <SceneElement> collection = (ICollection <SceneElement>) this.SceneViewModel.ElementSelectionSet.Selection; ISceneElementCollection elementCollection = (ISceneElementCollection) new SceneElementCollection(); bool flag = false; using (this.SceneViewModel.DisableDrawIntoState()) { using (SceneEditTransaction editTransaction = this.SceneViewModel.CreateEditTransaction(StringTable.UndoUnitUngroup)) { this.SceneViewModel.ElementSelectionSet.Clear(); foreach (SceneElement element in (IEnumerable <SceneElement>)collection) { SceneNode[] sceneNodeArray; if (this.CanUngroupAsBaseFrameworkElement(element)) { int count = element.DefaultContent.Count; sceneNodeArray = this.Ungroup(editTransaction, (BaseFrameworkElement)element); if (count != sceneNodeArray.Length) { flag = true; } } else if (this.CanUngroupAs3D(element)) { sceneNodeArray = this.Ungroup((Base3DElement)element); } else { elementCollection.Add(element); continue; } foreach (SceneElement sceneElement in sceneNodeArray) { if (sceneElement.IsSelectable) { elementCollection.Add(sceneElement); } } } this.SceneViewModel.ElementSelectionSet.ExtendSelection((ICollection <SceneElement>)elementCollection); editTransaction.Commit(); } } if (!flag) { return; } int num = (int)this.SceneViewModel.DesignerContext.MessageDisplayService.ShowMessage(new MessageBoxArgs() { Message = string.Format((IFormatProvider)CultureInfo.InvariantCulture, StringTable.UngroupDiscardedElementsWarningMessage, new object[2] { (object)"FrameworkElement", (object)"StaticResourceExtension" }), Button = MessageBoxButton.OK, Image = MessageBoxImage.Exclamation }); }
public static void MakeCompoundPath(PathElement mainElement, List <PathElement> otherElements, SceneEditTransaction editTransaction) { PathElement pathElement = otherElements[otherElements.Count - 1]; ISceneElementCollection elementCollection = (ISceneElementCollection) new SceneElementCollection(); PathAnimationMovePackage animationMove = new PathAnimationMovePackage(); PathGeometry pathGeometry = new PathGeometry(); System.Windows.Media.Geometry geometry1 = (System.Windows.Media.Geometry)mainElement.TransformedGeometry; pathGeometry.AddGeometry(geometry1); foreach (PathElement oldElement in otherElements) { System.Windows.Media.Geometry geometry2 = (System.Windows.Media.Geometry)oldElement.TransformedGeometry; Matrix transformToElement = oldElement.GetComputedTransformToElement((SceneElement)mainElement); bool isIdentity = transformToElement.IsIdentity; Transform transform = isIdentity ? Transform.Identity : (Transform) new MatrixTransform(transformToElement); transform.Freeze(); if (!isIdentity) { GeometryGroup geometryGroup = new GeometryGroup(); geometryGroup.Children.Add(geometry2); geometryGroup.Transform = transform; geometry2 = (System.Windows.Media.Geometry)geometryGroup; } int count = pathGeometry.Figures.Count; pathGeometry.AddGeometry(geometry2); int num = pathGeometry.Figures.Count - count; PropertyReference propertyReference = PathCommandHelper.GetPathDataPropertyReference(oldElement.Platform); for (int oldFigureIndex = 0; oldFigureIndex < num; ++oldFigureIndex) { PathCommandHelper.TransferPathFigureAnimations(oldElement, mainElement, propertyReference, oldFigureIndex, count + oldFigureIndex, transform, animationMove); } elementCollection.Add((SceneElement)oldElement); } animationMove.Remove(); Transform transform1 = PathCommandHelper.ReplacePathGeometry(mainElement, pathGeometry, editTransaction); animationMove.ApplyTransformToNewAnimations(transform1); animationMove.Add(); PathCommandHelper.AdjustPathForAnimations(mainElement, editTransaction); foreach (SceneElement element in (IEnumerable <SceneElement>)elementCollection) { element.ViewModel.AnimationEditor.DeleteAllAnimationsInSubtree(element); element.ViewModel.RemoveElement((SceneNode)element); } }