/// <summary> /// Event handler when a GUI property was changed /// </summary> /// <param name="tag"></param> /// <param name="tagValue"></param> void GUIPropertyManager_OnPropertyChanged(string tag, string tagValue) { if (tag.Equals("#currentmodule")) { if (tagValue != null && tagValue.Equals(localizedKeyboard)) { MessageOnscreenKeyboard keyboardMessage = new MessageOnscreenKeyboard(true); string keyboard = Newtonsoft.Json.JsonConvert.SerializeObject(keyboardMessage); socketServer.SendMessageToAllClients(keyboard); keyboardIsActive = true; } else if (keyboardIsActive) { MessageOnscreenKeyboard keyboardMessage = new MessageOnscreenKeyboard(false); string keyboard = Newtonsoft.Json.JsonConvert.SerializeObject(keyboardMessage); socketServer.SendMessageToAllClients(keyboard); keyboardIsActive = false; } IRenderLayer layer = GUILayerManager.GetLayer(GUILayerManager.LayerType.Dialog); if (layer != null && layer.GetType().IsSubclassOf(typeof(GUIDialogWindow))) { WifiRemote.LogMessage("Sending dialog open to clients", LogType.Debug); MpDialogsHelper.CurrentDialog = layer as GUIDialogWindow; MessageDialog msg = MpDialogsHelper.GetDialogMessage(MpDialogsHelper.CurrentDialog); if (msg != null && msg.Dialog != null && msg.Dialog.GetType() == typeof(MpDialogMenu)) { //TODO: this is a hack to retrieve the list items of a dialog because they are //set after initialisation of the dialog and there is no event fired up after //that. We might run into situations where the list hasn't been updated when //we try to read it Thread t = new Thread(new ParameterizedThreadStart(SendDelayed)); t.Start(msg); } else if (msg != null && msg.Dialog != null && msg.Dialog.GetType() == typeof(MpDialogProgress)) { Thread t = new Thread(new ParameterizedThreadStart(SendProgressUpdates)); t.Start(msg); } else { socketServer.SendMessageToAllClients(msg); } MpDialogsHelper.IsDialogShown = true; } else if (MpDialogsHelper.IsDialogShown) { WifiRemote.LogMessage("Sending dialog close to clients", LogType.Debug); MessageDialog message = new MessageDialog(); message.DialogShown = false; socketServer.SendMessageToAllClients(message); MpDialogsHelper.IsDialogShown = false; } } if (tag.Equals("#selecteditem") || tag.Equals("#selecteditem2") || tag.Equals("#highlightedbutton") || tag.Equals("#currentmodule")) { SendStatus(); } else if (tag.StartsWith("#Play.") || tag.StartsWith("#TV.")) { socketServer.SendPropertyToClient(tag, tagValue); } if (tag.Equals("#selectedindex") || tag.Equals("#highlightedbutton")) { socketServer.SendListViewStatusToAllClientsIfChanged(); } }
/// <summary> /// Event handler when a GUI property was changed /// </summary> /// <param name="tag"></param> /// <param name="tagValue"></param> void GUIPropertyManager_OnPropertyChanged(string tag, string tagValue) { if (tag.Equals("#currentmodule")) { if (tagValue != null && tagValue.Equals(localizedKeyboard)) { MessageOnscreenKeyboard keyboardMessage = new MessageOnscreenKeyboard(true); string keyboard = Newtonsoft.Json.JsonConvert.SerializeObject(keyboardMessage); socketServer.SendMessageToAllClients(keyboard); keyboardIsActive = true; } else if (keyboardIsActive) { MessageOnscreenKeyboard keyboardMessage = new MessageOnscreenKeyboard(false); string keyboard = Newtonsoft.Json.JsonConvert.SerializeObject(keyboardMessage); socketServer.SendMessageToAllClients(keyboard); keyboardIsActive = false; } IRenderLayer layer = GUILayerManager.GetLayer(GUILayerManager.LayerType.Dialog); if (layer != null && layer.GetType().IsSubclassOf(typeof(GUIDialogWindow))) { WifiRemote.LogMessage("Sending dialog open to clients", LogType.Debug); MpDialogsHelper.CurrentDialog = layer as GUIDialogWindow; MessageDialog msg = MpDialogsHelper.GetDialogMessage(MpDialogsHelper.CurrentDialog); if (msg != null && msg.Dialog != null && msg.Dialog.GetType() == typeof(MpDialogMenu)) { //TODO: this is a hack to retrieve the list items of a dialog because they are //set after initialisation of the dialog and there is no event fired up after //that. We might run into situations where the list hasn't been updated when //we try to read it Thread t = new Thread(new ParameterizedThreadStart(SendDelayed)); t.Start(msg); } else if (msg != null && msg.Dialog != null && msg.Dialog.GetType() == typeof(MpDialogProgress)) { Thread t = new Thread(new ParameterizedThreadStart(SendProgressUpdates)); t.Start(msg); } else { socketServer.SendMessageToAllClients(msg); } MpDialogsHelper.IsDialogShown = true; } else if (MpDialogsHelper.IsDialogShown) { WifiRemote.LogMessage("Sending dialog close to clients", LogType.Debug); MessageDialog message = new MessageDialog(); message.DialogShown = false; socketServer.SendMessageToAllClients(message); MpDialogsHelper.IsDialogShown = false; } } if (tag.Equals("#selecteditem") || tag.Equals("#selecteditem2") || tag.Equals("#highlightedbutton") || tag.Equals("#currentmodule")) { SendStatus(); } else if (tag.StartsWith("#Play.") || tag.StartsWith("#TV.")) { socketServer.SendPropertyToClient(tag, tagValue); } if (tag.Equals("#selectedindex") || tag.Equals("#highlightedbutton")) { socketServer.SendListViewStatusToAllClientsIfChanged(); } }