예제 #1
0
 /// <summary>
 /// Creates the element and retrieves all information from the control
 /// </summary>
 /// <param name="control">GUIControl</param>
 public FadeLabelElement(GUIControl control)
     : base(control)
 {
     _label = control as GUIFadeLabel;
     if (_label != null)
     {
         _font        = getFont(_label.FontName);
         _brush       = new SolidBrush(GetColor(_label.TextColor));
         _labelString = _label.Label;
     }
 }
예제 #2
0
        private string GetSingleLabelFromControl(GUIControl control)
        {
            if (control.GetType() == typeof(GUILabelControl))
            {
                GUILabelControl label = (GUILabelControl)control;
                return(label.Label);
            }
            else if (control.GetType() == typeof(GUIFadeLabel))
            {
                GUIFadeLabel label = (GUIFadeLabel)control;
                return(label.Label);
            }

            return(null);
        }
예제 #3
0
        protected void InitGenreKey()
        {
            // Ensure genre key controls are not rendered visible when they shouldn't be.
            // Force controls to be hidden at initialization; make them visible later if needed.
            GUIImage imgGenreColor = (GUIImage)GetControl((int)Controls.GENRE_COLOR_KEY_PAIR);

            if (imgGenreColor != null)
            {
                imgGenreColor.Visible = false;
            }

            GUIFadeLabel labelGenreName = (GUIFadeLabel)GetControl((int)Controls.GENRE_COLOR_KEY_PAIR + 1);

            if (labelGenreName != null)
            {
                labelGenreName.Visible = false;
            }
        }
예제 #4
0
        public bool GetDialogInfo(GUIWindow.Window dialogWindow, ref string DialogTitle, ref string DialogHighlightedItem)
        {
            GUIListControl control = null;
            bool           focus   = false;

            switch (dialogWindow)
            {
            case GUIWindow.Window.WINDOW_DIALOG_YES_NO:
            case GUIWindow.Window.WINDOW_DIALOG_TVNOTIFYYESNO:
            {
                GUIDialogYesNo window = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)dialogWindow);
                DialogTitle = string.Empty;
                foreach (object obj16 in window.controlList)
                {
                    if (obj16.GetType() == typeof(GUIFadeLabel))
                    {
                        GUIFadeLabel label3 = obj16 as GUIFadeLabel;
                        if (DialogTitle == string.Empty)
                        {
                            if (label3.Label != string.Empty)
                            {
                                DialogTitle = label3.Label;
                            }
                        }
                        else if (label3.Label != string.Empty)
                        {
                            DialogTitle = DialogTitle + " - " + label3.Label;
                        }
                    }
                    if (obj16.GetType() == typeof(GUILabelControl))
                    {
                        GUILabelControl control14 = obj16 as GUILabelControl;
                        if (DialogTitle == string.Empty)
                        {
                            if (control14.Label != string.Empty)
                            {
                                DialogTitle = control14.Label;
                            }
                        }
                        else if (control14.Label != string.Empty)
                        {
                            DialogTitle = DialogTitle + " - " + control14.Label;
                        }
                    }
                    if (obj16.GetType() == typeof(GUIButtonControl))
                    {
                        GUIButtonControl control15 = obj16 as GUIButtonControl;
                        if (!control15.Focus)
                        {
                            continue;
                        }
                        DialogHighlightedItem = control15.Description;
                    }
                }
                return(true);
            }

            case GUIWindow.Window.WINDOW_DIALOG_PROGRESS:
            {
                GUIDialogProgress progress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)dialogWindow);
                foreach (object obj6 in progress.controlList)
                {
                    if (obj6.GetType() == typeof(GUILabelControl))
                    {
                        GUILabelControl control6 = obj6 as GUILabelControl;
                        if (control6.GetID == 1)
                        {
                            DialogTitle = control6.Label;
                        }
                    }
                }
                foreach (object obj7 in progress.controlList)
                {
                    if (obj7.GetType() == typeof(GUIProgressControl))
                    {
                        GUIProgressControl control7 = obj7 as GUIProgressControl;
                        DialogHighlightedItem = "Progress: " + control7.Percentage.ToString() + "%";
                    }
                }
                return(true);
            }

            case GUIWindow.Window.WINDOW_DIALOG_SELECT:
            {
                GUIDialogSelect select = (GUIDialogSelect)GUIWindowManager.GetWindow((int)dialogWindow);
                control = null;
                focus   = false;
                foreach (object obj9 in select.controlList)
                {
                    if (obj9.GetType() == typeof(GUIListControl))
                    {
                        control = obj9 as GUIListControl;
                        focus   = control.Focus;
                    }
                }
                if ((control != null) & focus)
                {
                    string strLabel = string.Empty;
                    string str5     = string.Empty;
                    string strThumb = string.Empty;
                    string strIndex = string.Empty;
                    control.GetSelectedItem(ref strLabel, ref str5, ref strThumb, ref strIndex);
                    DialogHighlightedItem = strLabel;
                }
                else
                {
                    foreach (object obj10 in select.controlList)
                    {
                        if (obj10.GetType() == typeof(GUIButtonControl))
                        {
                            GUIButtonControl control10 = obj10 as GUIButtonControl;
                            if (control10.Focus)
                            {
                                DialogHighlightedItem = control10.Description;
                            }
                        }
                    }
                }
                return(true);
            }

            case GUIWindow.Window.WINDOW_DIALOG_OK:
            {
                GUIDialogOK gok = (GUIDialogOK)GUIWindowManager.GetWindow((int)dialogWindow);
                foreach (object obj5 in gok.controlList)
                {
                    if (obj5.GetType() == typeof(GUIButtonControl))
                    {
                        GUIButtonControl control4 = obj5 as GUIButtonControl;
                        if (control4.Focus)
                        {
                            DialogHighlightedItem = control4.Description;
                            Settings.Instance.LogInfo(
                                "MiniDisplay.GetDialogInfo(): found WINDOW_DIALOG_OK buttoncontrol ID = {0} Label = \"{1}\" Desc = \"{2}\"",
                                control4.GetID, control4.Label, control4.Description);
                        }
                    }
                    if (obj5.GetType() == typeof(GUIFadeLabel))
                    {
                        GUIFadeLabel label = obj5 as GUIFadeLabel;
                        if (DialogTitle == string.Empty)
                        {
                            if (label.Label != string.Empty)
                            {
                                DialogTitle = label.Label;
                            }
                        }
                        else if (label.Label != string.Empty)
                        {
                            DialogTitle = DialogTitle + " - " + label.Label;
                        }
                    }
                    if (obj5.GetType() == typeof(GUILabelControl))
                    {
                        GUILabelControl control5 = obj5 as GUILabelControl;
                        if (DialogTitle == string.Empty)
                        {
                            if (control5.Label != string.Empty)
                            {
                                DialogTitle = control5.Label;
                            }
                            continue;
                        }
                        if (control5.Label != string.Empty)
                        {
                            DialogTitle = DialogTitle + " - " + control5.Label;
                        }
                    }
                }
                return(true);
            }

            case GUIWindow.Window.WINDOW_DIALOG_SELECT2:
            {
                GUIDialogSelect2 select2 = (GUIDialogSelect2)GUIWindowManager.GetWindow((int)dialogWindow);
                control = null;
                focus   = false;
                foreach (object obj11 in select2.controlList)
                {
                    if (obj11.GetType() == typeof(GUIListControl))
                    {
                        control = obj11 as GUIListControl;
                        focus   = control.Focus;
                    }
                }
                if ((control != null) & focus)
                {
                    string str7     = string.Empty;
                    string str8     = string.Empty;
                    string str9     = string.Empty;
                    string strIndex = string.Empty;
                    control.GetSelectedItem(ref str7, ref str8, ref str9, ref strIndex);
                    DialogHighlightedItem = str7;
                }
                else
                {
                    foreach (object obj12 in select2.controlList)
                    {
                        if (obj12.GetType() == typeof(GUIButtonControl))
                        {
                            GUIButtonControl control11 = obj12 as GUIButtonControl;
                            if (control11.Focus)
                            {
                                DialogHighlightedItem = control11.Description;
                            }
                        }
                    }
                }
                return(true);
            }

            case GUIWindow.Window.WINDOW_DIALOG_MENU:
            {
                GUIDialogMenu menu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)dialogWindow);
                foreach (object obj13 in menu.controlList)
                {
                    if (obj13.GetType() == typeof(GUILabelControl))
                    {
                        GUILabelControl control12 = obj13 as GUILabelControl;
                        if (!control12.Label.Trim().ToLowerInvariant().Equals("menu"))
                        {
                            DialogTitle = control12.Label;
                        }
                    }
                }
                control = null;
                focus   = false;
                foreach (object obj14 in menu.controlList)
                {
                    if (obj14.GetType() == typeof(GUIListControl))
                    {
                        control = obj14 as GUIListControl;
                        focus   = control.Focus;
                    }
                }
                if ((control != null) & focus)
                {
                    string str10    = string.Empty;
                    string str11    = string.Empty;
                    string str12    = string.Empty;
                    string strIndex = string.Empty;
                    control.GetSelectedItem(ref str10, ref str11, ref str12, ref strIndex);
                    DialogHighlightedItem = str10;
                }
                else
                {
                    foreach (object obj15 in menu.controlList)
                    {
                        if (obj15.GetType() == typeof(GUIButtonControl))
                        {
                            GUIButtonControl control13 = obj15 as GUIButtonControl;
                            if (control13.Focus)
                            {
                                DialogHighlightedItem = control13.Description;
                            }
                        }
                    }
                }
                return(true);
            }

            case GUIWindow.Window.WINDOW_DIALOG_RATING:
            {
                GUIDialogSetRating rating = (GUIDialogSetRating)GUIWindowManager.GetWindow((int)dialogWindow);
                DialogTitle = string.Empty;
                foreach (object obj8 in rating.controlList)
                {
                    if (obj8.GetType() == typeof(GUIFadeLabel))
                    {
                        GUIFadeLabel label2 = obj8 as GUIFadeLabel;
                        if (DialogTitle == string.Empty)
                        {
                            if (label2.Label != string.Empty)
                            {
                                DialogTitle = label2.Label;
                            }
                        }
                        else if (label2.Label != string.Empty)
                        {
                            DialogTitle = DialogTitle + " - " + label2.Label;
                        }
                    }
                    if (obj8.GetType() == typeof(GUILabelControl))
                    {
                        GUILabelControl control8 = obj8 as GUILabelControl;
                        if (DialogTitle == string.Empty)
                        {
                            if (control8.Label != string.Empty)
                            {
                                DialogTitle = control8.Label;
                            }
                        }
                        else if (control8.Label != string.Empty)
                        {
                            DialogTitle = DialogTitle + " - " + control8.Label;
                        }
                    }
                    if (obj8.GetType() == typeof(GUIButtonControl))
                    {
                        GUIButtonControl control9 = obj8 as GUIButtonControl;
                        if (!control9.Focus)
                        {
                            continue;
                        }
                        DialogHighlightedItem = control9.Description;
                    }
                }
                return(true);
            }

            case GUIWindow.Window.WINDOW_DIALOG_MENU_BOTTOM_RIGHT:
            {
                GUIDialogMenuBottomRight right = (GUIDialogMenuBottomRight)GUIWindowManager.GetWindow((int)dialogWindow);
                DialogTitle = string.Empty;
                foreach (object obj2 in right.controlList)
                {
                    if (obj2.GetType() == typeof(GUILabelControl))
                    {
                        GUILabelControl control2 = obj2 as GUILabelControl;
                        if (!control2.Label.Trim().ToLowerInvariant().Equals("menu") && (control2.Label != string.Empty))
                        {
                            if (DialogTitle == string.Empty)
                            {
                                DialogTitle = control2.Label;
                            }
                            else
                            {
                                DialogTitle = DialogTitle + " - " + control2.Label;
                            }
                        }
                    }
                }
                control = null;
                focus   = false;
                foreach (object obj3 in right.controlList)
                {
                    if (obj3.GetType() == typeof(GUIListControl))
                    {
                        control = obj3 as GUIListControl;
                        focus   = control.Focus;
                    }
                }
                if ((control != null) & focus)
                {
                    string str      = string.Empty;
                    string str2     = string.Empty;
                    string str3     = string.Empty;
                    string strIndex = string.Empty;
                    control.GetSelectedItem(ref str, ref str2, ref str3, ref strIndex);
                    DialogHighlightedItem = str;
                }
                else
                {
                    foreach (object obj4 in right.controlList)
                    {
                        if (obj4.GetType() == typeof(GUIButtonControl))
                        {
                            GUIButtonControl control3 = obj4 as GUIButtonControl;
                            if (control3.Focus)
                            {
                                DialogHighlightedItem = control3.Description;
                            }
                        }
                    }
                }
                return(true);
            }
            }
            return(false);
        }
