public static ShutdownWatcher Create(AsynchronousMessageQueue owner)
 {
   IMessageBroker broker = ServiceRegistration.Get<IMessageBroker>();
   ShutdownWatcher result = new ShutdownWatcher(owner);
   broker.RegisterMessageReceiver(SystemMessaging.CHANNEL, result);
   return result;
 }
 void UnsubscribeFromMessages()
 {
   if (_messageQueue == null)
     return;
   _messageQueue.Shutdown();
   _messageQueue = null;
 }
 void DisposeMessageQueue()
 {
   if (_messageQueue == null)
     return;
   _messageQueue.Shutdown();
   _messageQueue = null;
 }
 internal void DoUninstall()
 {
   if (_messageQueue == null)
     return;
   _messageQueue.Shutdown();
   _messageQueue = null;
 }
 public MessageWatcher(object owner, string messageChannel, MessageHandlerDlgt handler, bool autoDispose)
 {
   _handler = handler;
   _autoDispose = autoDispose;
   _messageQueue = new AsynchronousMessageQueue(owner, new string[] {messageChannel});
   _messageQueue.MessageReceived += OnMessageReceived;
 }
 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;
     }
   }
 }
 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;
     }
   }
 }
Exemple #8
0
 public void Activated(PluginRuntime pluginRuntime)
 {
   messageQueue = new AsynchronousMessageQueue(this,
     new string[] {SystemMessaging.CHANNEL, PlayerManagerMessaging.CHANNEL});
   messageQueue.MessageReceived += OnMessageReceived;
   messageQueue.Start();
 }
        public void Activated(PluginRuntime pluginRuntime)
        {
            if (_isInitialized)
                return;

            _isInitialized = true;


            // All non-default media item aspects must be registered
            var miatr = ServiceRegistration.Get<IMediaItemAspectTypeRegistration>();
            miatr.RegisterLocallyKnownMediaItemAspectType(OnlineVideosAspect.Metadata);

            InitializeOnlineVideoSettings();

            // create a message queue for OnlineVideos to broadcast that the list of site utils was rebuild
            _messageQueue = new AsynchronousMessageQueue(this, new string[] { OnlineVideosMessaging.CHANNEL });
            _messageQueue.Start();

            // load and update sites in a background thread, it takes time and we are on the Main thread delaying MP2 startup
            ServiceRegistration.Get<IThreadPool>().Add(
                InitialSitesUpdateAndLoad,
                "OnlineVideos Initial Sites Load & Update",
                QueuePriority.Low,
                ThreadPriority.BelowNormal,
                AfterInitialLoad);
        }
 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;
     }
   }
 }
 private void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message)
 {
   if (message.ChannelName == NotificationServiceMessaging.CHANNEL)
     Update();
   else if (message.ChannelName == WorkflowManagerMessaging.CHANNEL)
     Update();
 }
        public ImporterModel()
        {
            _statusProperty = new WProperty(typeof(string), null);
            _progressProperty = new WProperty(typeof(int), 0);

            messageQueue = new AsynchronousMessageQueue(this, new[] { ImporterMessaging.Channel });
            messageQueue.MessageReceived += messageQueue_MessageReceived;
        }
 public void Dispose()
 {
   if (_messageQueue != null)
   {
     _messageQueue.Terminate();
     _messageQueue = null;
   }
 }
 protected void DropMessageQueue()
 {
   lock (_syncObj)
   {
     if (_messageQueue != null)
       _messageQueue.Terminate();
     _messageQueue = null;
   }
 }
 void SubscribeToMessages()
 {
   _messageQueue = new AsynchronousMessageQueue(this, new string[]
     {
        PlayerManagerMessaging.CHANNEL
     });
   _messageQueue.MessageReceived += OnMessageReceived;
   _messageQueue.Start();
 }
 public CommonNotificationService()
 {
   _messageQueue = new AsynchronousMessageQueue(this, new string[]
       {
         ImporterWorkerMessaging.CHANNEL,
       });
   _messageQueue.MessageReceived += OnMessageReceived;
   _messageQueue.Start();
 }
 void SubscribeToMessages()
 {
   if (_messageQueue == null)
   {
     _messageQueue = new AsynchronousMessageQueue(this, new[] { SystemMessaging.CHANNEL, ServerConnectionMessaging.CHANNEL });
     _messageQueue.PreviewMessage += OnMessageReceived;
     _messageQueue.Start();
   }
 }
 protected BaseVideoPlayerSynchronizationStrategy()
 {
   _messageQueue = new AsynchronousMessageQueue(this, new string[]
     {
         PlayerManagerMessaging.CHANNEL,
         PlayerContextManagerMessaging.CHANNEL,
     });
   _messageQueue.MessageReceived += OnMessageReceived;
 }
 public void Install()
 {
   _messageQueue = new AsynchronousMessageQueue(this, new string[]
     {
         ServerConnectionMessaging.CHANNEL
     });
   _messageQueue.MessageReceived += OnMessageReceived;
   _messageQueue.Start();
 }
 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();
     }
 }
 void SubscribeToMessages()
 {
   _messageQueue = new AsynchronousMessageQueue(this, new string[]
     {
         ServerConnectionMessaging.CHANNEL
     });
   _messageQueue.MessageReceived += OnMessageReceived;
   _messageQueue.Start();
 }
 private void SubscribeToMessages()
 {
   _messageQueue = new AsynchronousMessageQueue(this, new string[]
     {
         ContentDirectoryMessaging.CHANNEL
     });
   _messageQueue.MessageReceived += OnMessageReceived;
   _messageQueue.Start();
 }
 void SubscribeToMessages()
 {
   _messageQueue = new AsynchronousMessageQueue(this, new string[]
     {
         RemovableMediaMessaging.CHANNEL
     });
   _messageQueue.MessageReceived += OnMessageReceived;
   _messageQueue.Start();
 }
 public OnlineVideosWorkflowModel()
 {
     SiteGroupsList = new ItemsList();
     SitesList = new ItemsList();
     
     // create a message queue where we listen to changes to the sites
     _messageQueue = new AsynchronousMessageQueue(this, new string[] { OnlineVideosMessaging.CHANNEL });
     _messageQueue.MessageReceived += new MessageReceivedHandler(OnlineVideosMessageReceived);
     _messageQueue.Start();
 }
 private void InitializeMessageQueue()
 {
   _messageQueue = new AsynchronousMessageQueue(this, new string[]
     {
         PlaylistMessaging.CHANNEL,
         PlayerManagerMessaging.CHANNEL,
         PlayerContextManagerMessaging.CHANNEL,
     });
   _messageQueue.MessageReceived += OnMessageReceived;
 }
