Canguro.Commands.Model.CopyCmd.Run C# (CSharp) Method

Run() public method

Executes the command. Gets the selection and a pivot point, and adds them to the Clipboard with the key "Canguro"
public Run ( Canguro services ) : void
services Canguro CommandServices object to interact with the system
return void
        public override void Run(Canguro.Controller.CommandServices services)
        {
            Dictionary<uint, Joint> joints = new Dictionary<uint, Joint>();
            List<LineElement> lines = new List<LineElement>();
            List<AreaElement> areas = new List<AreaElement>();
            bool haveSelection = false;
            haveSelection = services.GetSelection(joints, lines, areas);
            if (!haveSelection)
            {
                services.GetMany(Culture.Get("selectItems"));
                haveSelection = services.GetSelection(joints, lines, areas);
            }
            if (haveSelection)
            {
                Magnet magnet = services.GetPoint(Culture.Get("selectPivot"));
                if (magnet != null)
                {
                    Microsoft.DirectX.Vector3 pivot = magnet.SnapPosition;
                    Clipboard.Clear();
                    object[] objs = new object[] { joints, lines, areas, pivot };

                    //// Test Serialization
                    //System.IO.MemoryStream s = new MemoryStream();
                    //new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter().Serialize(s, objs);

                    Clipboard.SetData("Canguro", objs);
                }
            }

            foreach (Item item in joints.Values)
                if (item != null)
                    item.IsSelected = true;
            foreach (Item item in lines)
                if (item != null)
                    item.IsSelected = true;
            foreach (Item item in areas)
                if (item != null)
                    item.IsSelected = true;
        }
CopyCmd