ElementOperations 类

提供一般操作,其可在模型元素集合上作用。

继承层次结构

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

命名空间:  Microsoft.VisualStudio.Modeling
程序集:  Microsoft.VisualStudio.Modeling.Sdk.12.0(在 Microsoft.VisualStudio.Modeling.Sdk.12.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 集合添加 the ElementGroupPrototype 格式到指定的 IDataObject。此方法调用以下 3 个可重写的方法(按顺序)。CreateElementGroup b。MarkRootElements c。CreateElementGroupPrototype 然后它将创建的 CreateElementGroupPrototype 储存在数据参数中。
受保护的方法 AddElementGroupFormat(IDataObject, ICollection<ModelElement>, ClosureType, Boolean) 使用指定的 ModelElements 集合添加 the 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 返回一个从 ElementGroupPrototype IDataObject 的是否的值进行组合 (即,粘贴或删除) 为目标 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 如果其包含我们的 ElementGroupPrototype 格式,则返回 Clipboard 中的 IDataObject,否则为 null。。
公共方法静态成员 GetElementGroupPrototype 如果 DataObject 存在,则从 DataObject 中获取 ElementGroupPrototype。
公共方法 GetHashCode 作为默认哈希函数。 (继承自 Object。)
受保护的方法静态成员 GetModelingToolboxItemDisplayName 如果 IDataObject 包含 ModelingToolboxItem,则返回它的 DisplayName,否则返回 NULL 。
公共方法 GetType 获取当前实例的 Type。 (继承自 Object。)
公共方法静态成员 IsElementGroupPrototypeFormatAvailable 如果 ElementGroupPrototype 剪贴板格式在剪贴板上可用则返回 true,否则为 false。
受保护的方法 MarkRootElements 标记在 elementGroup 参数中的 Mark RootElements。
受保护的方法 MemberwiseClone 创建当前 Object 的浅表副本。 (继承自 Object。)
公共方法 Merge 合并 (即,粘贴或删除) 从 IDataObject 的 ElementGroupPrototype 到目标 ModelElement。
公共方法 MergeElementGroup 用指定的目标 ModelElement 合并源 ModelElement Merges ElementGroup。
公共方法 MergeElementGroupPrototype 用指定的目标 ModelElement 合并源 ModelElement Merges ElementGroupPrototype。
受保护的方法 OnElementsReconstituted 在 ElementGroupPrototype 中的元素重建后,但在其连接到该模型的其余部分之前,MergeElementGroupPrototype 立即进行调用。
受保护的方法 OnMerged 在提交本地事务之前,MergeElementGroupPrototype 立即进行调用。规则在本地事务期间排队并当事务提交时激发。本地事务包装重建并连接元素。
受保护的方法 OnMerging 在已选择目标元素之后,但在其连接到该模型的其余部分之前,MergeElementGroupPrototype 立即进行调用。
受保护的方法 PropagateElementGroupContextToTransaction 将元素组中存在的上下文传播至当前活动级别事务。
公共方法 ToString 返回表示当前对象的字符串。 (继承自 Object。)

页首

事件

  名称 说明
公共事件 ElementsReconstituted 在 ElementGroupPrototype 中的元素重建后,但在其连接到该模型的其余部分之前,MergeElementGroupPrototype 立即进行调用。
公共事件 Merged 在提交本地事务之前,MergeElementGroupPrototype 立即进行调用。规则在本地事务期间排队并当事务提交时激发。本地事务包装重建并连接元素。
公共事件 Merging 在已选择目标元素之后,但在其连接到该模型的其余部分之前,MergeElementGroupPrototype 立即进行调用。

页首

备注

从此类派生创建自定义数据格式对复制并粘贴操作。 在关系图的类,请重写 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 命名空间