PageRenderTime 51ms CodeModel.GetById 30ms app.highlight 1ms RepoModel.GetById 19ms app.codeStats 0ms

/src/Manos.IO/Manos.IO.Managed/CheckWatcher.cs

http://github.com/jacksonh/manos
C# | 31 lines | 25 code | 6 blank | 0 comment | 3 complexity | 3ef3c577bad050417001cc2fe3060998 MD5 | raw file
 1using System;
 2
 3namespace Manos.IO.Managed
 4{
 5	class CheckWatcher : Watcher, ICheckWatcher
 6	{
 7		private Action cb;
 8
 9		public CheckWatcher (Context context, Action callback)
10			: base (context)
11		{
12			if (callback == null)
13				throw new ArgumentNullException ("callback");
14			
15			this.cb = callback;
16		}
17
18		public void Invoke ()
19		{
20			if (IsRunning) {
21				cb ();
22			}
23		}
24
25		protected override void Dispose (bool disposing)
26		{
27			Context.Remove (this);
28		}
29	}
30}
31