Click here to Skip to main content
16,004,887 members
Home / Discussions / C#
   

C#

 
AnswerRe: Windows Service in background Pin
kryzchek28-Feb-07 10:05
kryzchek28-Feb-07 10:05 
QuestionThread question Pin
teejayem28-Feb-07 7:29
teejayem28-Feb-07 7:29 
AnswerRe: Thread question Pin
CPallini28-Feb-07 9:44
mveCPallini28-Feb-07 9:44 
GeneralRe: Thread question Pin
teejayem28-Feb-07 10:43
teejayem28-Feb-07 10:43 
GeneralRe: Thread question Pin
CPallini28-Feb-07 11:18
mveCPallini28-Feb-07 11:18 
GeneralRe: Thread question Pin
pbraun4-Mar-07 4:24
pbraun4-Mar-07 4:24 
GeneralRe: Thread question Pin
teejayem5-Mar-07 12:35
teejayem5-Mar-07 12:35 
AnswerRe: Thread question Pin
pbraun5-Mar-07 13:41
pbraun5-Mar-07 13:41 
In that case, my preference would be to do the following:

Create a queue of some type (Look up "Queue") to which the records to be printed will be added. Also create an auto reset event that can be signaled each time a record is added to the queue. Finally, create and start the print thread.

When the user wants to print, the print process can queue the record and signal the auto reset event that there is a record to print.

The print thread should do the following:

In a loop the thread must wait until signaled.
Check if the application is shutting down and if so, exit the loop.
In a loop, inside the loop mentioned above, pop the first record off the queue and print it until there are no more records in the queue to print.

Of course you will have to lock the queue when adding records and also when popping the records off for printing so that the queue does not get corrupt.

This will allow the printing to occur in a separate thread from the GUI thread which will allow the GUI to respond to user input.


Phil
QuestionMP3 in memorystream Pin
neurobion28-Feb-07 6:38
neurobion28-Feb-07 6:38 
QuestionSimple program for USB joystick [modified] Pin
quwip1028-Feb-07 6:37
quwip1028-Feb-07 6:37 
AnswerRe: Simple program for USB joystick Pin
Wayne Phipps28-Feb-07 8:43
Wayne Phipps28-Feb-07 8:43 
GeneralRe: Simple program for USB joystick Pin
quwip101-Mar-07 6:07
quwip101-Mar-07 6:07 
AnswerRe: Simple program for USB joystick Pin
Dave Kreskowiak1-Mar-07 2:24
mveDave Kreskowiak1-Mar-07 2:24 
Questionreturn generic collection from webservice Pin
arkiboys28-Feb-07 6:01
arkiboys28-Feb-07 6:01 
AnswerRe: return generic collection from webservice Pin
kubben28-Feb-07 6:06
kubben28-Feb-07 6:06 
GeneralRe: return generic collection from webservice Pin
arkiboys28-Feb-07 6:23
arkiboys28-Feb-07 6:23 
GeneralRe: return generic collection from webservice Pin
kubben28-Feb-07 6:25
kubben28-Feb-07 6:25 
GeneralRe: return generic collection from webservice Pin
arkiboys28-Feb-07 6:27
arkiboys28-Feb-07 6:27 
GeneralRe: return generic collection from webservice Pin
kubben28-Feb-07 6:30
kubben28-Feb-07 6:30 
GeneralRe: return generic collection from webservice Pin
arkiboys28-Feb-07 6:32
arkiboys28-Feb-07 6:32 
GeneralRe: return generic collection from webservice Pin
kubben28-Feb-07 6:35
kubben28-Feb-07 6:35 
GeneralRe: return generic collection from webservice Pin
arkiboys28-Feb-07 6:38
arkiboys28-Feb-07 6:38 
GeneralRe: return generic collection from webservice Pin
kubben28-Feb-07 6:42
kubben28-Feb-07 6:42 
GeneralRe: return generic collection from webservice Pin
arkiboys28-Feb-07 6:44
arkiboys28-Feb-07 6:44 
GeneralRe: return generic collection from webservice Pin
arkiboys28-Feb-07 6:46
arkiboys28-Feb-07 6:46 

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.