public static void Initialise(CECController controller)
{
_controller = controller;
- _instance = new Applications();
+ if (_instance == null)
+ _instance = new Applications();
controller.Settings["global_applications"] = _instance;
controller.Settings.Load(_instance);
using LibCECTray.controller;
using LibCECTray.controller.applications;
using LibCECTray.settings;
+using Microsoft.Win32;
+using System.Security.Permissions;
namespace LibCECTray.ui
{
else
OnShow();
};
+ SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(OnPowerModeChanged);
+ SystemEvents.SessionEnding += new SessionEndingEventHandler(OnSessionEnding);
+ }
+
+ public void OnSessionEnding(object sender, SessionEndingEventArgs e)
+ {
+ Controller.Close();
+ }
+
+ public void OnPowerModeChanged(Object sender, PowerModeChangedEventArgs e)
+ {
+ switch (e.Mode)
+ {
+ case PowerModes.Resume:
+ Controller.Initialise();
+ break;
+ case PowerModes.Suspend:
+ Controller.Close();
+ break;
+ case PowerModes.StatusChange:
+ break;
+ }
}
public override sealed string Text