예제 #5
0
        protected void RenderGenreKey()
        {
            GUIImage     imgGenreColor  = (GUIImage)GetControl((int)Controls.GENRE_COLOR_KEY_PAIR);
            GUIFadeLabel labelGenreName = (GUIFadeLabel)GetControl((int)Controls.GENRE_COLOR_KEY_PAIR + 1);

            MpGenre genreObj = _mpGenres.Find(x => x.Enabled == true);

            // Do not render the key if the template controls are not present or there are no enabled mp genres.
            if (imgGenreColor == null || labelGenreName == null || genreObj == null)
            {
                return;
            }

            // Display the genre key.
            var genreKeys = _genreColorsOnLater.Keys.ToList();

            genreKeys.Sort();
            int xpos, i = 0;
            int xoffset = 0;

            foreach (var genreName in genreKeys)
            {
                // If the genre is not enabled then skip it.  This can occur if the user desires to have less than the maximum number of MP genres available.
                genreObj = ((List <MpGenre>)_mpGenres).Find(x => x.Name.Equals(genreName));
                if (!genreObj.Enabled)
                {
                    continue;
                }

                xpos = imgGenreColor.XPosition + xoffset;

                GUIImage img = GetControl((int)Controls.GENRE_COLOR_KEY_PAIR + (2 * i)) as GUIImage;
                if (img == null)
                {
                    img = new GUIImage(GetID, (int)Controls.GENRE_COLOR_KEY_PAIR + (2 * i), xpos, imgGenreColor.YPosition, imgGenreColor.Width,
                                       imgGenreColor.Height, imgGenreColor.FileName, 0x0);
                    img.AllocResources();
                    GUIControl cntl = (GUIControl)img;
                    Add(ref cntl);
                }
                img.IsVisible       = true;
                img.ColourDiffuse   = _genreColorsOnLater[genreName];
                img.OverlayFileName = imgGenreColor.OverlayFileName;
                img.SetPosition(xpos, imgGenreColor.YPosition);
                img.DoUpdate();

                GUIFadeLabel label = GetControl(((int)Controls.GENRE_COLOR_KEY_PAIR + 1) + (2 * i)) as GUIFadeLabel;
                if (label == null)
                {
                    label = new GUIFadeLabel(GetID, ((int)Controls.GENRE_COLOR_KEY_PAIR + 1) + (2 * i), 0, 0, labelGenreName.Width,
                                             labelGenreName.Height, labelGenreName.FontName,
                                             labelGenreName.TextColor, labelGenreName.TextAlignment, labelGenreName.TextVAlignment,
                                             labelGenreName.ShadowAngle, labelGenreName.ShadowDistance, labelGenreName.ShadowColor,
                                             string.Empty);

                    label.AllocResources();
                    GUIControl cntl = (GUIControl)label;
                    this.Add(ref cntl);
                }
                label.Label = genreName;
                label.SetPosition(xpos + imgGenreColor.Width + 10, labelGenreName.YPosition);
                label.ScrollStartDelay = labelGenreName.ScrollStartDelay;
                label.IsVisible        = true;

                // Compute position of the next key.
                int w = label.Width;
                if (label.TextWidth < label.Width)
                {
                    w = label.TextWidth;
                }

                xoffset += (int)(imgGenreColor.Width * 2.3 + w);
                i++;
            }
        }