/// <summary> /// Sets the mode and notify all properties. /// and copy all selected layerage. /// </summary> /// <param name="customDevice"> The custom-device. </param> /// <param name="layerageCollection"> The layerage-collection. </param> public void SetMode(CanvasDevice customDevice, LayerageCollection layerageCollection) { //Layerages IEnumerable <Layerage> selectedLayerages = LayerageCollection.GetAllSelected(layerageCollection); 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(); LayerageCollection.CopyLayerage(customDevice, 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(); LayerageCollection.CopyLayerages(customDevice, this.Layerages); } }