protected void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message) { if (message.ChannelName == ServerConnectionMessaging.CHANNEL) { ServerConnectionMessaging.MessageType messageType = (ServerConnectionMessaging.MessageType) message.MessageType; switch (messageType) { case ServerConnectionMessaging.MessageType.HomeServerAttached: case ServerConnectionMessaging.MessageType.HomeServerDetached: FireStateChanged(); break; } } else if (message.ChannelName == SharesMessaging.CHANNEL) { SharesMessaging.MessageType messageType = (SharesMessaging.MessageType) message.MessageType; switch (messageType) { case SharesMessaging.MessageType.ShareAdded: case SharesMessaging.MessageType.ShareRemoved: FireStateChanged(); break; } } }
/// <summary> /// Sends a message that a share was changed (<see cref="MessageType.ShareChanged"/>). /// </summary> /// <param name="share">Share which was changed.</param> /// <param name="relocationMode">Controls how the data of the changed share should be adapted at the server.</param> public static void SendShareChangedMessage(Share share, RelocationMode relocationMode) { SystemMessage msg = new SystemMessage(MessageType.ShareChanged); msg.MessageData[SHARE] = share; msg.MessageData[RELOCATION_MODE] = relocationMode; ServiceRegistration.Get<IMessageBroker>().Send(CHANNEL, msg); }
public const string DIALOG_RESULT = "DialogResult"; // Type: DialogResult public static void SendDialogManagerMessage(Guid dialogHandle, DialogResult result) { SystemMessage msg = new SystemMessage(MessageType.DialogClosed); msg.MessageData[DIALOG_HANDLE] = dialogHandle; msg.MessageData[DIALOG_RESULT] = result; ServiceRegistration.Get<IMessageBroker>().Send(CHANNEL, msg); }
public const string CHOOSEN_PATH = "ChoosenPath"; // Type: ResourcePath public static void SendPathChoosenMessage(Guid dialogHandle, ResourcePath choosenPath) { SystemMessage msg = new SystemMessage(MessageType.PathChoosen); msg.MessageData[DIALOG_HANDLE] = dialogHandle; msg.MessageData[CHOOSEN_PATH] = choosenPath; ServiceRegistration.Get<IMessageBroker>().Send(CHANNEL, msg); }
public void Receive(SystemMessage message) { if (message.ChannelName == LocalizationMessaging.CHANNEL) if (((LocalizationMessaging.MessageType) message.MessageType) == LocalizationMessaging.MessageType.LanguageChanged) OnLanguageChanged(); }
void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message) { if (message.ChannelName == PlayerManagerMessaging.CHANNEL) { PlayerManagerMessaging.MessageType messageType = (PlayerManagerMessaging.MessageType) message.MessageType; switch (messageType) { case PlayerManagerMessaging.MessageType.PlayerStarted: case PlayerManagerMessaging.MessageType.PlayerStopped: case PlayerManagerMessaging.MessageType.PlayerEnded: Update(); break; } } else if (message.ChannelName == PlayerContextManagerMessaging.CHANNEL) { PlayerContextManagerMessaging.MessageType messageType = (PlayerContextManagerMessaging.MessageType) message.MessageType; switch (messageType) { case PlayerContextManagerMessaging.MessageType.CurrentPlayerChanged: Update(); break; } } else if (message.ChannelName == WorkflowManagerMessaging.CHANNEL) { WorkflowManagerMessaging.MessageType messageType = (WorkflowManagerMessaging.MessageType) message.MessageType; switch (messageType) { case WorkflowManagerMessaging.MessageType.NavigationComplete: Update(); break; } } }
private void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message) { if (message.ChannelName == PlayerManagerMessaging.CHANNEL) { PlayerManagerMessaging.MessageType messageType = (PlayerManagerMessaging.MessageType) message.MessageType; switch (messageType) { case PlayerManagerMessaging.MessageType.PlayerStarted: case PlayerManagerMessaging.MessageType.PlayerStopped: case PlayerManagerMessaging.MessageType.PlayerEnded: HandlePlayerChange(); break; case PlayerManagerMessaging.MessageType.PlaybackStateChanged: HandlePlaybackStateChanged(); break; } } else if (message.ChannelName == PlayerContextManagerMessaging.CHANNEL) { PlayerContextManagerMessaging.MessageType messageType = (PlayerContextManagerMessaging.MessageType) message.MessageType; switch (messageType) { case PlayerContextManagerMessaging.MessageType.PlayerSlotsChanged: HandlePlayerChange(); break; } } }
public static void SendUpdatePlayerRolesMessage(int currentPlayerIndex, int audioPlayerIndex) { SystemMessage msg = new SystemMessage(MessageType.UpdatePlayerRolesInternal); msg.MessageData[CURRENT_PLAYER_INDEX] = currentPlayerIndex; msg.MessageData[AUDIO_PLAYER_INDEX] = audioPlayerIndex; ServiceRegistration.Get<IMessageBroker>().Send(CHANNEL, msg); }
internal static void SendImportMessage(MessageType messageType, ResourcePath path, ImportJobType importJobType) { SystemMessage msg = new SystemMessage(messageType); msg.MessageData[RESOURCE_PATH] = path; msg.MessageData[IMPORT_JOB_TYPE] = importJobType; ServiceRegistration.Get<IMessageBroker>().Send(CHANNEL, msg); }
private void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message) { if (message.ChannelName == NotificationServiceMessaging.CHANNEL) Update(); else if (message.ChannelName == WorkflowManagerMessaging.CHANNEL) Update(); }
public static void SendTvWishListMessage(TvWishListMessaging.MessageType type, string mymessage) { // Send Startup Finished Message. SystemMessage msg = new SystemMessage(type); msg.MessageData[MESSAGE] = mymessage; ServiceRegistration.Get<IMessageBroker>().Send(CHANNEL, msg); }
public const string NEW_STATE = "NewState"; // Type: SystemState /// <summary> /// Sends a <see cref="MessageType.SystemStateChanged"/> message. /// </summary> /// <param name="newState">The state the system will switch to.</param> public static void SendSystemStateChangeMessage(SystemState newState) { SystemMessage msg = new SystemMessage(MessageType.SystemStateChanged); msg.MessageData[NEW_STATE] = newState; IMessageBroker messageBroker = ServiceRegistration.Get<IMessageBroker>(); if (messageBroker != null) messageBroker.Send(CHANNEL, msg); }
public const string MESSAGE = "Message"; // Windows message stored as System.Windows.Forms.Message - Take care to copy the message back to the message data after modifying it, else the auto unboxing will prevent applying the new values public static void BroadcastWindowsMessage(ref Message message) { SystemMessage msg = new SystemMessage(MessageType.WindowsBroadcast); msg.MessageData[MESSAGE] = message; ServiceRegistration.Get<IMessageBroker>().Send(CHANNEL, msg); // Copy message back to the ref message message = (Message) msg.MessageData[MESSAGE]; }
public const string SETTINGSTYPE = "SettingsType"; // Type: C# Type /// <summary> /// Sends a <see cref="MessageType.SettingsChanged"/> message. /// </summary> /// <param name="settingsType">The Type of setting that was changed.</param> public static void SendSettingsChangeMessage(Type settingsType) { SystemMessage msg = new SystemMessage(MessageType.SettingsChanged); msg.MessageData[SETTINGSTYPE] = settingsType; IMessageBroker messageBroker = ServiceRegistration.Get<IMessageBroker>(false); if (messageBroker != null) messageBroker.Send(CHANNEL, msg); }
void messageQueue_MessageReceived(AsynchronousMessageQueue queue, SystemMessage message) { if (message.ChannelName == ImporterMessaging.Channel) { ImporterMessaging.MessageType messageType = (ImporterMessaging.MessageType)message.MessageType; if (messageType == ImporterMessaging.MessageType.Init) initImporter(); } }
public void Receive(SystemMessage message) { if (message.MessageType as SystemMessaging.MessageType? == SystemMessaging.MessageType.SystemStateChanged) { SystemState newState = (SystemState)message.MessageData[SystemMessaging.NEW_STATE]; if (newState == SystemState.Running) { RegisterWithServices(); } } }
void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message) { if (message.ChannelName == SkinMessaging.CHANNEL) { if (((SkinMessaging.MessageType) message.MessageType) == SkinMessaging.MessageType.DateTimeFormatChanged) // The DateFormat and TimeFormat configuration classes will send this message when they // changed the formats, so we have to update our format here ReadSettings(); } }
protected override void HandleMessageAvailable(SystemMessage message) { MessagesAvailableHandler handler = MessagesAvailable; if (handler == null) { ServiceRegistration.Get<ILogger>().Warn( "SynchronousMessageQueue: Synchronous message queue '{0}' has no message handler and there are already {1} messages to be delivered", _queueName, NumMessages); return; } handler(this); }
void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message) { switch (message.ChannelName) { case PlayerManagerMessaging.CHANNEL: UpdatePlayerContributor(true); break; case PlayerContextManagerMessaging.CHANNEL: UpdatePlayerContributor(true); break; } }
void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message) { if (message.ChannelName == WorkflowManagerMessaging.CHANNEL) { WorkflowManagerMessaging.MessageType messageType = (WorkflowManagerMessaging.MessageType) message.MessageType; switch (messageType) { case WorkflowManagerMessaging.MessageType.NavigationComplete: Update(); break; } } }
protected virtual void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message) { if (message.ChannelName == ServerConnectionMessaging.CHANNEL) { ServerConnectionMessaging.MessageType messageType = (ServerConnectionMessaging.MessageType) message.MessageType; switch (messageType) { case ServerConnectionMessaging.MessageType.HomeServerConnected: case ServerConnectionMessaging.MessageType.HomeServerDisconnected: Update(); break; } } }
void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message) { if (message.ChannelName == RemovableMediaMessaging.CHANNEL) { RemovableMediaMessaging.MessageType messageType = (RemovableMediaMessaging.MessageType) message.MessageType; if (messageType == RemovableMediaMessaging.MessageType.MediaInserted || messageType == RemovableMediaMessaging.MessageType.MediaRemoved) { string drive = (string) message.MessageData[RemovableMediaMessaging.DRIVE_LETTER]; if (drive == null || drive == _drive) FireChanged(); } } }
private void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message) { if (message.ChannelName == ServerConnectionMessaging.CHANNEL) { ServerConnectionMessaging.MessageType type = (ServerConnectionMessaging.MessageType) message.MessageType; switch (type) { case ServerConnectionMessaging.MessageType.HomeServerConnected: case ServerConnectionMessaging.MessageType.HomeServerDisconnected: FireChanged(); break; } } }
protected void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message) { if (message.ChannelName == PlayerManagerMessaging.CHANNEL) { PlayerManagerMessaging.MessageType messageType = (PlayerManagerMessaging.MessageType) message.MessageType; switch (messageType) { case PlayerManagerMessaging.MessageType.PlayerSlotStarted: case PlayerManagerMessaging.MessageType.PlayerSlotClosed: Update(); break; } } }
private static void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message) { if (message.ChannelName == ImporterWorkerMessaging.CHANNEL) { INotificationService notificationService = ServiceRegistration.Get<INotificationService>(); ImporterWorkerMessaging.MessageType messageType = (ImporterWorkerMessaging.MessageType) message.MessageType; ResourcePath resourcePath = (ResourcePath) message.MessageData[ImporterWorkerMessaging.RESOURCE_PATH]; if (messageType == ImporterWorkerMessaging.MessageType.ImportStarted) notificationService.EnqueueNotification(NotificationType.Info, LocalizationHelper.Translate(Consts.RES_IMPORT_STARTED_TITLE), LocalizationHelper.Translate(Consts.RES_IMPORT_STARTED_TEXT, resourcePath), false); else if (messageType == ImporterWorkerMessaging.MessageType.ImportCompleted) notificationService.EnqueueNotification(NotificationType.Info, LocalizationHelper.Translate(Consts.RES_IMPORT_COMPLETED_TITLE), LocalizationHelper.Translate(Consts.RES_IMPORT_COMPLETED_TEXT, resourcePath), false); } }
public void Receive(SystemMessage message) { if (message.ChannelName == SystemMessaging.CHANNEL) { SystemMessaging.MessageType messageType = (SystemMessaging.MessageType) message.MessageType; ISystemStateService sss = ServiceRegistration.Get<ISystemStateService>(); if (messageType == SystemMessaging.MessageType.SystemStateChanged) if (sss.CurrentState == SystemState.ShuttingDown || sss.CurrentState == SystemState.Ending) // It is necessary to block the main thread until our message delivery thread has delivered all pending // messages to avoid asynchronous threads during the shutdown phase. // It's a bit illegal to call the Shutdown() method which acquires a lock in this synchronous message // handler method. But as we know that the SystemStateChanged message is only called by our application // main thread which doesn't hold locks, this won't cause deadlocks. // How ugly, but that's life. _owner.Shutdown(); } }
void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message) { if (message.ChannelName == SystemMessaging.CHANNEL) { SystemMessaging.MessageType messageType = (SystemMessaging.MessageType) message.MessageType; if (messageType == SystemMessaging.MessageType.SystemStateChanged) { SystemState newState = (SystemState) message.MessageData[SystemMessaging.NEW_STATE]; if (newState == SystemState.Running) { _reloadSkinActions.RegisterKeyActions(); _loadSkinThemeActions.RegisterKeyActions(); DropMessageQueue(); } } } }
void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message) { if (message.ChannelName == SystemMessaging.CHANNEL) { SystemMessaging.MessageType messageType = (SystemMessaging.MessageType) message.MessageType; if (messageType == SystemMessaging.MessageType.SystemStateChanged) { SystemState state = (SystemState) message.MessageData[SystemMessaging.NEW_STATE]; switch (state) { case SystemState.ShuttingDown: UnregisterService(); break; } } } }
private void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message) { if (message.ChannelName == NotificationServiceMessaging.CHANNEL) { INotification notification = (INotification) message.MessageData[NotificationServiceMessaging.NOTIFICATION]; NotificationServiceMessaging.MessageType messageType = (NotificationServiceMessaging.MessageType) message.MessageType; if (messageType == NotificationServiceMessaging.MessageType.NotificationDequeued || messageType == NotificationServiceMessaging.MessageType.NotificationRemoved) lock (_syncObj) if (notification == _queuedNotification) _queuedNotification = null; } // Check setting which prevents the listener service to pop up server availability messages ISettingsManager settingsManager = ServiceRegistration.Get<ISettingsManager>(); SkinBaseSettings settings = settingsManager.Load<SkinBaseSettings>(); if (!settings.EnableServerListener) { RemoveNotification(); return; } if (message.ChannelName == ServerConnectionMessaging.CHANNEL) { ServerConnectionMessaging.MessageType messageType = (ServerConnectionMessaging.MessageType) message.MessageType; switch (messageType) { case ServerConnectionMessaging.MessageType.AvailableServersChanged: bool serversWereAdded = (bool) message.MessageData[ServerConnectionMessaging.SERVERS_WERE_ADDED]; if (serversWereAdded) QueueNotification(); else { ICollection<ServerDescriptor> servers = (ICollection<ServerDescriptor>) message.MessageData[ServerConnectionMessaging.AVAILABLE_SERVERS]; if (servers.Count == 0) // No servers available any more RemoveNotification(); } break; case ServerConnectionMessaging.MessageType.HomeServerAttached: // Home server was attached outside the notification handler RemoveNotification(); break; } } }
void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message) { if (message.ChannelName == RemovableMediaMessaging.CHANNEL) { RemovableMediaMessaging.MessageType messageType = (RemovableMediaMessaging.MessageType) message.MessageType; if (messageType == RemovableMediaMessaging.MessageType.MediaInserted) { string drive = (string) message.MessageData[RemovableMediaMessaging.DRIVE_LETTER]; RemovableMediaManagerSettings settings = ServiceRegistration.Get<ISettingsManager>().Load<RemovableMediaManagerSettings>(); if (settings.AutoPlay == AutoPlayType.AutoPlay) { IPlayerContextManager pcm = ServiceRegistration.Get<IPlayerContextManager>(); if (!pcm.IsFullscreenContentWorkflowStateActive) ExamineVolume(drive); } } } }
/// <summary> /// Enqueues the specified <paramref name="message"/> to this queue. This message will be called /// by the <see cref="IMessageBroker"/> service. /// </summary> /// <param name="message">Message to be enqueued in this message queue.</param> public void Receive(SystemMessage message) { lock (_syncObj) _messages.Enqueue(message); HandleMessageAvailable(message); }
protected abstract void HandleMessageAvailable(SystemMessage message);