Esempio n. 1
0
        private void Run()
        {
            Log.Info("MCEDisplay: plugin thread starting...");
Label_0010:
            try
            {
                Thread.Sleep(50);
                this.mediaSession.Process();
                if (this.playSwitched)
                {
                    Thread.Sleep(100);
                    MiniDisplayHelper.GetSystemStatus(ref this.MPStatus);
                    if (this.mediaSession != null)
                    {
                        this.mediaSession.Dispose();
                    }
                    if (this.MPStatus.Media_IsMusic)
                    {
                        this.mediaSession = new MusicSession();
                    }
                    else if (this.MPStatus.Media_IsVideo)
                    {
                        this.mediaSession = new VideoSession();
                    }
                    else if (this.MPStatus.Media_IsRadio)
                    {
                        this.mediaSession = new RadioSession();
                    }
                    else if (this.MPStatus.Media_IsTVRecording)
                    {
                        this.mediaSession = new RecordedTVSession();
                    }
                    else if (this.MPStatus.Media_IsTV)
                    {
                        this.mediaSession = new TVSession();
                    }
                    else
                    {
                        this.mediaSession = new HomeSession();
                    }
                    this.playSwitched = false;
                }
                if (this.mediaSession != null)
                {
                    this.mediaSession.Process();
                }
            }
            catch (Exception exception)
            {
                if (exception.Message.Contains("Thread was being aborted"))
                {
                    if (this.mediaSession != null)
                    {
                        this.mediaSession.Dispose();
                    }
                    Log.Info("MCEDisplay: caught thread stop request... plugin thread stopping...");
                    return;
                }
                Log.Info("MCEDisplay: Caught the following exception: {0}\n{1}",
                         new object[] { exception.Message, exception.StackTrace });
            }
            lock (ThreadMutex)
            {
                if (!stopRequested)
                {
                    goto Label_0010;
                }
                Log.Debug("MCEDisplay.Run(): MCEDisplay Thread terminating");
                if (this.mediaSession != null)
                {
                    this.mediaSession.Dispose();
                    this.mediaSession = null;
                }
                stopRequested = false;
            }
        }
Esempio n. 2
0
 private void Run()
 {
   Log.Info("MCEDisplay: plugin thread starting...");
   Label_0010:
   try
   {
     Thread.Sleep(50);
     this.mediaSession.Process();
     if (this.playSwitched)
     {
       Thread.Sleep(100);
       MiniDisplayHelper.GetSystemStatus(ref this.MPStatus);
       if (this.mediaSession != null)
       {
         this.mediaSession.Dispose();
       }
       if (this.MPStatus.Media_IsMusic)
       {
         this.mediaSession = new MusicSession();
       }
       else if (this.MPStatus.Media_IsVideo)
       {
         this.mediaSession = new VideoSession();
       }
       else if (this.MPStatus.Media_IsRadio)
       {
         this.mediaSession = new RadioSession();
       }
       else if (this.MPStatus.Media_IsTVRecording)
       {
         this.mediaSession = new RecordedTVSession();
       }
       else if (this.MPStatus.Media_IsTV)
       {
         this.mediaSession = new TVSession();
       }
       else
       {
         this.mediaSession = new HomeSession();
       }
       this.playSwitched = false;
     }
     if (this.mediaSession != null)
     {
       this.mediaSession.Process();
     }
   }
   catch (Exception exception)
   {
     if (exception.Message.Contains("Thread was being aborted"))
     {
       if (this.mediaSession != null)
       {
         this.mediaSession.Dispose();
       }
       Log.Info("MCEDisplay: caught thread stop request... plugin thread stopping...");
       return;
     }
     Log.Info("MCEDisplay: Caught the following exception: {0}\n{1}",
              new object[] {exception.Message, exception.StackTrace});
   }
   lock (ThreadMutex)
   {
     if (!stopRequested)
     {
       goto Label_0010;
     }
     Log.Debug("MCEDisplay.Run(): MCEDisplay Thread terminating");
     if (this.mediaSession != null)
     {
       this.mediaSession.Dispose();
       this.mediaSession = null;
     }
     stopRequested = false;
   }
 }