CSharpTest.Net
Complete Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Threading Namespace > WaitAndContinueWorker Class : Complete Method

complete
timeout

Glossary Item Box

Exits the worker thread and, if complete is true, waits for the remaining tasks to complete

Syntax

Visual Basic (Declaration) 
Public Function Complete( _
   ByVal complete As Boolean, _
   ByVal timeout As Integer _
) As Boolean
C# 
public bool Complete( 
   bool complete,
   int timeout
)

Parameters

complete
timeout

Example

Library/Library.Test/TestWaitAndContinue.cs

C#Copy Code
using (WaitAndContinueWorker work = new WaitAndContinueWorker())
{
    work.OnError += delegate(object o, ErrorEventArgs e) { throw new Exception("Failed.", e.GetException()); };

    SampleWork item = new SampleWork();
    work.AddWork(item);

    Assert.IsFalse(work.IsEmpty);
    work.Complete(true, 10);

    Assert.IsFalse(item.Completed);
    Assert.IsTrue(item.Disposed);
}
VB.NETCopy Code
Using work As New WaitAndContinueWorker()
    work.OnError += Function(o As Object, e As ErrorEventArgs) Do
        Throw New Exception("Failed.", e.GetException())
    End Function

    Dim item As New SampleWork()
    work.AddWork(item)

    Assert.IsFalse(work.IsEmpty)
    work.Complete(True, 10)

    Assert.IsFalse(item.Completed)
    Assert.IsTrue(item.Disposed)
End Using

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys