Ejemplo n.º 1
0
 /// <summary>
 /// Creates the element and retrieves all information from the control
 /// </summary>
 /// <param name="control">GUIControl</param>
 public ToggleButtonElement(GUIControl control)
     : base(control)
 {
     _button = control as GUIToggleButtonControl;
       if (_button != null)
       {
     _font = getFont(_button.FontName);
     _focusBitmap = loadBitmap(_button.TexutureFocusName);
     _noFocusBitmap = loadBitmap(_button.TexutureNoFocusName);
     _altFocusBitmap = loadBitmap(_button.AltTexutureFocusName);
     _altNoFocusBitmap = loadBitmap(_button.AltTexutureNoFocusName);
     _textColor = GetColor(_button.TextColor);
     _disabledColor = GetColor(_button.DisabledColor);
     _focus = _button.Focus;
     _selected = _button.Selected;
     _label = _button.Label;
       }
 }
Ejemplo n.º 2
0
        private void UpdateRating()
        {
            GUIToggleButtonControl[] btnStars;
            if (DisplayStars == StarDisplay.FIVE_STARS) {
                btnStars = new GUIToggleButtonControl[5] { btnStar1, btnStar2, btnStar3, btnStar4, btnStar5 };
            } else {
                btnStars = new GUIToggleButtonControl[10] { btnStar1, btnStar2, btnStar3, btnStar4, btnStar5,
                                                            btnStar6, btnStar7, btnStar8, btnStar9, btnStar10 };
            }

            for (int i = 0; i < (int)DisplayStars; i++) {
                btnStars[i].Selected = (Rating >= i + 1);
            }
            btnStars[Rating - 1].Focus = true;

            // Display Rating Description
            if (lblRating != null) {
                lblRating.Label = string.Format("({0}) {1} / {2}", GetRatingDescription(), Rating.ToString(), (int)DisplayStars);
            }
        }
Ejemplo n.º 3
0
        private void UpdateRating()
        {
            if (btnUnRate != null)
            {
                btnUnRate.Selected = (Rated == TraktRateValue.unrate);
                btnUnRate.Focus = (Rated == TraktRateValue.unrate);
            }

            // Update button states
            if (!ShowAdvancedRatings)
            {
                btnLove.Selected = (Rated == TraktRateValue.ten);
                btnHate.Selected = (Rated == TraktRateValue.one);

                btnLove.Focus = (Rated == TraktRateValue.ten);
                btnHate.Focus = (Rated == TraktRateValue.one);
            }
            else
            {
                GUIToggleButtonControl[] btnHearts = new GUIToggleButtonControl[10] { btnOneHeart, btnTwoHeart, btnThreeHeart, btnFourHeart, btnFiveHeart,
                                                                                      btnSixHeart, btnSevenHeart, btnEightHeart, btnNineHeart, btnTenHeart };

                for (int i = 0; i < 10; i++)
                {
                    btnHearts[i].Selected = ((int)Rated > i);
                }
                if ((int)Rated >= 1)
                    btnHearts[(int)Rated - 1].Focus = true;
            }

            // Update Rating Description
            if (lblRating != null && !ShowAdvancedRatings)
            {
                lblRating.Label = GetRatingDescription();
            }
            else if (lblRatingAdvanced != null && ShowAdvancedRatings)
            {
                lblRatingAdvanced.Label = Rated == TraktRateValue.unrate ? GetRatingDescription() : string.Format("({0}) {1} / 10", GetRatingDescription(), (int)Rated);
            }
        }