API Help
Eplan.EplApi.Base.Internal Namespace / EplanMainThreadDispatcher Class
Members Example

In This Topic
    EplanMainThreadDispatcher Class
    In This Topic
    EplanMainThreadDispatcher can execute some work in the main thread of Eplan.
    Inheritance Hierarchy

    System.Object
       Eplan.EplApi.Base.Internal.EplanMainThreadDispatcher

    Syntax
    public class EplanMainThreadDispatcher 
    public ref class EplanMainThreadDispatcher 
    Remarks
    Executing API code purely of of main Eplan thread is not recommended, i.e. such scenarios were not tested and are out of support. So the class enables executing API code on a main thread from another thread (i.e. like in case of non-modal dialogs or a background worked)
    Example

     

    //run an action asynchronously
    eplanMainThreadDispatcher.ExecuteInMainThreadAsync(
            () => { new CommandLineInterpreter().Execute("check /TYPE:PROJECT"); }
        );
    
    //create a progress bar with a background work
    using (Progress progress = new Progress("SimpleProgress"))
    {
        eplanMainThreadDispatcher.AddProgressBackgroundWork(progress,
            () => { new CommandLineInterpreter().Execute("check /TYPE:PROJECT"); }
        );
    }
    
    
    Public Constructors
     NameDescription
    Public ConstructorCreates a new dispatcher  
    Top
    Public Methods
     NameDescription
    Public MethodAllows the user to add a progress bar when main thread is working.  
    Public Methodstatic (Shared in Visual Basic)Allows the user to access the main thread both synchronously and asynchronously.  
    Public MethodDestructor for deterministic finalization of EplanMainThreadDispatcher object.  
    Public MethodOverloaded. Execute this work in a asynchronous main thread.  
    Public MethodExecute this work in a synchronous main thread.  
    Public Methodstatic (Shared in Visual Basic)Allows to use the dispatcher to work on synchronous and asynchronous threads.  
    Top
    See Also