Click here to Skip to main content
15,922,584 members
Home / Discussions / C#
   

C#

 
QuestionRe: enlarging picture box Pin
rzvme4-Oct-06 23:42
rzvme4-Oct-06 23:42 
QuestionRemoting - interface vs proxy (soapsuds) Pin
Chuck Bevitt4-Oct-06 8:48
Chuck Bevitt4-Oct-06 8:48 
AnswerRe: Remoting - interface vs proxy (soapsuds) Pin
led mike4-Oct-06 10:17
led mike4-Oct-06 10:17 
Question3 state Button - weird behaviour Pin
seq-4-Oct-06 8:41
seq-4-Oct-06 8:41 
AnswerRe: 3 state Button - weird behaviour Pin
Christian Graus4-Oct-06 9:36
protectorChristian Graus4-Oct-06 9:36 
AnswerRe: 3 state Button - weird behaviour [modified] Pin
Ilíon4-Oct-06 9:59
Ilíon4-Oct-06 9:59 
Questionfile system watcher problem Pin
gus_br4-Oct-06 8:39
gus_br4-Oct-06 8:39 
AnswerRe: file system watcher problem Pin
Andrew Rissing4-Oct-06 11:42
Andrew Rissing4-Oct-06 11:42 
I've encountered this problem as well. FileSystemWatchers have some inherent issues with them. This is the probably one of the more annoying ones. The events that fire off of the watcher are not necessarily after the file system has finished with the file. Furthermore, it can send multiple events for a single file copy/etc.

Now, to overcome this issue myself, I've done two things.

1) Wrote a generic class with an internal timer that buffers events. It captures an event and stores off the time of the event, updating duplicate events where necessary. At a set interval, the timer fires on the events that have elapsed a set time to an external body.

2) When accessing the files, I have a while loop that tries to access the file a set number of times. It catches any exceptions that might occur and then sleeps. Rinse and repeat.

I found that most of the issues that would cause exceptions are avoided via the first part of the solution, while the second just handles the lag time between completing the last writes to the file and releasing it. It seems to work out pretty good, if you need the generic class I can pass that on.

As a side tip, I would watchout for FileSystemWatchers because they seem to break down when any two FileSystemWatchers end up watching the same directory (which can easily occur if you include sub-directories).

Good luck.
GeneralRe: file system watcher problem Pin
gus_br4-Oct-06 14:04
gus_br4-Oct-06 14:04 
GeneralRe: file system watcher problem Pin
Andrew Rissing5-Oct-06 4:27
Andrew Rissing5-Oct-06 4:27 
GeneralRe: file system watcher problem Pin
gus_br6-Oct-06 7:03
gus_br6-Oct-06 7:03 
AnswerRe: file system watcher problem Pin
Andrew Rissing6-Oct-06 7:25
Andrew Rissing6-Oct-06 7:25 
QuestionDllImport / PInvoke Problem? Pin
David Knechtges4-Oct-06 8:18
David Knechtges4-Oct-06 8:18 
AnswerRe: DllImport / PInvoke Problem? Pin
Ed.Poore4-Oct-06 11:11
Ed.Poore4-Oct-06 11:11 
GeneralRe: DllImport / PInvoke Problem? Pin
David Knechtges5-Oct-06 7:32
David Knechtges5-Oct-06 7:32 
QuestionGTK# deployment - an installer project. Pin
P85Dyer4-Oct-06 7:47
P85Dyer4-Oct-06 7:47 
QuestionGrouping Array of Objects by Properties Pin
tntomek4-Oct-06 7:14
tntomek4-Oct-06 7:14 
AnswerRe: Grouping Array of Objects by Properties Pin
LongRange.Shooter4-Oct-06 7:17
LongRange.Shooter4-Oct-06 7:17 
GeneralRe: Grouping Array of Objects by Properties Pin
tntomek4-Oct-06 7:38
tntomek4-Oct-06 7:38 
AnswerRe: Grouping Array of Objects by Properties Pin
Nicholas Butler4-Oct-06 8:45
sitebuilderNicholas Butler4-Oct-06 8:45 
GeneralRe: Grouping Array of Objects by Properties Pin
LongRange.Shooter4-Oct-06 14:29
LongRange.Shooter4-Oct-06 14:29 
QuestionSorting a listview from an array. Pin
teejayem4-Oct-06 6:10
teejayem4-Oct-06 6:10 
AnswerRe: Sorting a listview from an array. Pin
aamironline4-Oct-06 6:38
aamironline4-Oct-06 6:38 
AnswerRe: Sorting a listview from an array. Pin
Eric Dahlvang4-Oct-06 6:39
Eric Dahlvang4-Oct-06 6:39 
QuestionHow to get two child classes to access a third class Pin
Muntyness4-Oct-06 5:12
Muntyness4-Oct-06 5:12 

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.