Exemple #1
0
 public void SetActiveWindow(GUIWindow.Window _window)
 {
     if (base.InvokeRequired)
     {
         base.Invoke(new SetActiveWindowDelegate(this.SetActiveWindow), new object[] { _window });
     }
     this.txtActiveWindow.Text = _window.ToString();
 }
Exemple #2
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);
            }
        }