//This enables us to get children ICompositeViews from WorkflowViewElements. //Eg. get the WorkflowItemsPresenter from SequenceDesigner. //This is useful for Cut-Copy-Paste, Delete handling, etc. internal static void RegisterWithParentViewElement(ICompositeView container) { WorkflowViewElement parent = GetParentViewElement(container); if (parent != null) { CutCopyPasteHelper.AddChildContainer(parent, container); } }
public static void Delete(EditingContext context) { if (context == null) { throw FxTrace.Exception.AsError(new ArgumentNullException("context")); } Selection selection = context.Items.GetValue <Selection>(); if (null != selection) { bool selectRoot = false; DesignerView designerView = context.Services.GetService <DesignerView>(); var toDelete = selection.SelectedObjects.Where(p => null != p.View && p.View is WorkflowViewElement && !p.View.Equals(designerView.RootDesigner)); if (toDelete.Count() > 0) { using (EditingScope es = (EditingScope)toDelete.FirstOrDefault().BeginEdit(SR.DeleteOperationEditingScopeDescription)) { Dictionary <ICompositeView, List <ModelItem> > containerToModelItemsDict = new Dictionary <ICompositeView, List <ModelItem> >(); List <ModelItem> modelItemsPerContainer; foreach (var item in toDelete) { ICompositeView container = (ICompositeView)DragDropHelper.GetCompositeView((WorkflowViewElement)item.View); if (null != container) { if (!containerToModelItemsDict.TryGetValue(container, out modelItemsPerContainer)) { modelItemsPerContainer = new List <ModelItem>(); containerToModelItemsDict.Add(container, modelItemsPerContainer); } modelItemsPerContainer.Add(item); } } foreach (ICompositeView container in containerToModelItemsDict.Keys) { container.OnItemsDelete(containerToModelItemsDict[container]); selectRoot = true; } if (selectRoot) { DesignerView view = context.Services.GetService <DesignerView>(); if (null != view) { WorkflowViewElement rootView = view.RootDesigner as WorkflowViewElement; if (rootView != null) { Selection.SelectOnly(context, rootView.ModelItem); } } } es.Complete(); } } } }
static ICompositeView GetContainerForPaste(ModelItem pasteModelItem, Point clickPoint) { ICompositeView pasteContainer = null; if (null != pasteModelItem && null != pasteModelItem.View && pasteModelItem.View is WorkflowViewElement) { pasteContainer = ((WorkflowViewElement)pasteModelItem.View).ActiveCompositeView; } if (null == pasteContainer) { //Get clicked container. if (clickPoint.X > 0 && clickPoint.Y > 0) { pasteContainer = GetClickedContainer(pasteModelItem, clickPoint); } //If the container itself is a WVE, there's posibility that it's collapsed. //Thus, we need to check this as well. if (pasteContainer != null && pasteContainer is WorkflowViewElement) { WorkflowViewElement view = pasteContainer as WorkflowViewElement; if (!view.ShowExpanded) { pasteContainer = null; } } else if (pasteContainer == null) //If the modelitem.View itself is a container. { WorkflowViewElement view = pasteModelItem.View as WorkflowViewElement; if (view != null && view.ShowExpanded) { pasteContainer = pasteModelItem.View as ICompositeView; } } //Get the container registered with modelItem.View if unambigous //If nothing works take the container with keyboard focus if one exists. if (pasteContainer == null) { HashSet <ICompositeView> childrenContainers = CutCopyPasteHelper.GetChildContainers(pasteModelItem.View as WorkflowViewElement); if ((childrenContainers == null || childrenContainers.Count == 0) && null != pasteModelItem.View) { pasteContainer = (ICompositeView)DragDropHelper.GetCompositeView((WorkflowViewElement)pasteModelItem.View); } else if (null != childrenContainers && childrenContainers.Count == 1) { pasteContainer = new List <ICompositeView>(childrenContainers)[0]; } else { pasteContainer = Keyboard.FocusedElement as ICompositeView; } } } return(pasteContainer); }
public void UnregisterDefaultCompositeView(ICompositeView container) { if (null == container) { throw FxTrace.Exception.AsError(new ArgumentNullException("container")); } if (object.Equals(this.defaultCompositeView, container)) { this.defaultCompositeView = null; } }
static Type ResolveGenericParameters(DependencyObject dropTarget, EditingContext context, Type type) { // look to see if there is a DefaultTypeArgumentAttribute on it DefaultTypeArgumentAttribute typeArgumentAttribute = ExtensibilityAccessor.GetAttribute <DefaultTypeArgumentAttribute>(type); if (typeArgumentAttribute != null && typeArgumentAttribute.Type != null) { type = type.MakeGenericType(typeArgumentAttribute.Type); } else //require user to resolve generic arguments { ActivityTypeResolver wnd = new ActivityTypeResolver(); if (null != context) { WindowHelperService service = context.Services.GetService <WindowHelperService>(); if (null != service) { service.TrySetWindowOwner(dropTarget, wnd); } } TypeResolvingOptions dropTargetOptions = null; TypeResolvingOptions activityTypeOptions = null; //try to see if the container has any customization for type resolver ICompositeView container = dropTarget as ICompositeView; if (container != null) { dropTargetOptions = container.DroppingTypeResolvingOptions; } //try to see if the activity type in discourse has any customization for type resolver TypeResolvingOptionsAttribute attr = WorkflowViewService.GetAttribute <TypeResolvingOptionsAttribute>(type); if (attr != null) { activityTypeOptions = attr.TypeResolvingOptions; } //if both have type resolver, try to merge them TypeResolvingOptions options = TypeResolvingOptions.Merge(dropTargetOptions, activityTypeOptions); if (options != null) { wnd.Options = options; } wnd.Context = context; wnd.EditedType = type; wnd.Width = 340; wnd.Height = 200; type = (true == wnd.ShowDialog() ? wnd.ConcreteType : null); } return(type); }
public WorkflowViewElement GetViewElement(ModelItem modelItem, ICompositeView sourceContainer) { WorkflowViewElement itemView = (WorkflowViewElement)this.ViewService.GetView(modelItem); if (null != sourceContainer) { DragDropHelper.SetCompositeView(itemView, (UIElement)sourceContainer); } itemView.Loaded += this.OnViewLoaded; itemView.Unloaded += this.OnViewUnloaded; return(itemView); }
public void TransformView(ICompositeView view, IPrincipal principal) { // build a list of components to remove var components = new List <IComponentMatcher>(); BuildListRecursively(view.RootContainer, components); // remove the components for the specified user if (string.Equals(userName, principal.Identity.Name, StringComparison.OrdinalIgnoreCase)) { view.RootContainer.RemoveComponentsRecursive(components, notifyComponentOnRemoval: false); } }
public void RegisterDefaultCompositeView(ICompositeView container) { if (null == container) { throw FxTrace.Exception.AsError(new ArgumentNullException("container")); } this.defaultCompositeView = container; System.Diagnostics.Debug.WriteLine(string.Format( CultureInfo.InvariantCulture, "Default ICompositeView of type '{0}' for '{1}' loaded. hashcode = {2}", this.defaultCompositeView.GetType().Name, this.GetType().Name, this.defaultCompositeView.GetHashCode())); }
// 1) obj with CompositeView2: sort by IMultipleDragEnabledCompositeView SortSelectedItems. // 2) obj with CompoisteView: no sort. // 3) obj without CompositeView: just put them at the end of the list as the order in selectedObjects. internal static List <object> SortSelectedObjects(IEnumerable <object> selectedObjects) { //1) Separate objects Dictionary <ICompositeView, List <ModelItem> > viewItemListDictionary = new Dictionary <ICompositeView, List <ModelItem> >(); List <object> nonCompositeView = new List <object>(); List <object> retList = new List <object>(); foreach (object obj in selectedObjects) { ModelItem modelItem = obj as ModelItem; if (modelItem == null || modelItem.View == null) { nonCompositeView.Add(obj); continue; } ICompositeView container = DragDropHelper .GetCompositeView(modelItem.View as WorkflowViewElement) as ICompositeView; if (container == null) { nonCompositeView.Add(obj); continue; } // add to dictionary. if (!viewItemListDictionary.ContainsKey(container)) { viewItemListDictionary.Add(container, new List <ModelItem>()); } viewItemListDictionary[container].Add(modelItem); } // 2) sort when possible foreach (KeyValuePair <ICompositeView, List <ModelItem> > pair in viewItemListDictionary) { IMultipleDragEnabledCompositeView view2 = pair.Key as IMultipleDragEnabledCompositeView; List <ModelItem> sortedList = view2 == null ? pair.Value : view2.SortSelectedItems(new List <ModelItem>(pair.Value)); if (!AreListsIdenticalExceptOrder(pair.Value, sortedList)) { // check consistens. throw FxTrace.Exception.AsError( new InvalidOperationException(SR.Error_BadOutputFromSortSelectedItems)); } retList.AddRange(sortedList); } retList.AddRange(nonCompositeView); return(retList); }
public UIElement GetContainer(ModelItem modelItem, ICompositeView sourceContainer) { FrameworkElement view = null; if (IsVirtualiztionEnabled) { view = new VirtualizingContainer(this, modelItem, sourceContainer); view.Loaded += this.OnViewLoaded; view.Unloaded += this.OnViewUnloaded; } else { view = this.GetViewElement(modelItem, sourceContainer); } return(view); }
public static bool CanPaste(EditingContext context) { if (context == null) { throw FxTrace.Exception.AsError(new ArgumentNullException("context")); } bool result = false; ModelItem primarySelection = context.Items.GetValue <Selection>().PrimarySelection; if (null != primarySelection) { ICompositeView container = GetContainerForPaste(primarySelection, new Point(-1, -1)); if (null != container) { DataObject dataObject = RetriableClipboard.GetDataObject() as DataObject; if (null != dataObject) { List <object> metaData = null; List <object> itemsToPaste = null; try { if (dataObject.GetDataPresent(WorkflowClipboardFormat)) { itemsToPaste = GetFromClipboard(out metaData, context); result = container.CanPasteItems(itemsToPaste); } else if (dataObject.GetDataPresent(WorkflowCallbackClipboardFormat)) { itemsToPaste = GetFromClipboard(out metaData, context); result = container.CanPasteItems(itemsToPaste.GetRange(0, 1)); } } //This is being defensive for the case where user code for CanPasteITems throws a non-fatal exception. catch (Exception exp) { if (Fx.IsFatal(exp)) { throw; } } } } } return(result); }
//This is more efficient than walking up the VisualTree looking for WorkflowViewElements. //Assuming that Cut-Copy will always be against selected elements. //This implies that only elements under the BreadCrumbRoot can be cut/copied. static List <WorkflowViewElement> GetSelectableParentViewElements(WorkflowViewElement childElement) { List <WorkflowViewElement> parentViewElements = new List <WorkflowViewElement>(); if (childElement != null) { UIElement breadcrumbRoot = childElement.Context.Services.GetService <DesignerView>().RootDesigner; ICompositeView container = (ICompositeView)DragDropHelper.GetCompositeView(childElement); while (!childElement.Equals(breadcrumbRoot) && container != null) { childElement = CutCopyPasteHelper.GetParentViewElement(container); Fx.Assert(childElement != null, "container should be present in a WorkflowViewElement"); parentViewElements.Add(childElement); container = (ICompositeView)DragDropHelper.GetCompositeView(childElement); } } return(parentViewElements); }
static void AddChildContainer(WorkflowViewElement viewElement, ICompositeView sourceContainer) { if (viewElement == null) { throw FxTrace.Exception.AsError(new ArgumentNullException("viewElement")); } if (sourceContainer == null) { throw FxTrace.Exception.AsError(new ArgumentNullException("sourceContainer")); } HashSet<ICompositeView> containers = (HashSet<ICompositeView>)viewElement.GetValue(CutCopyPasteHelper.ChildContainersProperty); if (containers == null) { containers = new HashSet<ICompositeView>(); viewElement.SetValue(CutCopyPasteHelper.ChildContainersProperty, containers); } containers.Add(sourceContainer); }
static void AddChildContainer(WorkflowViewElement viewElement, ICompositeView sourceContainer) { if (viewElement == null) { throw FxTrace.Exception.AsError(new ArgumentNullException("viewElement")); } if (sourceContainer == null) { throw FxTrace.Exception.AsError(new ArgumentNullException("sourceContainer")); } HashSet <ICompositeView> containers = (HashSet <ICompositeView>)viewElement.GetValue(CutCopyPasteHelper.ChildContainersProperty); if (containers == null) { containers = new HashSet <ICompositeView>(); viewElement.SetValue(CutCopyPasteHelper.ChildContainersProperty, containers); } containers.Add(sourceContainer); }
public VirtualizingContainer(VirtualizedContainerService containerService, ModelItem modelItem, ICompositeView sourceContainer) { this.containerService = containerService; this.modelItem = modelItem; this.sourceContainer = sourceContainer; this.Focusable = false; this.BorderThickness = new Thickness(1); SetupPlaceHolder(); this.children = new List <VirtualizingContainer>(); this.Unloaded += (sender, args) => { this.containerService.tree.Remove(this); this.oldBounds = new Rect(0, 0, 0, 0); UnRegisterFromParentContainer(); }; this.Loaded += (sender, args) => { RegisterWithParentContainer(); }; }
public void UnregisterCompositeView(ICompositeView container) { if (null == container) { throw FxTrace.Exception.AsError(new ArgumentNullException("container")); } if (null != this.compositeViews && this.compositeViews.Contains(container)) { System.Diagnostics.Debug.WriteLine(string.Format( CultureInfo.InvariantCulture, "ICompositeView of type '{0}' for '{1}' unloaded", container.GetType().Name, this.GetType().Name)); this.compositeViews.Remove(container); if (0 == this.compositeViews.Count) { this.compositeViews = null; } } }
public void RegisterCompositeView(ICompositeView container) { if (null == container) { throw FxTrace.Exception.AsError(new ArgumentNullException("container")); } if (null == this.CompositeViews) { this.compositeViews = new List <ICompositeView>(); } if (!this.compositeViews.Contains(container)) { System.Diagnostics.Debug.WriteLine(string.Format( CultureInfo.InvariantCulture, "ICompositeView of type '{0}' for '{1}' loaded. hashcode = {2}", container.GetType().Name, this.GetType().Name, container.GetHashCode())); this.compositeViews.Add(container); } }
internal static void DoPaste(EditingContext context, Point pastePoint, WorkflowViewElement pastePointReference) { if (context == null) { throw FxTrace.Exception.AsError(new ArgumentNullException("context")); } ModelItem modelItem = context.Items.GetValue <Selection>().PrimarySelection; if (modelItem == null) { return; } //Get data from clipboard. List <object> metaData = null; List <object> clipboardObjects = GetFromClipboard(out metaData, context); if (clipboardObjects != null) { using (EditingScope es = (EditingScope)modelItem.BeginEdit(SR.PasteUndoDescription)) { if (clipboardObjects.Count == 3 && clipboardObjects[1] is Func <ModelItem, object, object> ) { var factoryMethod = (Func <ModelItem, object, object>)clipboardObjects[1]; object result = factoryMethod(modelItem, clipboardObjects[2]); clipboardObjects = new List <object>(); clipboardObjects.Add(result); } ICompositeView container = GetContainerForPaste(modelItem, pastePoint); if (container != null) { container.OnItemsPasted(clipboardObjects, metaData, pastePoint, pastePointReference); } es.Complete(); } } }
public void RegisterCompositeView(ICompositeView container) { if (null == container) { throw FxTrace.Exception.AsError(new ArgumentNullException("container")); } if (null == this.CompositeViews) { this.compositeViews = new List<ICompositeView>(); } if (!this.compositeViews.Contains(container)) { System.Diagnostics.Debug.WriteLine(string.Format( CultureInfo.InvariantCulture, "ICompositeView of type '{0}' for '{1}' loaded. hashcode = {2}", container.GetType().Name, this.GetType().Name, container.GetHashCode())); this.compositeViews.Add(container); } }
public void TransformView(ICompositeView view, IPrincipal principal) { Debug.WriteLine($"View: {view.Name}, Title: {view.Title}, {DateTime.Now}"); ScanViewRecursively(view.RootContainer, " "); }
//Returns the first WorkflowViewElement in the parent chain. //If ICompositeView is a WorkflowViewElement this method returns the same object. static WorkflowViewElement GetParentViewElement(ICompositeView container) { DependencyObject parent = container as DependencyObject; return GetParentViewElement(parent); }
void StartDragging() { try { using (ModelEditingScope editingScope = this.ModelItem.BeginEdit(SR.MoveEditingScopeDescription, true)) { HashSet <WorkflowViewElement> draggedViews = new HashSet <WorkflowViewElement>(); Dictionary <ModelItem, ICompositeView> sourceContainers = new Dictionary <ModelItem, ICompositeView>(); HashSet <ICompositeView> compViewSet = new HashSet <ICompositeView>(); Selection selection = this.Context.Items.GetValue <Selection>(); IEnumerable <ModelItem> selectedObjects = selection.SelectedObjects; IEnumerable <ModelItem> modelItemsToDrag = DragDropHelper.GetModelItemsToDrag(selectedObjects); // Save the source containers for the dragged items foreach (ModelItem modelItem in modelItemsToDrag) { WorkflowViewElement view = (WorkflowViewElement)modelItem.View; draggedViews.Add(view); ICompositeView container = DragDropHelper.GetCompositeView(view) as ICompositeView; sourceContainers.Add(modelItem, container); // If Add returns true => the container is added the first time, which is always ok // If Add returns false => the container is added more than once // it must be a IMultipleDragEnabledCompositeView, otherwise, return, because // we don't support dragging from ICompositeView. if (!compViewSet.Add(container) && !(container is IMultipleDragEnabledCompositeView)) { return; } } // Calculate the anchor point for the dragged items Point relativeLocation = GetRelativeLocation(draggedViews); Point referencePoint = this.lastMouseDownPoint; referencePoint.Offset(relativeLocation.X, relativeLocation.Y); DataObject dataObject = DragDropHelper.DoDragMoveImpl(draggedViews, referencePoint); IEnumerable <WorkflowViewElement> movedViewElements = DragDropHelper.GetDragDropMovedViewElements(dataObject); // once drag drop is done make sure the CompositeView is notified of the change in data if (movedViewElements != null) { Dictionary <ICompositeView, List <ModelItem> > containerMovedModelItemList = new Dictionary <ICompositeView, List <ModelItem> >(); // Create containerMovedModelItemList foreach (WorkflowViewElement view in movedViewElements) { ICompositeView compView = DragDropHelper.GetCompositeView(view) as ICompositeView; Fx.Assert(compView != null, "not an ICompositeView"); if (!containerMovedModelItemList.ContainsKey(compView)) { containerMovedModelItemList.Add(compView, new List <ModelItem>()); } containerMovedModelItemList[compView].Add(view.ModelItem); } // Call OnItemsMoved to notify the source container. foreach (KeyValuePair <ICompositeView, List <ModelItem> > pair in containerMovedModelItemList) { if (pair.Key is IMultipleDragEnabledCompositeView) { ((IMultipleDragEnabledCompositeView)pair.Key).OnItemsMoved(pair.Value); } else { if (pair.Value.Count >= 2) { throw FxTrace.Exception.AsError( new InvalidOperationException(SR.Error_MovingMoreThanOneItemsFromICompositeView)); } pair.Key.OnItemMoved(pair.Value[0]); } } // animation foreach (WorkflowViewElement view in movedViewElements) { BeginDropAnimation(view); } } // the drop target is using old DragDropHelper API and did not set the moved view elements else { DragDropEffects executedDragDropEffect = DragDropHelper.GetDragDropCompletedEffects(dataObject); if (executedDragDropEffect == DragDropEffects.Move) { if (modelItemsToDrag.Count() == 1) { ModelItem movedItem = modelItemsToDrag.First <ModelItem>(); sourceContainers[movedItem].OnItemMoved(movedItem); BeginDropAnimation((WorkflowViewElement)movedItem.View); } else { throw FxTrace.Exception.AsError(new InvalidOperationException(SR.DraggingMulitpleItemsError)); } } } editingScope.Complete(); bool dropHappened = movedViewElements != null || DragDropHelper.GetDragDropCompletedEffects(dataObject) == DragDropEffects.Move; if (dropHappened) { // add the selected objects back into selection. this.Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, (Action)(() => { foreach (ModelItem item in selectedObjects) { // We need only the first one IInputElement viewToFocus = item == null ? null : item.View as IInputElement; if (viewToFocus != null) { Keyboard.Focus(viewToFocus); break; } } this.Context.Items.SetValue(new Selection(selectedObjects)); })); } } } catch (Exception e) { ErrorReporting.ShowErrorMessage(e.Message); } }
public WorkflowViewElement GetViewElement(ModelItem modelItem, ICompositeView sourceContainer) { WorkflowViewElement itemView = (WorkflowViewElement)this.ViewService.GetView(modelItem); if (null != sourceContainer) { DragDropHelper.SetCompositeView(itemView, (UIElement)sourceContainer); } itemView.Loaded += this.OnViewLoaded; itemView.Unloaded += this.OnViewUnloaded; return itemView; }
public UIElement GetContainer(ModelItem modelItem, ICompositeView sourceContainer) { FrameworkElement view = null; if (IsVirtualiztionEnabled) { view = new VirtualizingContainer(this, modelItem, sourceContainer); view.Loaded += this.OnViewLoaded; view.Unloaded += this.OnViewUnloaded; } else { view = this.GetViewElement(modelItem, sourceContainer); } return view; }
//Returns the first WorkflowViewElement in the parent chain. //If ICompositeView is a WorkflowViewElement this method returns the same object. static WorkflowViewElement GetParentViewElement(ICompositeView container) { DependencyObject parent = container as DependencyObject; return(GetParentViewElement(parent)); }
public VirtualizingContainer(VirtualizedContainerService containerService, ModelItem modelItem, ICompositeView sourceContainer) { this.containerService = containerService; this.modelItem = modelItem; this.sourceContainer = sourceContainer; this.Focusable = false; this.BorderThickness = new Thickness(1); SetupPlaceHolder(); this.children = new List<VirtualizingContainer>(); this.Unloaded += (sender, args) => { this.containerService.tree.Remove(this); this.oldBounds = new Rect(0, 0, 0, 0); UnRegisterFromParentContainer(); }; this.Loaded += (sender, args) => { RegisterWithParentContainer(); }; }
static void CutCopyOperation(List <ModelItem> modelItemsToCutCopy, EditingContext context, bool isCutOperation) { List <object> objectsOnClipboard = null; List <object> metaData = null; if (modelItemsToCutCopy.Count > 0) { objectsOnClipboard = new List <object>(modelItemsToCutCopy.Count); metaData = new List <object>(); Dictionary <ICompositeView, List <ModelItem> > notifyDictionary = new Dictionary <ICompositeView, List <ModelItem> >(); UIElement breadCrumbRootView = ((DesignerView)context.Services.GetService <DesignerView>()).RootDesigner; foreach (ModelItem modelItem in modelItemsToCutCopy) { object currentElement = modelItem.GetCurrentValue(); if (typeof(Activity).IsAssignableFrom(currentElement.GetType())) { string fileName; if (AttachablePropertyServices.TryGetProperty(currentElement, XamlDebuggerXmlReader.FileNameName, out fileName)) { AttachablePropertyServices.RemoveProperty(currentElement, XamlDebuggerXmlReader.FileNameName); } } if (modelItem.View != null) { //The case where the breadcrumbroot designer is Cut/Copied. We do not delete the root designer, we only copy it. if (breadCrumbRootView.Equals(modelItem.View)) { notifyDictionary.Clear(); objectsOnClipboard.Add(modelItem.GetCurrentValue()); break; } else { ICompositeView container = (ICompositeView)DragDropHelper.GetCompositeView((WorkflowViewElement)modelItem.View); if (container != null) { //If the parent and some of its children are selected and cut/copied, we ignore the children. //The entire parent will be cut/copied. //HashSet parentModelItems contains all the model items in the parent chain of current modelItem. //We use HashSet.IntersectWith operation to determine if one of the parents is set to be cut. HashSet <ModelItem> parentModelItems = CutCopyPasteHelper.GetSelectableParentModelItems(modelItem); parentModelItems.IntersectWith(modelItemsToCutCopy); if (parentModelItems.Count == 0) { if (!notifyDictionary.ContainsKey(container)) { notifyDictionary[container] = new List <ModelItem>(); } notifyDictionary[container].Add(modelItem); } } } } } foreach (ICompositeView container in notifyDictionary.Keys) { object containerMetaData = false; if (isCutOperation) { containerMetaData = container.OnItemsCut(notifyDictionary[container]); } else { containerMetaData = container.OnItemsCopied(notifyDictionary[container]); } if (containerMetaData != null) { metaData.Add(containerMetaData); } //Put the actual activities and not the modelItems in the clipboard. foreach (ModelItem modelItem in notifyDictionary[container]) { objectsOnClipboard.Add(modelItem.GetCurrentValue()); } } if (metaData.Count == 0) { metaData = null; } } try { FrameworkName targetFramework = context.Services.GetService <DesignerConfigurationService>().TargetFrameworkName; PutOnClipBoard(objectsOnClipboard, metaData, targetFramework); } catch (XamlObjectReaderException exception) { if (modelItemsToCutCopy.Count > 0 && ErrorActivity.GetHasErrorActivities(modelItemsToCutCopy[0].Root.GetCurrentValue())) { ErrorReporting.ShowErrorMessage(SR.CutCopyErrorActivityMessage); } else { ErrorReporting.ShowErrorMessage(exception.Message); } } }