Пример #1
0
        /// <summary>
        /// Checks, if an update for the element is needed
        /// </summary>
        /// <returns>true, if an update is needed</returns>
        public bool CheckForUpdate()
        {
            Control.UpdateVisibility();
            try
            {
                Control.DoRender(GUIGraphicsContext.TimePassed, (uint)System.Windows.Media.Animation.AnimationTimer.TickCount);
            }
            catch (Exception)
            {
                Log.Debug("Error in DoRender");
            }
            int  visibleCondition = Control.GetVisibleCondition();
            bool newVisible       = visibleCondition == 0 ? Control.Visible : GUIInfoManager.GetBool(visibleCondition, Control.ParentID);

            if (newVisible == _wasVisible)
            {
                if (newVisible)
                {
                    return(CheckElementSpecificForUpdate());
                }
                return(false);
            }
            _wasVisible = newVisible;
            if (true)
            {
                CheckElementSpecificForUpdate();
            }
            return(true);
        }
Пример #2
0
        public static object SkinToggleSetting(string setting)
        {
            // Toggle the boolean setting to the opposite value.
            int  condition = GUIInfoManager.TranslateSingleString("skin.togglesetting(" + setting + ")");
            bool newValue  = !GUIInfoManager.GetBool(condition, 0);

            GUIInfoManager.SetBool(condition, newValue, 0);
            return(newValue);
        }
Пример #3
0
        public static bool PluginIsEnabled(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(false);
            }
            int condition = GUIInfoManager.TranslateString("plugin.isenabled(" + name + ")");

            return(GUIInfoManager.GetBool(condition, 0));
        }
Пример #4
0
        public static string StartsStringV(string text, string part)
        {
            if ((text == null) || (part == null))
            {
                return("false");
            }
            int condition = GUIInfoManager.TranslateSingleString("string.valuestarts(" + text + "," + part + ")");

            return(GUIInfoManager.GetBool(condition, 0) ? "true" : "false");
        }
Пример #5
0
        public static bool IdleTime(string text)
        {
            if ((text == null))
            {
                return(false);
            }
            int condition = GUIInfoManager.TranslateSingleString("system.idletime(" + text + ")");

            return(GUIInfoManager.GetBool(condition, 0));
        }
Пример #6
0
        public static bool ControlIsVisible(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(false);
            }
            int condition = GUIInfoManager.TranslateString("control.isvisible(" + id + ")");

            return(GUIInfoManager.GetBool(condition, 0));
        }
Пример #7
0
        public static bool IdleTime(int value)
        {
            if (value < 0)
            {
                return(false);
            }
            int condition = GUIInfoManager.TranslateSingleString("system.idletime(" + value.ToString() + ")");

            return(GUIInfoManager.GetBool(condition, 0));
        }
Пример #8
0
        public static bool WindowIsVisible(string id)
        {
            if ((id == null))
            {
                return(false);
            }
            int condition = GUIInfoManager.TranslateSingleString("window.isvisible(" + id + ")");

            return(GUIInfoManager.GetBool(condition, 0));
        }
Пример #9
0
 public void SetInitialCondition()
 {
     _lastCondition = GUIInfoManager.GetBool(_condition, 0);
     if (_lastCondition)
     {
         ApplyAnimation();
     }
     else
     {
         ResetAnimation();
     }
 }
Пример #10
0
        public void UpdateCondition()
        {
            bool condition = GUIInfoManager.GetBool(_condition, 0);

            if (condition && !_lastCondition)
            {
                ApplyAnimation();
                _queuedProcess = AnimationProcess.Normal;
            }
            else if (!condition && _lastCondition)
            {
                if (_isReversible)
                {
                    ApplyAnimation();
                    _queuedProcess = AnimationProcess.Reverse;
                }
                else
                {
                    ResetAnimation();
                }
            }
            _lastCondition = condition;
        }
