示例#1
0
        private void StatusThreadMain()
        {
            while (!stopRequested)
            {
                try
                {
                    //lock (MiniDisplayHelper.StatusMutex)
                    {
                        if (MiniDisplayHelper.IsCaptureCardRecording())
                        {
                            MiniDisplayHelper.MPStatus.Media_IsRecording = true;
                        }
                        else
                        {
                            MiniDisplayHelper.MPStatus.Media_IsRecording = false;
                        }

                        if (MiniDisplayHelper.IsCaptureCardViewing())
                        {
                            MiniDisplayHelper.MPStatus.Media_IsTV = true;
                        }
                        else
                        {
                            MiniDisplayHelper.MPStatus.Media_IsTV = false;
                        }
                    }
                }
                catch (Exception exception)
                {
                    Log.Debug("MiniDisplay.StatusThreadMain(): CAUGHT EXCEPTION - {0}", exception);
                }

                Thread.Sleep(2000); //No need to update too often
            }
        }
示例#2
0
 public void Start()
 {
     Log.Info("MiniDisplay.Start(): called");
     Log.Info("MiniDisplay.Start(): {0}", MiniDisplayHelper.Plugin_Version);
     Log.Info("MiniDisplay.Start(): plugin starting...");
     if (!File.Exists(Config.GetFile(Config.Dir.Config, "MiniDisplay.xml")))
     {
         Log.Info("MiniDisplay.Start(): plugin not configured... Unable to start");
     }
     else
     {
         MiniDisplayHelper.MPStatus = new SystemStatus();
         MiniDisplayHelper.InitSystemStatus(ref MiniDisplayHelper.MPStatus);
         this.GetTVSource();
         if (Settings.Instance.ShowPropertyBrowser)
         {
             lock (MiniDisplayHelper.PropertyBrowserMutex)
             {
                 Log.Info("MiniDisplay.Start(): opening PropertyBrowser.");
                 this.browser              = new PropertyBrowser();
                 this.browser.FormClosing += new FormClosingEventHandler(this.browser_Closing);
                 this.browser.Show();
                 MiniDisplayHelper._PropertyBrowserAvailable = true;
             }
         }
         this.DoStart();
         Log.Info("MiniDisplay.Start(): completed");
     }
 }
示例#3
0
        protected override void Dispose(bool disposing)
        {
            Log.Info("PropertyBrowser.Dispose(): called.");
            lock (MiniDisplayHelper.PropertyBrowserMutex)
            {
                MiniDisplayHelper.DisablePropertyBrowser();
            }
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }

            GUIPropertyManager.OnPropertyChanged -=
                new GUIPropertyManager.OnPropertyChangedHandler(this.GUIPropertyManager_OnPropertyChanged);

            base.Dispose(disposing);
        }
