0

In my WPF application one of the assumptions is watching a folder to capture changes.

My first idea is:

DispatcherTimer dt = new DispatcherTimer();
dt.Tick += (senderTick, eTick) =>
{
     // do observable folder
};
dt.Interval = new TimeSpan(0, 0, 1);
dt.Start();

The example works but I do not know if it is the best solution. My other idea is use Reactive Extenison

var timer = Observable.Interval(Timespan.FromMilliseconds(1000));
timer.Subscribe(tick => OnSomeCondition());

However, I am not convinced. Maybe there are better spoosby? Maybe it would be a good idea to write a separate application as a Windows service that would do it anyway.

J-Alex
  • 6,881
  • 10
  • 46
  • 64
18666
  • 125
  • 1
  • 18

1 Answers1

2

Running a Windows service would be one idea and I would say it depends on the situation you have. Have you considered IO FileSystemWatcher?

Marian Dolinský
  • 3,312
  • 3
  • 15
  • 29
Edgaras
  • 154
  • 9
  • RX looks cool and I would like to learn it, it's the first application I have for him in my application. Which I can implement without modifying the old code. – 18666 May 26 '17 at 21:58
  • Bypass operation on files which is better for performing cyclic code operations? – 18666 May 26 '17 at 22:07