Blocks until the service is stopping or the specified time elapses.

Namespace:  LeCouteauSuisse.API
Assembly:  LeCouteauSuisseAPI (in LeCouteauSuisseAPI.dll) Version: 1.0.0.2 (1.0.0.2)

Syntax

C#
public virtual bool WaitStop(
	TimeSpan timeout
)
Visual Basic (Declaration)
Public Overridable Function WaitStop ( _
	timeout As TimeSpan _
) As Boolean
Visual C++
public:
virtual bool WaitStop(
	TimeSpan timeout
)

Parameters

timeout
Type: System..::.TimeSpan
A TimeSpan set to the amount of time to wait for the service to stop.

Return Value

true if the service is stopping; false if the service is running after the amount of time specified by the millisecondsTimeout parameter has elapsed.

Examples

See this sample to add inside Run()()() method the to check the stop flag in your code :
CopyC#
while (!MustStop) // exit the loop on stopping
{
    try
    {
        if (WaitStop(delay)) // wait, but exit the loop on stopping
            break;
    }
    catch (Exception ex) { context.Logger.Write(LoggerLevel.Error, "Generator " + context.Name + " error while waiting", ex); }

    // Put here your business code to send an event
    // eventArgs = (GeneratorEvent)context.GetNewGeneratorEvent(typeof(GeneratorEvent));
    // base.OnNewEvent(eventArgs);
}

See Also