Пример #11
0
        /// <summary>
        /// Checks, if an update for the element is needed
        /// </summary>
        /// <returns>true, if an update is needed</returns>
        public bool CheckForUpdate()
        {
            _control.UpdateVisibility();
            _control.DoRender(GUIGraphicsContext.TimePassed, (uint)System.Windows.Media.Animation.AnimationTimer.TickCount);

            int  _visibleCondition = _control.GetVisibleCondition();
            bool newVisible        = _visibleCondition == 0 ? _control.Visible : GUIInfoManager.GetBool(_visibleCondition, _control.ParentID);

            if (newVisible == _wasVisible)
            {
                if (newVisible)
                {
                    return(CheckElementSpecificForUpdate());
                }
                return(false);
            }
            _wasVisible = newVisible;
            if (true)
            {
                CheckElementSpecificForUpdate();
            }
            return(true);
        }
Пример #12
0
        /// <summary>
        /// Draws the element on the given graphics
        /// </summary>
        /// <param name="graph">Graphics</param>
        public override void DrawElement(Graphics graph)
        {
            if (_wasVisible)
            {
                GUIControl.Alignment alignment = _label.TextAlignment;
                RectangleF           rectangle;
                String text  = GUIPropertyManager.Parse(_label.Label);
                SizeF  sizeF = graph.MeasureString(text, _font);

                int xFromAnim = 0;
                int yFromAnim = 0;
                foreach (VisualEffect effect in _label.Animations)
                {
                    if (effect.CurrentState != AnimationState.None && effect.Effect == EffectType.Slide && (effect.Condition == 0 || GUIInfoManager.GetBool(effect.Condition, 0)))
                    {
                        xFromAnim += (int)effect.EndX;
                        yFromAnim += (int)effect.EndY;
                    }
                }
                int x = _label.XPosition + xFromAnim;
                int y = _label.YPosition + yFromAnim;

                if (alignment == GUIControl.Alignment.ALIGN_LEFT)
                {
                    //rectangle = new RectangleF(_label.XPosition, _label.YPosition, _label._width, Math.Max(sizeF.Height, _label._height));
                    rectangle = new RectangleF(x, y, _label._width, Math.Max(sizeF.Height, _label._height));
                }
                else
                {
                    //rectangle = alignment == GUIControl.Alignment.ALIGN_RIGHT ? new RectangleF((float)_label.Location.X - sizeF.Width, (float)_label.Location.Y, _label.Width, Math.Max(sizeF.Height, _label.Height)) : new RectangleF((float)_label.Location.X - (sizeF.Width / 2), (float)_label.Location.Y - (sizeF.Height / 2), _label.Width, Math.Max(sizeF.Height, _label.Height));
                    rectangle = alignment == GUIControl.Alignment.ALIGN_RIGHT ? new RectangleF((float)x - sizeF.Width, (float)y, _label.Width, Math.Max(sizeF.Height, _label.Height)) : new RectangleF((float)x - (sizeF.Width / 2), (float)y - (sizeF.Height / 2), _label.Width, Math.Max(sizeF.Height, _label.Height));
                }
                graph.DrawString(text, _font, _brush, rectangle, StringFormat.GenericTypographic);
            }
        }
