Beispiel #1
0
 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];
             var    type  = ExamineVolume(drive);
             if (_removableMediaItems.TryGetValue(drive, out var items))
             {
                 PlayItemsModel.AddOrUpdateRemovableMediaItems(items);
             }
             RemovableMediaManagerSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <RemovableMediaManagerSettings>();
             if (settings.AutoPlay == AutoPlayType.AutoPlay)
             {
                 IPlayerContextManager pcm = ServiceRegistration.Get <IPlayerContextManager>();
                 if (!pcm.IsFullscreenContentWorkflowStateActive)
                 {
                     CheckAutoPlay(drive, type);
                 }
             }
         }
         else if (messageType == RemovableMediaMessaging.MessageType.MediaRemoved)
         {
             string drive = (string)message.MessageData[RemovableMediaMessaging.DRIVE_LETTER];
             IEnumerable <MediaItem> items;
             if (_removableMediaItems.TryRemove(drive, out items))
             {
                 PlayItemsModel.RemoveRemovableMediaItems(items);
             }
             if (_removableMediaItems.TryRemove(drive + @"\", out items))
             {
                 PlayItemsModel.RemoveRemovableMediaItems(items);
             }
         }
     }
     else if (message.ChannelName == ServerConnectionMessaging.CHANNEL)
     {
         ServerConnectionMessaging.MessageType messageType = (ServerConnectionMessaging.MessageType)message.MessageType;
         if (messageType == ServerConnectionMessaging.MessageType.HomeServerConnected && _runStartupCheck)
         {
             _runStartupCheck = false;
             StartupCheck();
         }
     }
 }
 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);
                 }
             }
         }
     }
 }