当前位置: 首页>>代码示例>>C#>>正文


C# Canguro.GetMany方法代码示例

本文整理汇总了C#中Canguro.GetMany方法的典型用法代码示例。如果您正苦于以下问题:C# Canguro.GetMany方法的具体用法?C# Canguro.GetMany怎么用?C# Canguro.GetMany使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Canguro的用法示例。


在下文中一共展示了Canguro.GetMany方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run

        //public override void Run(Canguro.Controller.CommandServices services)
        //{
        //    List<Item> selection = GetSelection(services);
        //    if (selection.Count == 0)
        //        return;
        //    Stream stream = new MemoryStream();
        //    try
        //    {
        //        BinaryFormatter bformatter = new BinaryFormatter();
        //        Magnet magnet = services.GetPoint("selectPivot");
        //        bformatter.Serialize(stream, magnet.SnapPosition);
        //        bformatter.Serialize(stream, selection.Count);
        //        foreach (Item item in selection)
        //        {
        //            bformatter.Serialize(stream, item);
        //            item.IsSelected = true;
        //        }
        //        Clipboard.SetData("Canguro", stream);
        //    }
        //    finally
        //    {
        //        stream.Close();
        //    }
        //}
        /// <summary>
        /// Executes the command. 
        /// Gets the selection and a pivot point, and adds them to the Clipboard with the key "Canguro"
        /// </summary>
        /// <param name="services">CommandServices object to interact with the system</param>
        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;
        }
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:68,代码来源:CopyCmd.cs


注:本文中的Canguro.GetMany方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。