/// <summary> /// Paste a layerage ( form Clipboard to Layerbase). /// </summary> /// <param name="customDevice"> The custom-device. </param> /// <param name="layerage"> The layerage. </param> public static Layerage PasteLayerage(CanvasDevice customDevice, Layerage layerage) { Layerage child = layerage.Clone(); // ILayer child2 = child.ClipboardSelf; ILayer clone2 = child2.Clone(customDevice); Layerage clone = clone2.ToLayerage(); LayerBase.Instances.Add(clone2); // clone.Children = child.Children; child.Children = null; LayerageCollection._pasteLayerage(customDevice, clone.Children); return(clone); }
/// <summary> /// Paste a layerage ( form Clipboard to Layerbase). /// </summary> /// <param name="layerage"> The layerage. </param> public static Layerage PasteLayerage(Layerage layerage) { Layerage child = layerage.Clone(); // ILayer childCopy = child.ClipboardSelf; ILayer cloneLayer = childCopy.Clone(); Layerage cloneLayerage = Layerage.CreateByGuid(); cloneLayer.Id = cloneLayerage.Id; LayerBase.Instances.Add(cloneLayerage.Id, cloneLayer); // cloneLayerage.Children = child.Children; child.Children = null; LayerManager.PasteLayerageCore(cloneLayerage.Children); return(cloneLayerage); }
/// <summary> /// Sets the mode and notify all properties. /// and copy all selected layerage. /// </summary> public void SetMode() { // Layerages IEnumerable <Layerage> selectedLayerages = LayerManager.GetAllSelected(); int count = selectedLayerages.Count(); if (count == 0) { this.SelectionMode = ListViewSelectionMode.None; // None this.Layerage = null; this.Layerages = null; Clipboard.Instances.Clear(); } else if (count == 1) { this.SelectionMode = ListViewSelectionMode.Single; // None Layerage layerage = selectedLayerages.Single(); this.Layerage = layerage.Clone(); this.Layerages = null; Clipboard.Instances.Clear(); LayerManager.CopyLayerage(this.Layerage); } else if (count >= 2) { this.SelectionMode = ListViewSelectionMode.Multiple; // None this.Layerage = null; this.Layerages = from layerage in selectedLayerages select layerage.Clone(); Clipboard.Instances.Clear(); LayerManager.CopyLayerages(this.Layerages); } }