Blocks until the service is stopping or the specified time elapses.
Namespace:
LeCouteauSuisse.APIAssembly: LeCouteauSuisseAPI (in LeCouteauSuisseAPI.dll) Version: 1.0.0.2 (1.0.0.2)
Syntax
C# |
---|
public virtual bool WaitStop( int timeout ) |
Visual Basic (Declaration) |
---|
Public Overridable Function WaitStop ( _ timeout As Integer _ ) As Boolean |
Visual C++ |
---|
public: virtual bool WaitStop( int timeout ) |
Parameters
- timeout
- Type: System..::.Int32
The number of milliseconds 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); }