Επεξεργασία

Κοινή χρήση μέσω


WorkflowDesignerLoader.Dispose Method

Definition

Releases all resources used by the WorkflowDesignerLoader.

public:
 override void Dispose();
public override void Dispose ();
override this.Dispose : unit -> unit
Public Overrides Sub Dispose ()

Examples

The following example demonstrates an implementation of the Dispose method. In this implementation, various services that have been added to the LoaderHost object are removed in preparation for closing the application. This example is from the Tracking Profile Designer SDK sample. For more information, see Tracking Profile Designer Sample.

public override void Dispose()
{
    try
    {
        IDesignerLoaderHost host = LoaderHost;
        if (host != null)
        {
            host.RemoveService(typeof(IIdentifierCreationService));
            host.RemoveService(typeof(IMenuCommandService));
            host.RemoveService(typeof(IToolboxService));
            host.RemoveService(typeof(ITypeProvider), true);
            host.RemoveService(typeof(IWorkflowCompilerOptionsService));
            host.RemoveService(typeof(IEventBindingService));
        }
    }
    finally
    {
        base.Dispose();
    }
}
Public Overrides Sub Dispose()
    Try
        Dim host As IDesignerLoaderHost = LoaderHost
        If host IsNot Nothing Then
            host.RemoveService(GetType(IIdentifierCreationService))
            host.RemoveService(GetType(IMenuCommandService))
            host.RemoveService(GetType(IToolboxService))
            host.RemoveService(GetType(ITypeProvider), True)
            host.RemoveService(GetType(IWorkflowCompilerOptionsService))
            host.RemoveService(GetType(IEventBindingService))
        End If
    Finally
        MyBase.Dispose()
    End Try
End Sub

Remarks

Dispose releases all services used by the designer host, but it does not write pending changes to the designer loader. If you want to save any pending changes prior to releasing all resources, call Flush before you call Dispose.

Applies to