Click here to Skip to main content
15,924,679 members
Home / Discussions / C#
   

C#

 
Questionhi Pin
mon***z25-Mar-09 2:50
mon***z25-Mar-09 2:50 
AnswerRe: hi Pin
Xmen Real 25-Mar-09 3:10
professional Xmen Real 25-Mar-09 3:10 
AnswerRe: hi Pin
Deresen25-Mar-09 3:11
Deresen25-Mar-09 3:11 
QuestionHow can I make browser not to display its page content for 1 or 2 sec using c#? Pin
svt gdwl25-Mar-09 2:49
svt gdwl25-Mar-09 2:49 
QuestionHandling File Events in C# Pin
agent00zelda25-Mar-09 2:48
agent00zelda25-Mar-09 2:48 
AnswerRe: Handling File Events in C# Pin
Thomas Krojer25-Mar-09 2:55
Thomas Krojer25-Mar-09 2:55 
GeneralRe: Handling File Events in C# Pin
agent00zelda25-Mar-09 4:16
agent00zelda25-Mar-09 4:16 
AnswerRe: Handling File Events in C# [modified] Pin
Ian Shlasko25-Mar-09 4:55
Ian Shlasko25-Mar-09 4:55 
I believe it works on its own thread, then invokes the events to the UI thread. If your GUI is going to stay responsive, you don't have to worry about threading at all. Just create it, set the needed properties (Path, NotifyFilter, Filter), turn on EnableRaisingEvents, hook the events you want, and handle them as needed. If I remember right, this is a port from the old VBScript library, so it's intended to be as easy to use as possible.

To make sure it works that way, you might want to just be sure that you're CREATING it on the UI thread. If you don't, it might invoke events to a different thread unless you set the SynchronizingObject property to a GUI control. You can also use that same property to invoke the events onto a thread of your choosing.

If you want finer control, you can skip the events entirely, create it on a dedicated background thread, and loop on the WaitForChanged method, which will block until it receives a notification. Most of the time, this is overkill.

There's more detail on each of those properties and methods in the MSDN help.


EDIT: Sorry, missed where you said it was a console application. In that case, you probably want to go with the last method I mentioned, looping on WaitForChanged to do everything synchronously.

modified on Wednesday, March 25, 2009 11:10 AM

Questionchanging the database location Pin
Mubeen.asim25-Mar-09 1:53
Mubeen.asim25-Mar-09 1:53 
AnswerRe: changing the database location Pin
Ashfield25-Mar-09 2:11
Ashfield25-Mar-09 2:11 
GeneralRe: changing the database location Pin
Mubeen.asim25-Mar-09 5:04
Mubeen.asim25-Mar-09 5:04 
GeneralRe: changing the database location Pin
Ashfield25-Mar-09 5:49
Ashfield25-Mar-09 5:49 
GeneralRe: changing the database location Pin
Mubeen.asim25-Mar-09 6:49
Mubeen.asim25-Mar-09 6:49 
GeneralRe: changing the database location Pin
Ashfield25-Mar-09 9:09
Ashfield25-Mar-09 9:09 
QuestionC# library for visual network layout / flow chart needed Pin
midix25-Mar-09 1:27
midix25-Mar-09 1:27 
AnswerRe: C# library for visual network layout / flow chart needed Pin
Xmen Real 25-Mar-09 2:35
professional Xmen Real 25-Mar-09 2:35 
GeneralRe: C# library for visual network layout / flow chart needed Pin
midix25-Mar-09 3:45
midix25-Mar-09 3:45 
Questionadapting a webcam driver to an existing form Pin
VitroBlue25-Mar-09 1:26
VitroBlue25-Mar-09 1:26 
AnswerRe: adapting a webcam driver to an existing form [modified] Pin
erfi25-Mar-09 3:10
erfi25-Mar-09 3:10 
QuestionSplit methode Pin
abbd25-Mar-09 1:08
abbd25-Mar-09 1:08 
AnswerRe: Split method Pin
fly90425-Mar-09 1:17
fly90425-Mar-09 1:17 
GeneralRe: Split method Pin
abbd25-Mar-09 1:21
abbd25-Mar-09 1:21 
GeneralRe: Split method Pin
fly90425-Mar-09 1:22
fly90425-Mar-09 1:22 
GeneralRe: Split method Pin
abbd25-Mar-09 1:25
abbd25-Mar-09 1:25 
GeneralRe: Split method Pin
fly90425-Mar-09 1:28
fly90425-Mar-09 1:28 

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.