Beispiel #1
0
        public void StartCopyingSelectedItems()
        {
            var clonedItems = new List <ItemEditor>( );

            LevelEditor level = getLevel( );

            var editors = selectedEditors( );

            foreach (ItemEditor eachEditor in editors)
            {
                ItemEditor clone = eachEditor.Clone( );

                int nextItemNumber = level.GetNextItemNumber( );

                ItemProperties itemProperties = clone.ItemProperties;

                itemProperties.Name = @"{0}_{1}".FormatWith(itemProperties.Name.TrimEnd(_toTrim), nextItemNumber);
                itemProperties.Id   = level.GenerateId(nextItemNumber);

                clone.IsSelected      = true;
                eachEditor.IsSelected = false;

                clonedItems.Add(clone);
            }

            IoC.Memento.BeginCommand("Copy {0} item(s)".FormatWith(clonedItems.Count));

            level.AddEditors(clonedItems);

            IoC.Model.SelectEditors(new SelectedEditors(clonedItems));

            startMoving( );
        }