Exemple #26
0
 public TaskScheduler()
 {
   _settings = ServiceRegistration.Get<ISettingsManager>().Load<TaskSchedulerSettings>();
   SaveChanges(false);
   _wakeUpTimer = new TaskWaitableTimer();
   _wakeUpTimer.OnTimerExpired += OnResume;
   _messageQueue = new AsynchronousMessageQueue(this, new[] { SystemMessaging.CHANNEL });
   _messageQueue.MessageReceived += OnMessageReceived;
   // Message queue will be started in Startup()
 }
 public ConnectionListenerService()
 {
   _messageQueue = new AsynchronousMessageQueue(this, new string[]
       {
         ServerConnectionMessaging.CHANNEL,
         NotificationServiceMessaging.CHANNEL,
       });
   _messageQueue.MessageReceived += OnMessageReceived;
   _messageQueue.Start();
 }
Exemple #28
0
 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();
   }
 }
 public NotificationsModel()
 {
   _messageQueue = new AsynchronousMessageQueue(this, new string[]
     {
         NotificationServiceMessaging.CHANNEL,
         WorkflowManagerMessaging.CHANNEL,
     });
   _messageQueue.MessageReceived += OnMessageReceived;
   _messageQueue.Start();
   Update();
 }
 private void SubscribeToMessages()
 {
   _messageQueue = new AsynchronousMessageQueue(this, new string[]
     {
         PlayerManagerMessaging.CHANNEL,
         PlayerContextManagerMessaging.CHANNEL,
         WorkflowManagerMessaging.CHANNEL,
     });
   _messageQueue.MessageReceived += OnMessageReceived;
   _messageQueue.Start();
 }
 protected ShutdownWatcher(AsynchronousMessageQueue owner)
 {
     _owner = owner;
 }