Пример #13
0
        public override void UpdateVisibility()
        {
            base.UpdateVisibility();
            if (Children == null)
            {
                return;
            }
            if (_layout == null)
            {
                return;
            }

            if (_layout is StackLayout)
            {
                StackLayout layout = _layout as StackLayout;
                if (!layout.CollapseHiddenButtons)
                {
                    return;
                }
                if (_first)
                {
                    StoreButtonsPosition();
                }
                bool isVisible = IsVisible;
                int  visCon    = GetVisibleCondition();
                if (isVisible && visCon != 0)
                {
                    isVisible = GUIInfoManager.GetBool(visCon, ParentID);
                }

                if (!isVisible)
                {
                    RestoreButtonsPosition();
                    _first = true;
                    return;
                }

                if (!_first && CheckButtonsModifiedPosition())
                {
                    _first = true;
                }

                if (_first)
                {
                    StoreButtonsVisibilityState();
                }

                for (int i = 0; i < Children.Count; i++)
                {
                    Children[i].UpdateVisibility();

                    bool bWasVisible = _visibilityState[i];

                    int  bVisCon    = Children[i].GetVisibleCondition();
                    bool bIsVisible = Children[i].IsVisible;
                    if (bVisCon != 0)
                    {
                        bIsVisible = GUIInfoManager.GetBool(bVisCon, Children[i].ParentID);
                    }

                    if (_first && !bIsVisible)
                    {
                        if (layout.Orientation == System.Windows.Controls.Orientation.Vertical)
                        {
                            ShiftControlsUp(i);
                        }
                        else
                        {
                            ShiftControlsLeft(i);
                        }
                    }
                    if (!bWasVisible && bIsVisible)
                    {
                        _visibilityState[i] = true;

                        if (!_first)
                        {
                            if (layout.Orientation == System.Windows.Controls.Orientation.Vertical)
                            {
                                ShiftControlsDown(i);
                            }
                            else
                            {
                                ShiftControlsRight(i);
                            }
                        }
                    }
                    else if (bWasVisible && !bIsVisible)
                    {
                        if (Children[i].IsEffectAnimating(AnimationType.Hidden))
                        {
                            continue;
                        }
                        _visibilityState[i] = false;

                        if (!_first)
                        {
                            if (layout.Orientation == System.Windows.Controls.Orientation.Vertical)
                            {
                                ShiftControlsUp(i);
                            }
                            else
                            {
                                ShiftControlsLeft(i);
                            }
                        }
                    }
                }
                _first = false;
                StoreButtonsModifiedPosition();
            }
        }
Пример #14
0
        /// <summary>
        /// Draws the element for additional osd informations
        /// </summary>
        /// <param name="graph">Graphics</param>
        /// <param name="label">Label content</param>
        /// <param name="strikeout">Strikeout the label, when true</param>
        /// <param name="rectangle">Rectangle for the label</param>
        public void DrawElementAlternative(Graphics graph, String label, bool strikeout, RectangleF rectangle)
        {
            Font temp = _font;

            if (strikeout)
            {
                FontStyle style = _font.Style | FontStyle.Strikeout;
                temp = new Font(_font.FontFamily.Name, _font.Size, style);
            }

            int xFromAnim = 0;
            int yFromAnim = 0;

            foreach (VisualEffect effect in _label.Animations)
            {
                if (effect.CurrentState != AnimationState.None && effect.Effect == EffectType.Slide && (effect.Condition == 0 || GUIInfoManager.GetBool(effect.Condition, 0)))
                {
                    xFromAnim += (int)effect.EndX;
                    yFromAnim += (int)effect.EndY;
                }
            }
            rectangle.X += xFromAnim; rectangle.Y += yFromAnim;

            graph.DrawString(label, temp, _brush, rectangle, StringFormat.GenericTypographic);
        }
Пример #15
0
        public static object SkinHasSetting(string setting)
        {
            int condition = GUIInfoManager.TranslateString("skin.hassetting(" + setting + ")");

            return(GUIInfoManager.GetBool(condition, 0));
        }
Пример #16
0
        public static bool PluginIsEnabled(string name)
        {
            int condition = GUIInfoManager.TranslateString("plugin.isenabled(" + name + ")");

            return(GUIInfoManager.GetBool(condition, 0));
        }
Пример #17
0
        public static object SkinHasTheme(string theme)
        {
            int condition = GUIInfoManager.TranslateSingleString("skin.hastheme(" + theme + ")");

            return(GUIInfoManager.GetBool(condition, 0));
        }
Пример #18
0
        /// <summary>
        /// Gets the rectangle of the image
        /// </summary>
        /// <returns>Rectangle of the image</returns>
        public RectangleF GetImageRectangle()
        {
            if (_image.rect.IsEmpty)
            {
                _image.Refresh();
            }

            int xFromAnim = 0;
            int yFromAnim = 0;

            foreach (VisualEffect effect in _image.Animations)
            {
                if (effect.CurrentState != AnimationState.None && effect.Effect == EffectType.Slide && (effect.Condition == 0 || GUIInfoManager.GetBool(effect.Condition, 0)))
                {
                    xFromAnim += (int)effect.EndX;
                    yFromAnim += (int)effect.EndY;
                }
            }

            return(new RectangleF(_image._positionX + xFromAnim, _image._positionY + yFromAnim, _image.RenderWidth, _image.RenderHeight));
        }