PageRenderTime 13ms CodeModel.GetById 10ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/Manos.IO/Manos.IO.Managed/IdleWatcher.cs

http://github.com/jacksonh/manos
C# | 31 lines | 25 code | 6 blank | 0 comment | 3 complexity | 66c5c0ccc1df1b979714e99160acb416 MD5 | raw file
 1using System;
 2
 3namespace Manos.IO.Managed
 4{
 5	class IdleWatcher : Watcher, IIdleWatcher
 6	{
 7		private Action cb;
 8
 9		public IdleWatcher (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