示例#4
0
        //Perform work on render thread
        private void DoWork()
        {
            try
            {
                Settings.Instance.LogDebug("MiniDisplay Processing status.");

                GUIWindow.Window activeWindow = (GUIWindow.Window)GUIWindowManager.ActiveWindow;

                Settings.Instance.LogDebug("Active window is {0}", activeWindow.ToString());

                this.status = Status.Idle;
                if (g_Player.Player != null)
                {
                    Settings.Instance.LogDebug("Active player detected");

                    GUIPropertyManager.SetProperty("#paused", g_Player.Paused ? "true" : string.Empty);
                    if (g_Player.IsDVD)
                    {
                        this.status = Status.PlayingDVD;
                    }
                    else if (g_Player.IsRadio)
                    {
                        this.status = Status.PlayingRadio;
                    }
                    else if (g_Player.IsMusic)
                    {
                        this.status = Status.PlayingMusic;
                    }
                    else if (g_Player.IsTimeShifting)
                    {
                        this.status = Status.Timeshifting;
                    }
                    else if (g_Player.IsTVRecording)
                    {
                        this.status = Status.PlayingRecording;
                    }
                    else if (g_Player.IsTV)
                    {
                        this.status = Status.PlayingTV;
                    }
                    else if (g_Player.IsVideo)
                    {
                        this.status = Status.PlayingVideo;
                    }
                }
                else
                {
                    GUIPropertyManager.SetProperty("#paused", string.Empty);
                    if (this.IsTVWindow((int)activeWindow))
                    {
                        this.status = Status.PlayingTV;
                    }
                }
                bool userIsIdle = true;
                if ((DateTime.Now - this.lastAction) < new TimeSpan(0, 0, Settings.Instance.IdleTimeout))
                {
                    this.status = Status.Action;
                    userIsIdle  = false;
                }
                if (GUIWindowManager.IsRouted)
                {
                    string           dialogTitle           = string.Empty;
                    string           dialogHighlightedItem = string.Empty;
                    GUIWindow.Window activeWindowEx        = (GUIWindow.Window)GUIWindowManager.ActiveWindowEx;
                    if (this.GetDialogInfo(activeWindowEx, ref dialogTitle, ref dialogHighlightedItem))
                    {
                        this.status = Status.Dialog;
                        GUIPropertyManager.GetProperty("#currentmodule");
                        GUIPropertyManager.SetProperty("#DialogLabel", dialogTitle);
                        GUIPropertyManager.SetProperty("#DialogItem", dialogHighlightedItem);

                        Settings.Instance.LogDebug("DIALOG window is {0}: \"{1}\", \"{2}\"", activeWindowEx.ToString(), dialogTitle, dialogHighlightedItem);
                    }
                }

                Settings.Instance.LogDebug("Detected status is {0}", status.ToString());

                lock (MiniDisplayHelper.StatusMutex)
                {
                    MiniDisplayHelper.MPStatus.UserIsIdle          = userIsIdle;
                    MiniDisplayHelper.MPStatus.CurrentPluginStatus = this.status;
                    if (this.status.Equals(Status.Idle) && !MiniDisplayHelper.MPStatus.MP_Is_Idle)
                    {
                        //Set our idle status to true and mark the time
                        MiniDisplayHelper.MPStatus.MP_Is_Idle           = true;
                        MiniDisplayHelper.MPStatus.TimeIdleStateChanged = DateTime.Now;
                    }
                    else if (!this.status.Equals(Status.Idle) && MiniDisplayHelper.MPStatus.MP_Is_Idle)
                    {
                        //Set our idle status to false and mark the time
                        MiniDisplayHelper.MPStatus.MP_Is_Idle           = false;
                        MiniDisplayHelper.MPStatus.TimeIdleStateChanged = DateTime.Now;
                    }

                    MiniDisplayHelper.MPStatus.CurrentIconMask = MiniDisplayHelper.SetPluginIcons();
                    if (this.status.Equals(Status.PlayingDVD))
                    {
                        MiniDisplayHelper.MPStatus.Media_IsDVD = true;
                    }
                    if (this.status.Equals(Status.PlayingRadio))
                    {
                        MiniDisplayHelper.MPStatus.Media_IsRadio = true;
                    }
                    if (this.status.Equals(Status.PlayingMusic))
                    {
                        MiniDisplayHelper.MPStatus.Media_IsMusic = true;
                    }
                    if (this.status.Equals(Status.PlayingRecording))
                    {
                        MiniDisplayHelper.MPStatus.Media_IsTVRecording = true;
                    }
                    if (this.status.Equals(Status.PlayingTV))
                    {
                        MiniDisplayHelper.MPStatus.Media_IsTV = true;
                    }
                    if (this.status.Equals(Status.Timeshifting))
                    {
                        MiniDisplayHelper.MPStatus.Media_IsTVRecording = true;
                    }
                    if (this.status.Equals(Status.PlayingVideo))
                    {
                        MiniDisplayHelper.MPStatus.Media_IsVideo = true;
                    }
                    MiniDisplayHelper.ShowSystemStatus(ref MiniDisplayHelper.MPStatus);
                }
                lock (MiniDisplayHelper.PropertyBrowserMutex)
                {
                    if (((this.browser != null) && !this.browser.IsDisposed) && MiniDisplayHelper._PropertyBrowserAvailable)
                    {
                        Settings.Instance.LogInfo("MiniDisplayPlugin.DoWork(): Updating PropertyBrowser.");
                        this.browser.SetStatus(this.status);
                        this.browser.SetActiveWindow(activeWindow);
                    }
                }

                foreach (Message message in Settings.Instance.Messages)
                {
                    if (((message.Status == Status.Any) || (message.Status == this.status)) &&
                        ((message.Windows.Count == 0) || message.Windows.Contains((int)activeWindow)))
                    {
                        if (!message.Process(this.handler))
                        {
                        }
                        return;
                    }
                }
            }
            catch (Exception exception)
            {
                Log.Error(exception);
            }
        }