ElementOperations 类

提供对模型元素的集合的常见操作。

继承层次结构

System.Object
  Microsoft.VisualStudio.Modeling.ElementOperations
    Microsoft.VisualStudio.Modeling.Diagrams.DesignSurfaceElementOperations

命名空间:  Microsoft.VisualStudio.Modeling
程序集:  Microsoft.VisualStudio.Modeling.Sdk.11.0(在 Microsoft.VisualStudio.Modeling.Sdk.11.0.dll 中)

语法

声明
Public Class ElementOperations
public class ElementOperations

ElementOperations 类型公开以下成员。

构造函数

  名称 说明
受保护的方法 ElementOperations(IServiceProvider) 初始化 ElementOperations 类的新实例。
公共方法 ElementOperations(IServiceProvider, Partition) 初始化 ElementOperations 类的新实例。
公共方法 ElementOperations(IServiceProvider, Store) 已过时。初始化 ElementOperations 类的新实例。

页首

属性

  名称 说明
受保护的属性 Partition
受保护的属性 ServiceProvider
受保护的属性 Store

页首

方法

  名称 说明
受保护的方法 AddCustomFormat 使用 ModelElements,的指定集合添加一个或多个自定义数据布局到指定的 IDataObject。
受保护的方法 AddElementGroupFormat(IDataObject, ICollection<ModelElement>, ClosureType) 使用 ModelElements,的指定集合添加 ElementGroupPrototype 格式转换为指定的 IDataObject。此方法调用下列 3 个可重写的方法 (按顺序)。CreateElementGroup b。MarkRootElements c。CreateElementGroupPrototype 然后藏起来在数据参数的创建的 ElementGroupPrototype。
受保护的方法 AddElementGroupFormat(IDataObject, ICollection<ModelElement>, ClosureType, Boolean) 使用 ModelElements,的指定集合添加 ElementGroupPrototype 格式转换为指定的 IDataObject。可以从派生类调用强制元素链接要求加载以创建模型元素的集合。
受保护的方法 CanAddCustomFormat 返回一 ModelElement 集合是否的值可用于创建自定义格式。
受保护的方法 CanAddElementGroupFormat 返回一 ModelElement 集合是否的值可用于创建 ElementGroupPrototype 格式。
公共方法 CanCopy(ICollection<ModelElement>) 获取一 ModelElements 的集合是否的值可以复制到 IDataObject。
公共方法 CanCopy(ICollection<ModelElement>, ClosureType) 获取一 ModelElements 的集合是否的值可以复制到 IDataObject。调用 CanCopyCore 完成工作。
受保护的方法 CanCopyCore 获取一 ModelElements 的集合是否的值可以复制到 IDataObject。
公共方法 CanDelete(ModelElement, array<Guid[]) 查询一个指定的元素是否能删除,考虑任何 IMS 锁定适用于任何在元素中删除关闭的元素。
公共方法 CanDelete(IEnumerable<ModelElement>, array<Guid[]) 查询指定的元素是否能删除,考虑任何 IMS 锁定适用于任何元素的完全删除关闭的元素。
公共方法 CanMerge 返回一个从 IDataObject 的 ElementGroupPrototype 是否的值可合并 (即,粘贴或删除) 到目标 ModelElement。
公共方法 CanMergeElementGroupPrototype(ModelElement, ElementGroupPrototype) 返回一 MergeElementGroupPrototype 淡出中执行的。
受保护的方法 CanMergeElementGroupPrototype(ModelElement, ProtoElementBase, ElementGroupPrototype) 获取一 MergeElementGroupPrototype 是否的值可以为特定升降机和元素组原型。
公共方法 CanMove 获取一 ModelElements 的集合是否的值可以移动。
公共方法 ChooseMergeTarget(ModelElement, ElementGroup) 获取为合并的目标元素命名建议的 targetElement。默认情况下,此方法将写入目标元素机会更改与预期的目标。
公共方法 ChooseMergeTarget(ModelElement, ElementGroupPrototype) 获取为合并的目标元素命名建议的 targetElement。这使 ElementOperations 机会更改为合并的预期目标。默认情况下,此方法将写入目标元素机会更改与预期的目标。
公共方法 Copy(IDataObject, ICollection<ModelElement>) 复制 ModelElements 的集合到指定的 IDataObject 在一个或多个数据格式。
公共方法 Copy(IDataObject, ICollection<ModelElement>, ClosureType) 复制 ModelElements 的集合到指定的 IDataObject 在一个或多个数据格式。
公共方法 Copy(IDataObject, ICollection<ModelElement>, PointF) 复制 ModelElements 的集合到指定的 IDataObject 在一个或多个数据格式。
公共方法 Copy(IDataObject, ICollection<ModelElement>, ClosureType, PointF) 复制 ModelElements 的集合到指定的 IDataObject 在一个或多个数据格式。
受保护的方法 CreateElementGroup 创建 ClosureElementGroup
受保护的方法 CreateElementGroupPrototype
公共方法 Equals 确定指定的对象是否等于当前对象。 (继承自 Object。)
受保护的方法 Finalize 允许对象在“垃圾回收”回收之前尝试释放资源并执行其他清理操作。 (继承自 Object。)
公共方法静态成员 GetClipboardDataObject 返回从剪贴板的 IDataObject,如果它包含我们的 ElementGroupPrototype 格式,否则为 null。
公共方法静态成员 GetElementGroupPrototype ,如果存在,从 DataObject 获取 ElementGroupPrototype。
公共方法 GetHashCode 用作特定类型的哈希函数。 (继承自 Object。)
受保护的方法静态成员 GetModelingToolboxItemDisplayName 如果 IDataObject 包含 ModelingToolboxItem,则返回其 DisplayName; 否则为 null。
公共方法 GetType 获取当前实例的 Type。 (继承自 Object。)
公共方法静态成员 IsElementGroupPrototypeFormatAvailable 返回 true; 否则 ElementGroupPrototype 剪贴板格式可在剪贴板,否则为 false。
受保护的方法 MarkRootElements 标记。 elementGroup 参数的 RootElements。
受保护的方法 MemberwiseClone 创建当前 Object 的浅表副本。 (继承自 Object。)
公共方法 Merge 合并 (即,粘贴或投影) 从 IDataObject 的 ElementGroupPrototype 到目标 ModelElement。
公共方法 MergeElementGroup 具有指定的目标 ModelElement 将该源 ElementGroup。
公共方法 MergeElementGroupPrototype 具有指定的目标 ModelElement 将该源 ElementGroupPrototype。
受保护的方法 OnElementsReconstituted 调用 MergeElementGroupPrototype,在从 ElementGroupPrototype 的元素中重建后,,但,并在连接到设计的其余部分之前。
受保护的方法 OnMerged 调用由个本地事务之前的 MergeElementGroupPrototype 进行。规则中显示本地事务排队时并将激发该事务时间。一个本地事务包装重建的和连接的元素。
受保护的方法 OnMerging 调用 MergeElementGroupPrototype 中,目标元素已选定之后,,但,在从 ElementGroupPrototype 的元素中重建之前。
受保护的方法 PropagateElementGroupContextToTransaction 传播当前上下文在元素组中对为当前活动的顶部事务。
公共方法 ToString 返回表示当前对象的字符串。 (继承自 Object。)

