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