WorkflowDesignerLoader.Initialize 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
使用设计器加载程序宿主所需的任何服务初始化 WorkflowDesignerLoader。
protected:
override void Initialize();
protected override void Initialize ();
override this.Initialize : unit -> unit
Protected Overrides Sub Initialize ()
示例
下面的示例演示如何在派生类中重写 Initialize 方法以添加设计器所需的服务。 根据应用程序所需的服务支持级别,这些服务会有所不同。
protected override void Initialize()
{
base.Initialize();
IDesignerLoaderHost host = this.LoaderHost;
if (host != null)
{
host.RemoveService(typeof(IIdentifierCreationService));
host.AddService(typeof(IIdentifierCreationService), new IdentifierCreationService(host));
host.AddService(typeof(IMenuCommandService), new WorkflowMenuCommandService(host));
host.AddService(typeof(IToolboxService), new Toolbox(host));
TypeProvider typeProvider = new TypeProvider(host);
typeProvider.AddAssemblyReference(typeof(string).Assembly.Location);
host.AddService(typeof(ITypeProvider), typeProvider, true);
host.AddService(typeof(IEventBindingService), new EventBindingService());
}
}
Protected Overrides Sub Initialize()
MyBase.Initialize()
Dim host As IDesignerLoaderHost = Me.LoaderHost
If host IsNot Nothing Then
host.RemoveService(GetType(IIdentifierCreationService))
host.AddService(GetType(IIdentifierCreationService), New IdentifierCreationService(host))
host.AddService(GetType(IMenuCommandService), New WorkflowMenuCommandService(host))
host.AddService(GetType(IToolboxService), New Toolbox(host))
Dim typeProvider As New TypeProvider(host)
typeProvider.AddAssemblyReference(GetType(String).Assembly.Location)
host.AddService(GetType(ITypeProvider), typeProvider, True)
host.AddService(GetType(IEventBindingService), New EventBindingService())
End If
End Sub