页首

事件

  名称 说明
公共事件 ElementsReconstituted 调用 MergeElementGroupPrototype,在从 ElementGroupPrototype 的元素中重建后,,但,并在连接到设计的其余部分之前。
公共事件 Merged 调用由个本地事务之前的 MergeElementGroupPrototype 进行。规则中显示本地事务排队时并将激发该事务时间。一个本地事务包装重建的和连接的元素。
公共事件 Merging 调用 MergeElementGroupPrototype 中,目标元素已选定之后,,但,在从 ElementGroupPrototype 的元素中重建之前。

页首

备注

从此类派生来创建自定义数据布局复制并粘贴操作。 在关系图类,重写返回 ElementOperations 子类的实例的 ElementOperations 。 您应返回同一个实例在每次调用。

有关更多信息,请参见 如何:程序复制和粘贴行为 - 重定向

示例

using Microsoft.VisualStudio.Modeling;
using Microsoft.VisualStudio.Modeling.Diagrams;
using Microsoft.VisualStudio.Modeling.Diagrams.ExtensionEnablement;

  public partial class MyDslDiagram
  {
    public override DesignSurfaceElementOperations ElementOperations
    {
      get
      {
        if (this.elementOperations == null)
        {
          this.elementOperations = new MyElementOperations(this.Store as IServiceProvider, this);
        }
        return this.elementOperations;
      }
    }
    private MyElementOperations elementOperations = null;
  }

  public class MyElementOperations : DesignSurfaceElementOperations
  {
    public MyElementOperations(IServiceProvider serviceProvider, MyDslDiagram diagram)
      : base(serviceProvider, diagram)
    { }
    // Overridden methods follow
  }

线程安全

此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。

请参见

参考

Microsoft.VisualStudio.Modeling 命名空间