/// <summary> /// /// </summary> /// <param name="aWndHandle"></param> /// <param name="aDeviceName"></param> /// <param name="aHdmiPort"></param> public void Start(IntPtr aWndHandle, string aDeviceName, byte aHdmiPort) { //Assuming monitor is on when we start up MonitorPowerOn = true; //Create our power setting notifier and register the event we are interested in iSkipNextMonitorPowerNotification = true; iPowerSettingNotifier = new PowerManager.SettingNotifier(aWndHandle); iPowerSettingNotifier.OnMonitorPowerOn += OnMonitorPowerOn; iPowerSettingNotifier.OnMonitorPowerOff += OnMonitorPowerOff; //CEC Client = new Cec.Client(aDeviceName, aHdmiPort, CecDeviceType.PlaybackDevice); ConnectCecClient(); }
// public void Stop() { // if (iPowerSettingNotifier != null) { iPowerSettingNotifier.OnMonitorPowerOn -= OnMonitorPowerOn; iPowerSettingNotifier.OnMonitorPowerOff -= OnMonitorPowerOff; iPowerSettingNotifier = null; } // if (Client != null) { Client.Close(); Client.Dispose(); Client = null; } }