Click here to Skip to main content
15,893,790 members
Home / Discussions / C#
   

C#

 
GeneralRe: BackgroundWorker method executing twice Pin
scody18-Sep-08 20:35
scody18-Sep-08 20:35 
GeneralRe: BackgroundWorker method executing twice Pin
#realJSOP18-Sep-08 23:53
mve#realJSOP18-Sep-08 23:53 
AnswerRe: BackgroundWorker method executing twice Pin
Steve Echols18-Sep-08 19:51
Steve Echols18-Sep-08 19:51 
AnswerRe: BackgroundWorker method executing twice Pin
scody18-Sep-08 21:03
scody18-Sep-08 21:03 
QuestionHow do I know BackgroundWorker work complete? Pin
mimimimilaw18-Sep-08 18:01
mimimimilaw18-Sep-08 18:01 
AnswerRe: How do I know BackgroundWorker work complete? Pin
N a v a n e e t h18-Sep-08 18:12
N a v a n e e t h18-Sep-08 18:12 
GeneralRe: How do I know BackgroundWorker work complete? Pin
mimimimilaw18-Sep-08 18:56
mimimimilaw18-Sep-08 18:56 
GeneralRe: How do I know BackgroundWorker work complete? Pin
N a v a n e e t h18-Sep-08 19:28
N a v a n e e t h18-Sep-08 19:28 
Implementing waithandles is trivial. Here is a console application.
class Program{
    static EventWaitHandle handle = new AutoResetEvent(false);
    static void Main(string[] args) {
         BackgroundWorker worker = new BackgroundWorker();
         worker.DoWork += new DoWorkEventHandler(worker_DoWork);
         worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
         worker.RunWorkerAsync();

         Console.WriteLine("Main thread waiting");
         handle.WaitOne(); // This blocks main thread
         Console.WriteLine("Main thread released.");
         Console.Read();
    }

    static void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
         Console.WriteLine("Worker finished. Releasing main thread");
         handle.Set();
    }

    static void worker_DoWork(object sender, DoWorkEventArgs e) {
         Thread.Sleep(1000); // Simulate a long running job
     }
}
Hope it is clear now

All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia

How to use google | Ask smart questions

AnswerRe: How do I know BackgroundWorker work complete? Pin
#realJSOP18-Sep-08 23:57
mve#realJSOP18-Sep-08 23:57 
QuestionHow to compress and decompress an image using GDI+ JPEG? Pin
gigahertz20518-Sep-08 17:57
gigahertz20518-Sep-08 17:57 
AnswerRe: How to compress and decompress an image using GDI+ JPEG? Pin
Anthony Mushrow19-Sep-08 1:02
professionalAnthony Mushrow19-Sep-08 1:02 
QuestionOutlook Issue. Newbie Question Pin
kruegersck18-Sep-08 17:33
kruegersck18-Sep-08 17:33 
QuestionFIB Pin
Miss_hacker18-Sep-08 16:09
Miss_hacker18-Sep-08 16:09 
QuestionCan i write a small plugin for Internet Explorer in .Net ? Pin
SWSDEV18-Sep-08 14:28
SWSDEV18-Sep-08 14:28 
QuestionCrystal Reports Help Pin
Alldaypilot18-Sep-08 14:10
Alldaypilot18-Sep-08 14:10 
QuestionRead already opened file Pin
srabik18-Sep-08 13:27
srabik18-Sep-08 13:27 
AnswerRe: Read already opened file Pin
Guffa18-Sep-08 21:20
Guffa18-Sep-08 21:20 
GeneralRe: Read already opened file Pin
srabik20-Sep-08 3:48
srabik20-Sep-08 3:48 
QuestionMouseMove in a container [modified] Pin
Rafone18-Sep-08 13:05
Rafone18-Sep-08 13:05 
AnswerRe: MouseMove in a container Pin
Ajay.k_Singh18-Sep-08 19:51
Ajay.k_Singh18-Sep-08 19:51 
GeneralRe: MouseMove in a container Pin
Rafone19-Sep-08 2:33
Rafone19-Sep-08 2:33 
GeneralRe: MouseMove in a container Pin
Ajay.k_Singh19-Sep-08 3:31
Ajay.k_Singh19-Sep-08 3:31 
GeneralRe: MouseMove in a container Pin
Rafone19-Sep-08 5:31
Rafone19-Sep-08 5:31 
AnswerRe: MouseMove in a container Pin
Rafone19-Sep-08 6:50
Rafone19-Sep-08 6:50 
QuestionCan a template parameter be restricted to primitive types? Pin
HosamAly18-Sep-08 11:24
HosamAly18-Sep-08 11:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.