public int EventsNavHandler(NameValueCollection parameters) { using (XbmcMonitor m = new XbmcMonitor()) { m.OnScreensaverActivated += new EventHandler <EventArgs>(delegate(object s, EventArgs ev) { Console.WriteLine("=> Screensaver Activated!"); }); m.OnScreensaverDeactivated += new EventHandler <EventArgs>(delegate(object s, EventArgs ev) { Console.WriteLine("=> Screensaver Deactivated!"); }); m.OnNotification += new EventHandler <NotificationEventArgs>(delegate(object s, NotificationEventArgs ev) { Console.WriteLine(string.Format("=> Notification from {0}({1}) ==> {2}", ev.Sender, ev.Method, ev.Data)); }); Kodi.Sleep(TimeSpan.FromSeconds(1)); Console.WriteLine("Triggering screensaver"); SystemBuiltins.ActivateScreensaver(); if (!m.AbortRequested) { m.WaitForAbort(TimeSpan.FromSeconds(10)); } } return(0); }
public static void GlobalEventsNavHandler(NameValueCollection parameters) { GlobalEvents.Notification += new EventHandler <NotificationEventArgs>(delegate(object s, NotificationEventArgs ev) { Console.WriteLine(string.Format("=> Notification from {0}({1}) ==> {2}", ev.Sender, ev.Method, ev.Data)); }); Thread.Sleep(TimeSpan.FromSeconds(1)); Console.WriteLine("Triggering screensaver"); SystemBuiltins.ActivateScreensaver(); }
public static void EventsNavHandler(NameValueCollection parameters) { Smx.KodiInterop.Modules.Xbmc.Monitor m = new Smx.KodiInterop.Modules.Xbmc.Monitor(); m.Notification += new EventHandler <NotificationEventArgs>(delegate(object s, NotificationEventArgs ev) { Console.WriteLine(string.Format("=> Notification from {0}({1}) ==> {2}", ev.Sender, ev.Method, ev.Data)); }); Thread.Sleep(TimeSpan.FromSeconds(1)); Console.WriteLine("Triggering screensaver"); SystemBuiltins.ActivateScreensaver(); /* Keep monitoring for a bit */ Kodi.Sleep(TimeSpan.FromSeconds(10)); }