diff -r 22b327842add -r d2295c186ce1 Server/MainForm.cs
--- a/Server/MainForm.cs Sat Sep 26 11:56:49 2015 +0200
+++ b/Server/MainForm.cs Sat Sep 26 16:35:27 2015 +0200
@@ -59,7 +59,7 @@
public delegate void SetLayoutDelegate(string SessionId, TableLayout aLayout);
public delegate void SetClientNameDelegate(string aSessionId, string aName);
public delegate void PlainUpdateDelegate();
-
+ public delegate void WndProcDelegate(ref Message aMessage);
///
/// Our Display manager main form
@@ -92,8 +92,13 @@
private MMDevice iMultiMediaDevice;
//Network
private NetworkManager iNetworkManager;
+
+ ///
+ /// CEC - Consumer Electronic Control.
+ /// Notably used to turn TV on and off as Windows broadcast monitor on and off notifications.
+ ///
+ private ConsumerElectronicControl iCecManager;
-
///
/// Manage run when Windows startup option
///
@@ -104,6 +109,11 @@
///
private NotifyIconAdv iNotifyIcon;
+ ///
+ /// Allow user to receive window messages;
+ ///
+ public event WndProcDelegate OnWndProc;
+
public MainForm()
{
iSkipFrameRendering = false;
@@ -174,8 +184,13 @@
iNetworkManager.OnConnectivityChanged += OnConnectivityChanged;
UpdateNetworkStatus();
- //Setup notification icon
- SetupTrayIcon();
+ //CEC
+ iCecManager = new ConsumerElectronicControl();
+ OnWndProc += iCecManager.OnWndProc;
+ iCecManager.Start(Handle,"CEC", 2);
+
+ //Setup notification icon
+ SetupTrayIcon();
// To make sure start up with minimize to tray works
if (WindowState == FormWindowState.Minimized && Properties.Settings.Default.MinimizeToTray)
@@ -1279,6 +1294,7 @@
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
+ iCecManager.Stop();
iNetworkManager.Dispose();
CloseDisplayConnection();
StopServer();
@@ -2188,5 +2204,19 @@
Properties.Settings.Default.OpticalDriveToEject = comboBoxOpticalDrives.SelectedItem.ToString();
Properties.Settings.Default.Save();
}
+
+ ///
+ /// Broadcast messages to subscribers.
+ ///
+ ///
+ protected override void WndProc(ref Message aMessage)
+ {
+ if (OnWndProc!=null)
+ {
+ OnWndProc(ref aMessage);
+ }
+
+ base.WndProc(ref aMessage);
+ }
}
}