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


C# DataObject.SetComponentRefs方法代码示例

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


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

示例1: SerializeToData

 protected override void SerializeToData(DataObject data)
 {
     data.SetComponentRefs(new[] { this.component });
 }
开发者ID:Naturaldoc,项目名称:duality,代码行数:4,代码来源:ComponentRefPropertyEditor.cs

示例2: AppendNodesToData

        protected void AppendNodesToData(DataObject data, IEnumerable<TreeNodeAdv> nodes, bool guardRequiredComponents)
        {
            if (!guardRequiredComponents)
            {
                data.SetData(nodes.ToArray());
                data.SetComponentRefs(
                    from c in nodes
                    where c.Tag is ComponentNode
                    select (c.Tag as ComponentNode).Component);
                data.SetGameObjectRefs(
                    from c in nodes
                    where c.Tag is GameObjectNode
                    select (c.Tag as GameObjectNode).Obj);
            }
            else
            {
                // Query selected objects and components
                var nodeQuery =
                    from viewNode in this.objectView.SelectedNodes
                    select this.objectModel.FindNode(this.objectView.GetPath(viewNode)) as NodeBase;
                var cmpQuery =
                    from cmpNode in nodeQuery
                    where cmpNode is ComponentNode
                    select (cmpNode as ComponentNode).Component;
                var objQuery =
                    from objNode in nodeQuery
                    where objNode is GameObjectNode
                    select (objNode as GameObjectNode).Obj;
                var cmpList = new List<Component>(cmpQuery);
                var objList = new List<GameObject>(objQuery);

                // Check which Components may be removed and which not
                Component conflictComp = this.CheckComponentsRemovable(cmpList, objList);
                if (conflictComp != null)
                {
                    this.FlashNode(this.FindNode(conflictComp));
                    System.Media.SystemSounds.Beep.Play();
                }

                var viewNodeQuery =
                            cmpList.Select(c => this.objectView.FindNodeByTag(this.FindNode(c))).
                    Concat(	objList.Select(o => this.objectView.FindNodeByTag(this.FindNode(o))));

                this.AppendNodesToData(data, viewNodeQuery.ToArray(), false);
            }
        }
开发者ID:ChrisLakeZA,项目名称:duality,代码行数:46,代码来源:SceneView.cs


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