Example #1
0
        public virtual void Recalculate()
        {
            CalculatedStyle calculatedStyle  = Parent?.InnerDimensions ?? UserInterface.ActiveInstance.Dimensions;
            CalculatedStyle calculatedStyle2 = default;

            calculatedStyle2.X = Left.GetValue(calculatedStyle.Width) + calculatedStyle.X;
            calculatedStyle2.Y = Top.GetValue(calculatedStyle.Height) + calculatedStyle.Y;
            float value  = MinWidth.GetValue(calculatedStyle.Width);
            float value2 = MaxWidth.GetValue(calculatedStyle.Width);
            float value3 = MinHeight.GetValue(calculatedStyle.Height);
            float value4 = MaxHeight.GetValue(calculatedStyle.Height);

            calculatedStyle2.Width   = MathHelper.Clamp(Width.GetValue(calculatedStyle.Width), value, value2);
            calculatedStyle2.Height  = MathHelper.Clamp(Height.GetValue(calculatedStyle.Height), value3, value4);
            calculatedStyle2.Width  += MarginLeft + MarginRight;
            calculatedStyle2.Height += MarginTop + MarginBottom;
            calculatedStyle2.X      += calculatedStyle.Width * HAlign - calculatedStyle2.Width * HAlign;
            calculatedStyle2.Y      += calculatedStyle.Height * VAlign - calculatedStyle2.Height * VAlign;
            OuterDimensions          = calculatedStyle2;

            calculatedStyle2.X      += MarginLeft;
            calculatedStyle2.Y      += MarginTop;
            calculatedStyle2.Width  -= MarginLeft + MarginRight;
            calculatedStyle2.Height -= MarginTop + MarginBottom;
            Dimensions = calculatedStyle2;

            calculatedStyle2.X      += PaddingLeft;
            calculatedStyle2.Y      += PaddingTop;
            calculatedStyle2.Width  -= PaddingLeft + PaddingRight;
            calculatedStyle2.Height -= PaddingTop + PaddingBottom;
            InnerDimensions          = calculatedStyle2;

            RecalculateChildren();
        }
Example #2
0
        private void InternalSetText(object text, float textScale, bool large)
        {
            DynamicSpriteFont val = large ? FontAssets.DeathText.get_Value() : FontAssets.MouseText.get_Value();

            _text              = text;
            _isLarge           = large;
            _textScale         = textScale;
            _lastTextReference = _text.ToString();
            if (IsWrapped)
            {
                _visibleText = val.CreateWrappedText(_lastTextReference, GetInnerDimensions().Width / _textScale);
            }
            else
            {
                _visibleText = _lastTextReference;
            }
            Vector2 vector  = val.MeasureString(_visibleText);
            Vector2 vector2 = _textSize = ((!IsWrapped) ? (new Vector2(vector.X, large ? 32f : 16f) * textScale) : (new Vector2(vector.X, vector.Y + WrappedTextBottomPadding) * textScale));

            MinWidth.Set(vector2.X + PaddingLeft + PaddingRight, 0f);
            MinHeight.Set(vector2.Y + PaddingTop + PaddingBottom, 0f);
            if (this.OnInternalTextChange != null)
            {
                this.OnInternalTextChange();
            }
        }
Example #3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (PointCloudRange != 0F)
            {
                hash ^= PointCloudRange.GetHashCode();
            }
            if (Width != 0)
            {
                hash ^= Width.GetHashCode();
            }
            if (Height != 0)
            {
                hash ^= Height.GetHashCode();
            }
            if (MinHeight != 0F)
            {
                hash ^= MinHeight.GetHashCode();
            }
            if (MaxHeight != 0F)
            {
                hash ^= MaxHeight.GetHashCode();
            }
            if (UseIntensityFeature != false)
            {
                hash ^= UseIntensityFeature.GetHashCode();
            }
            if (UseConstantFeature != false)
            {
                hash ^= UseConstantFeature.GetHashCode();
            }
            return(hash);
        }
        public void UpdateSize()
        {
            int num  = _itemsPerLine = GetDimensions().ToRectangle().Width / 44;
            int num2 = (int)Math.Ceiling((float)_itemIdsAvailableToShow.Count / (float)num);

            MinHeight.Set(44 * num2, 0f);
        }
        public void Update(IEntities entities, TimeSpan delta)
        {
            var min = new MinHeight();

            entities.Collect <ZGravity>()
            .OrderBy(x => x.Transform.ZIndex)
            .ForEach(x => Update(min, x));
        }
Example #6
0
        public override void OnInitialize()
        {
            MediaCache.LoadTexture(Image, out string key);
            Texture2D temp = MediaCache.GetTexture(key);

            MinWidth.Set(temp.Width, 0f);
            MinHeight.Set(temp.Height, 0f);
            Image = key;
        }
Example #7
0
		public virtual void SetText(T text, float textScale)
		{
			Vector2 textSize = new Vector2(FontAssets.MouseText.get_Value().MeasureString(text.ToString()).X, 16f) * textScale;
			_text = text;
			_textScale = textScale;
			_textSize = textSize;
			MinWidth.Set(textSize.X + PaddingLeft + PaddingRight, 0f);
			MinHeight.Set(textSize.Y + PaddingTop + PaddingBottom, 0f);
		}
Example #8
0
        private void InternalSetText(object text, float textScale, bool large)
        {
            Vector2 textSize = new Vector2((large ? Main.fontDeathText : Main.fontMouseText).MeasureString(text.ToString()).X, large ? 32f : 16f) * textScale;

            _textScale = textScale;
            _textSize  = textSize;
            _isLarge   = large;
            MinWidth.Set(textSize.X + PaddingLeft + PaddingRight, 0f);
            MinHeight.Set(textSize.Y + PaddingTop + PaddingBottom, 0f);
        }
        public UITextWrapPanel()
        {
            Width.Set(0, 1f);
            MinHeight.Set(22f, 0f);

            _text        = "";
            _textInLines = new string[1];
            uiText       = new UIText(_text, 0.9f, false);
            base.Append(uiText);
        }
Example #10
0
        protected override IEnumerator ProcessPayload(VisualPayload payload)
        {
            var label = VisualizerFactory.InstantiateLabelVisualizerPrefab();

            label.Initialize(this, payload);


            var meshRenderer = label.TextComponent.GetComponent <MeshRenderer>();

            var targetFont = FontFactory.GetFontPair(FontName.GetFirstValue(payload.Data));

            var newMaterial = FontFactory.GenerateNewSpatialMaterial(targetFont.FontTexture);

            label.TextComponent.font = targetFont.Font;

            label.TextComponent.fontSize  = Mathf.FloorToInt(FontSize.GetFirstValue(payload.Data) * targetFont.FontScale);
            label.transform.localPosition = new Vector3(0f, label.TextComponent.fontSize * targetFont.VerticalOffset, 0f);

            label.CharactersPerLine = CharactersPerLine.GetFirstValue(payload.Data);

            label.MaxLines = MaxLines.GetFirstValue(payload.Data);

            newMaterial.color = FontColor.GetFirstValue(payload.Data);

            meshRenderer.material = newMaterial;


            label.BackgroundPadding = BackgroundPadding.GetFirstValue(payload.Data);
            label.BackgroundDepth   = BackgroundDepth.GetFirstValue(payload.Data);

            label.LateralJustification = Justification.GetFirstValue(payload.Data);

            label.VerticalJustification = VerticalJustification.GetFirstValue(payload.Data);

            label.MinHeight = MinHeight.GetFirstValue(payload.Data);
            label.MaxHeight = MaxHeight.GetFirstValue(payload.Data);

            label.Orientation = Orientation.GetFirstValue(payload.Data);

            label.SetClickState(ClickState);

            label.RemoveBackground = !ShowBackground.GetFirstValue(payload.Data);

            label.Text = LabelText.GetFirstValue(payload.Data);

            var newPayload = new VisualPayload(payload.Data, new VisualDescription(label.Bound));

            var iterator = DefaultState.Transmit(newPayload);

            while (iterator.MoveNext())
            {
                yield return(null);
            }
        }
Example #11
0
        public virtual void SetText(T text, float textScale, bool large)
        {
            Vector2 textSize = new Vector2((large ? FontAssets.DeathText.Value : FontAssets.MouseText.Value).MeasureString(text.ToString()).X, large ? 32f : 16f) * textScale;

            _text      = text;
            _textScale = textScale;
            _textSize  = textSize;
            _isLarge   = large;
            MinWidth.Set(textSize.X + PaddingLeft + PaddingRight, 0f);
            MinHeight.Set(textSize.Y + PaddingTop + PaddingBottom, 0f);
        }
Example #12
0
        public void SetText(string text, float textScale, bool large)
        {
            Vector2 vector2 = new Vector2((large ? Main.fontDeathText : Main.fontMouseText).MeasureString(text).X, large ? 32f : 16f) * textScale;

            _text      = text;
            _textScale = textScale;
            _textSize  = vector2;
            _isLarge   = large;
            MinWidth.Set(vector2.X + PaddingLeft + PaddingRight, 0.0f);
            MinHeight.Set(vector2.Y + PaddingTop + PaddingBottom, 0.0f);
        }
Example #13
0
        private static void Update(MinHeight min, GameObject obj)
        {
            var minZ     = min.Value;
            var currentZ = obj.Transform.ZIndex;
            var grav     = obj.Get <ZGravity>();

            if (grav.IsEnabled && currentZ > minZ)
            {
                obj.Transform.ZIndex = Math.Max(minZ, currentZ - grav.Acceleration);
            }
            min.Value = obj.Transform.ZIndex + 1;
        }
Example #14
0
        private static void Update(MinHeight min, GameObject obj)
        {
            var minZ     = min.Value;
            var currentZ = obj.World.ZIndex;
            var grav     = obj.Get <ZGravity>();

            if (grav.IsEnabled && currentZ.Value > minZ)
            {
                obj.Local.ZIndex = new ZIndex(Math.Max(minZ, currentZ.Value - grav.Acceleration) - obj.World.ZIndex.Value);
            }
            min.Value = obj.World.ZIndex.Value + 1;
        }
Example #15
0
        public override void OnInitialize()
        {
            MinWidth = StyleDimension.Fill;
            MinHeight.Set(DEFAULT_HEIGHT, 0);

            Append(Checkbox);

            UILabel = new UIText(Label);
            UILabel.Left.Set(DEFAULT_HEIGHT + Gap, 0f);
            UILabel.VAlign = 0.5f;
            Append(UILabel);
        }
Example #16
0
        public virtual void SetText(T text, float scale, bool large)
        {
            Vector2 size = (large ? Main.Xiq12 : Main.Xiq12).MeasureString(text.ToString()) * scale;

            size.Y    = (large ? 28f : 16f) * scale;
            this.text = text;
            TextScale = scale;
            TextSize  = size;
            IsLarge   = large;
            MinWidth.Set(size.X + PaddingLeft + PaddingRight, 0f);
            MinHeight.Set(size.Y + PaddingTop + PaddingBottom, 0f);
        }
Example #17
0
        private void InternalSetText(object text, float scale, bool large)
        {
            Vector2 size = (large ? Main.Xiq12 : Main.Xiq12).MeasureString(text.ToString()) * scale;

            size.Y    = (large ? 28f : 16f) * scale;
            Text      = text;
            TextScale = scale;
            TextSize  = size;
            IsLarge   = large;
            MinWidth.Set(size.X + PaddingLeft + PaddingRight, 0f);
            MinHeight.Set(size.Y + PaddingTop + PaddingBottom, 0f);
        }
Example #18
0
        public void SetText(string text, float textScale, bool large)
        {
            SpriteFont spriteFont = large ? Main.fontDeathText : Main.fontMouseText;
            Vector2    textSize   = new Vector2(spriteFont.MeasureString(text).X, large ? 32f : 16f) * textScale;

            _text      = text;
            _textScale = textScale;
            _textSize  = textSize;
            _isLarge   = large;
            MinWidth.Set(textSize.X + PaddingLeft + PaddingRight, 0f);
            MinHeight.Set(textSize.Y + PaddingTop + PaddingBottom, 0f);
        }
Example #19
0
 public void Render(IOutputStream outputStream)
 {
     if (MinWidth != null)
     {
         outputStream.Write(HTMLElements.m_space);
         outputStream.Write(HTMLElements.m_styleMinWidth);
         outputStream.Write(HTMLElements.m_space);
         MinWidth.Render(outputStream);
         outputStream.Write(HTMLElements.m_semiColon);
     }
     if (MinHeight != null)
     {
         outputStream.Write(HTMLElements.m_space);
         outputStream.Write(HTMLElements.m_styleMinHeight);
         outputStream.Write(HTMLElements.m_space);
         MinHeight.Render(outputStream);
         outputStream.Write(HTMLElements.m_semiColon);
     }
     if (MaxHeight != null)
     {
         outputStream.Write(HTMLElements.m_space);
         outputStream.Write(HTMLElements.m_styleMaxHeight);
         outputStream.Write(HTMLElements.m_space);
         MaxHeight.Render(outputStream);
         outputStream.Write(HTMLElements.m_semiColon);
     }
     if (MaxWidth != null)
     {
         outputStream.Write(HTMLElements.m_space);
         outputStream.Write(HTMLElements.m_styleMaxWidth);
         outputStream.Write(HTMLElements.m_space);
         MaxWidth.Render(outputStream);
         outputStream.Write(HTMLElements.m_semiColon);
     }
     if (Width != null)
     {
         outputStream.Write(HTMLElements.m_space);
         outputStream.Write(HTMLElements.m_styleWidth);
         outputStream.Write(HTMLElements.m_space);
         Width.Render(outputStream);
         outputStream.Write(HTMLElements.m_semiColon);
     }
     if (Height != null)
     {
         outputStream.Write(HTMLElements.m_space);
         outputStream.Write(HTMLElements.m_styleHeight);
         outputStream.Write(HTMLElements.m_space);
         Height.Render(outputStream);
         outputStream.Write(HTMLElements.m_semiColon);
     }
 }
Example #20
0
        public UIButtonChoice(GUIBase parent, Texture2D[] _butons, LocalizedText[] mouseText)
        {
            if (_butons.Length != mouseText.Length || _butons.Length == 0)
            {
                throw new ArgumentException();
            }
            buttons        = _butons;
            mouseOverTexts = mouseText;
            parentGui      = parent;

            int width = BUTTON_SIZE * _butons.Length + BUTTON_PADDING * (_butons.Length - 1);

            Width.Set(width, 0f);
            MinWidth.Set(width, 0f);
            Height.Set(BUTTON_SIZE, 0f);
            MinHeight.Set(BUTTON_SIZE, 0f);
        }
Example #21
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (PokemonScaleMode != 0)
            {
                hash ^= PokemonScaleMode.GetHashCode();
            }
            if (MinHeight != 0F)
            {
                hash ^= MinHeight.GetHashCode();
            }
            if (MaxHeight != 0F)
            {
                hash ^= MaxHeight.GetHashCode();
            }
            return(hash);
        }
Example #22
0
        public override void ResizeThis(Rectangle parentRectangle)
        {
            //scale all relative values to parent rectangle
            Margin.Resize(parentRectangle.Size);
            FlexWidth.Resize(parentRectangle.Width);
            FlexHeight.Resize(parentRectangle.Height);
            MaxWidth.Resize(parentRectangle.Width);
            MinWidth.Resize(parentRectangle.Width);
            MaxHeight.Resize(parentRectangle.Height);
            MinHeight.Resize(parentRectangle.Height);

            //clamp size to min and max
            Width  = MathHelper.Clamp(FlexWidth.Absolute / SEGMENT_WIDTH, MinWidth.Absolute, MaxWidth.Absolute) * SEGMENT_WIDTH;
            Height = MathHelper.Clamp(FlexHeight.Absolute, MinHeight.Absolute, MaxHeight.Absolute);

            //if control is square, conform both width and height to the larger of the two
            if (IsSquare)
            {
                Width = Height = Math.Min(Width, Height);
            }

            X = HorizontalAlign switch
            {
                HorizontalAlign.Center => (parentRectangle.X + (parentRectangle.Width / 2) - (Width / 2)),
                HorizontalAlign.Left => parentRectangle.Left + Margin.Left,
                _ => parentRectangle.Right - Width - Margin.Right
            };

            Y = VerticalAlign switch
            {
                VerticalAlign.Center => (parentRectangle.Top + parentRectangle.Height / 2 - Height / 2),
                VerticalAlign.Top => parentRectangle.Top + Margin.Top,
                _ => parentRectangle.Bottom - Height - Margin.Bottom
            };

            Padding.Resize(Size);

            //calculate internal rectangle
            ContentRectangle = new Rectangle(X + Margin.Left + Padding.Left, Y + Margin.Top + Padding.Top, Width - Padding.Horizontal, Height - Padding.Vertical);
        }
Example #23
0
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Width/Min", true, out subEle);
            subEle.Value = MinWidth.ToString("G15");

            ele.TryPathTo("Width/Max", true, out subEle);
            subEle.Value = MaxWidth.ToString("G15");

            ele.TryPathTo("Height/Min", true, out subEle);
            subEle.Value = MinHeight.ToString("G15");

            ele.TryPathTo("Height/Max", true, out subEle);
            subEle.Value = MaxHeight.ToString("G15");

            ele.TryPathTo("Depth", true, out subEle);
            subEle.Value = Depth.ToString("G15");

            ele.TryPathTo("Shininess", true, out subEle);
            subEle.Value = Shininess.ToString("G15");

            ele.TryPathTo("Parallax/Scale", true, out subEle);
            subEle.Value = ParallaxScale.ToString("G15");

            ele.TryPathTo("Parallax/Passes", true, out subEle);
            subEle.Value = ParallaxPasses.ToString();

            ele.TryPathTo("Flags", true, out subEle);
            subEle.Value = DecalFlags.ToString();

            WriteUnusedXML(ele, master);

            ele.TryPathTo("Color", true, out subEle);
            Color.WriteXML(subEle, master);
        }
Example #24
0
        private async void LoadImage()
        {
            if (_currentTask != null)
            {
                _currentTask.Cancel();
            }

            TaskParameter imageLoader = null;

            var ffSource = await FFImageSourceBinding.GetImageSourceBinding(Source);

            if (ffSource == null)
            {
                if (internalImage != null)
                {
                    await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
                        internalImage.Source = null;
                    });
                }
            }
            else if (ffSource.ImageSource == FFImageLoading.Work.ImageSource.Url)
            {
                imageLoader = ImageService.LoadUrl(ffSource.Path, TimeSpan.FromDays(CacheDuration));
            }
            else if (ffSource.ImageSource == FFImageLoading.Work.ImageSource.CompiledResource)
            {
                imageLoader = ImageService.LoadCompiledResource(ffSource.Path);
            }
            else if (ffSource.ImageSource == FFImageLoading.Work.ImageSource.ApplicationBundle)
            {
                imageLoader = ImageService.LoadFileFromApplicationBundle(ffSource.Path);
            }
            else if (ffSource.ImageSource == FFImageLoading.Work.ImageSource.Filepath)
            {
                imageLoader = ImageService.LoadFile(ffSource.Path);
            }

            if (imageLoader != null)
            {
                // LoadingPlaceholder
                if (LoadingPlaceholder != null)
                {
                    var placeholderSource = await FFImageSourceBinding.GetImageSourceBinding(LoadingPlaceholder);

                    if (placeholderSource != null)
                    {
                        imageLoader.LoadingPlaceholder(placeholderSource.Path, placeholderSource.ImageSource);
                    }
                }

                // ErrorPlaceholder
                if (ErrorPlaceholder != null)
                {
                    var placeholderSource = await FFImageSourceBinding.GetImageSourceBinding(ErrorPlaceholder);

                    if (placeholderSource != null)
                    {
                        imageLoader.ErrorPlaceholder(placeholderSource.Path, placeholderSource.ImageSource);
                    }
                }

                // Downsample
                if (DownsampleToViewSize && (Width > 0 || Height > 0))
                {
                    if (Height > Width)
                    {
                        imageLoader.DownSample(height: Height.PointsToPixels());
                    }
                    else
                    {
                        imageLoader.DownSample(width: Width.PointsToPixels());
                    }
                }
                else if (DownsampleToViewSize && (MinWidth > 0 || MinHeight > 0))
                {
                    if (MinHeight > MinWidth)
                    {
                        imageLoader.DownSample(height: MinHeight.PointsToPixels());
                    }
                    else
                    {
                        imageLoader.DownSample(width: MinWidth.PointsToPixels());
                    }
                }
                else if ((int)DownsampleHeight != 0 || (int)DownsampleWidth != 0)
                {
                    if (DownsampleHeight > DownsampleWidth)
                    {
                        imageLoader.DownSample(height: DownsampleUseDipUnits
                            ? DownsampleHeight.PointsToPixels() : (int)DownsampleHeight);
                    }
                    else
                    {
                        imageLoader.DownSample(width: DownsampleUseDipUnits
                            ? DownsampleWidth.PointsToPixels() : (int)DownsampleWidth);
                    }
                }

                // Downsample mode
                imageLoader.DownSampleMode(DownsampleMode);

                // RetryCount
                if (RetryCount > 0)
                {
                    imageLoader.Retry(RetryCount, RetryDelay);
                }

                // FadeAnimation
                imageLoader.FadeAnimation(FadeAnimationEnabled);

                // TransformPlaceholders
                imageLoader.TransformPlaceholders(TransformPlaceholders);

                // Transformations
                if (Transformations != null && Transformations.Count != 0)
                {
                    imageLoader.Transform(Transformations);
                }

                _currentTask = imageLoader.Into(internalImage);
            }
        }
Example #25
0
        private async void LoadImage()
        {
            if (_currentTask != null)
            {
                _currentTask.Cancel();
            }

            TaskParameter imageLoader = null;

            var ffSource = await FFImageSourceBinding.GetImageSourceBinding(Source);

            if (ffSource == null)
            {
                if (internalImage != null)
                {
                    await MainThreadDispatcher.Instance.PostAsync(() => {
                        internalImage.Source = null;
                    });
                }
            }
            else if (ffSource.ImageSource == FFImageLoading.Work.ImageSource.Url)
            {
                imageLoader = ImageService.LoadUrl(ffSource.Path, TimeSpan.FromDays(CacheDuration));
            }
            else if (ffSource.ImageSource == FFImageLoading.Work.ImageSource.CompiledResource)
            {
                imageLoader = ImageService.LoadCompiledResource(ffSource.Path);
            }
            else if (ffSource.ImageSource == FFImageLoading.Work.ImageSource.ApplicationBundle)
            {
                imageLoader = ImageService.LoadFileFromApplicationBundle(ffSource.Path);
            }
            else if (ffSource.ImageSource == FFImageLoading.Work.ImageSource.Filepath)
            {
                imageLoader = ImageService.LoadFile(ffSource.Path);
            }

            if (imageLoader != null)
            {
                // CustomKeyFactory
                if (CacheKeyFactory != null)
                {
                    var dataContext = DataContext;
                    imageLoader.CacheKey(CacheKeyFactory.GetKey(Source, dataContext));
                }

                // LoadingPlaceholder
                if (LoadingPlaceholder != null)
                {
                    var placeholderSource = await FFImageSourceBinding.GetImageSourceBinding(LoadingPlaceholder);

                    if (placeholderSource != null)
                    {
                        imageLoader.LoadingPlaceholder(placeholderSource.Path, placeholderSource.ImageSource);
                    }
                }

                // ErrorPlaceholder
                if (ErrorPlaceholder != null)
                {
                    var placeholderSource = await FFImageSourceBinding.GetImageSourceBinding(ErrorPlaceholder);

                    if (placeholderSource != null)
                    {
                        imageLoader.ErrorPlaceholder(placeholderSource.Path, placeholderSource.ImageSource);
                    }
                }

                // Downsample
                if (DownsampleToViewSize && (Width > 0 || Height > 0))
                {
                    if (Height > Width)
                    {
                        imageLoader.DownSample(height: Height.PointsToPixels());
                    }
                    else
                    {
                        imageLoader.DownSample(width: Width.PointsToPixels());
                    }
                }
                else if (DownsampleToViewSize && (MinWidth > 0 || MinHeight > 0))
                {
                    if (MinHeight > MinWidth)
                    {
                        imageLoader.DownSample(height: MinHeight.PointsToPixels());
                    }
                    else
                    {
                        imageLoader.DownSample(width: MinWidth.PointsToPixels());
                    }
                }
                else if ((int)DownsampleHeight != 0 || (int)DownsampleWidth != 0)
                {
                    if (DownsampleHeight > DownsampleWidth)
                    {
                        imageLoader.DownSample(height: DownsampleUseDipUnits
                            ? DownsampleHeight.PointsToPixels() : (int)DownsampleHeight);
                    }
                    else
                    {
                        imageLoader.DownSample(width: DownsampleUseDipUnits
                            ? DownsampleWidth.PointsToPixels() : (int)DownsampleWidth);
                    }
                }

                // Downsample mode
                imageLoader.DownSampleMode(DownsampleMode);

                // RetryCount
                if (RetryCount > 0)
                {
                    imageLoader.Retry(RetryCount, RetryDelay);
                }

                // FadeAnimation
                imageLoader.FadeAnimation(FadeAnimationEnabled);

                // TransformPlaceholders
                imageLoader.TransformPlaceholders(TransformPlaceholders);

                // Transformations
                if (Transformations != null && Transformations.Count != 0)
                {
                    imageLoader.Transform(Transformations);
                }

                imageLoader.Finish((work) =>
                                   OnFinish(new Args.FinishEventArgs(work)));

                imageLoader.Success((imageSize, loadingResult) =>
                                    OnSuccess(new Args.SuccessEventArgs(imageSize, loadingResult)));

                imageLoader.Error((exception) =>
                                  OnError(new Args.ErrorEventArgs(exception)));

                _currentTask = imageLoader.Into(internalImage);
            }
        }
        public bool Equals(ContentTypeProperty input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     Name == input.Name ||
                     (Name != null && Name.Equals(input.Name))
                     ) &&
                 (
                     RootPropertyName == input.RootPropertyName ||
                     (RootPropertyName != null && RootPropertyName.Equals(input.RootPropertyName))
                 ) &&
                 (
                     ReadableName == input.ReadableName ||
                     (ReadableName != null && ReadableName.Equals(input.ReadableName))
                 ) &&
                 (
                     Value == input.Value ||
                     (Value != null && Value.Equals(input.Value))
                 ) &&
                 (
                     PropertyDescription == input.PropertyDescription ||
                     (PropertyDescription != null && PropertyDescription.Equals(input.PropertyDescription))
                 ) &&
                 (
                     Localizable == input.Localizable ||
                     (Localizable != null && Localizable.Equals(input.Localizable))
                 ) &&
                 (
                     Fallback == input.Fallback ||
                     (Fallback != null && Fallback.Equals(input.Fallback))
                 ) &&
                 (
                     Enabled == input.Enabled ||
                     (Enabled != null && Enabled.Equals(input.Enabled))
                 ) &&
                 (
                     Order == input.Order ||
                     (Order.Equals(input.Order))
                 ) &&
                 (
                     Visible == input.Visible ||
                     (Visible != null && Visible.Equals(input.Visible))
                 ) &&
                 (
                     IsTitle == input.IsTitle ||
                     (IsTitle != null && IsTitle.Equals(input.IsTitle))
                 ) &&
                 (
                     Required == input.Required ||
                     (Required != null && Required.Equals(input.Required))
                 ) &&
                 (
                     MaxLength == input.MaxLength ||
                     (MaxLength.Equals(input.MaxLength))
                 ) &&
                 (
                     MaxByteLength == input.MaxByteLength ||
                     (MaxByteLength.Equals(input.MaxByteLength))
                 ) &&
                 (
                     MaxFileSize == input.MaxFileSize ||
                     (MaxFileSize.Equals(input.MaxFileSize))
                 ) &&
                 (
                     Regexp == input.Regexp ||
                     (Regexp != null && Regexp.Equals(input.Regexp))
                 ) &&
                 (
                     ValidateAs == input.ValidateAs ||
                     (ValidateAs != null && ValidateAs.Equals(input.ValidateAs))
                 ) &&
                 (
                     RssAttribute == input.RssAttribute ||
                     (RssAttribute != null && RssAttribute.Equals(input.RssAttribute))
                 ) &&
                 (
                     VisibleDependency == input.VisibleDependency ||
                     (VisibleDependency != null && VisibleDependency.Equals(input.VisibleDependency))
                 ) &&
                 (
                     VisibleOn == input.VisibleOn ||
                     (VisibleOn != null && VisibleOn.Equals(input.VisibleOn))
                 ) &&
                 (
                     Datatype == input.Datatype ||
                     (Datatype != null && Datatype.Equals(input.Datatype))
                 ) &&
                 (
                     Attributes == input.Attributes ||
                     (Attributes != null && Attributes.SequenceEqual(input.Attributes))
                 ) &&
                 (
                     ChildProperties == input.ChildProperties ||
                     (ChildProperties != null && ChildProperties.SequenceEqual(input.ChildProperties))
                 ) &&
                 (
                     ContentTypeAllowed == input.ContentTypeAllowed ||
                     (ContentTypeAllowed != null && ContentTypeAllowed.Equals(input.ContentTypeAllowed))
                 ) &&
                 (
                     BindToProperty == input.BindToProperty ||
                     (BindToProperty != null && BindToProperty.Equals(input.BindToProperty))
                 ) &&
                 (
                     BoundRegex == input.BoundRegex ||
                     (BoundRegex != null && BoundRegex.Equals(input.BoundRegex))
                 ) &&
                 (
                     RepresentationSelection == input.RepresentationSelection ||
                     (RepresentationSelection != null && RepresentationSelection.SequenceEqual(input.RepresentationSelection))
                 ) &&
                 (
                     DefaultValues == input.DefaultValues ||
                     (DefaultValues != null && DefaultValues.SequenceEqual(input.DefaultValues))
                 ) &&
                 (
                     IsExternalAllowed == input.IsExternalAllowed ||
                     (IsExternalAllowed != null && IsExternalAllowed.Equals(input.IsExternalAllowed))
                 ) &&
                 (
                     PropertySection == input.PropertySection ||
                     (PropertySection != null && PropertySection.Equals(input.PropertySection))
                 ) &&
                 (
                     Weight == input.Weight ||
                     (Weight.Equals(input.Weight))
                 ) &&
                 (
                     Entitytype == input.Entitytype ||
                     (Entitytype != null && Entitytype.Equals(input.Entitytype))
                 ) &&
                 (
                     IsCombo == input.IsCombo ||
                     (IsCombo != null && IsCombo.Equals(input.IsCombo))
                 ) &&
                 (
                     SuppressProperty == input.SuppressProperty ||
                     (SuppressProperty != null && SuppressProperty.Equals(input.SuppressProperty))
                 ) &&
                 (
                     LegalContentTypes == input.LegalContentTypes ||
                     (LegalContentTypes != null && LegalContentTypes.SequenceEqual(input.LegalContentTypes))
                 ) &&
                 (
                     RepresentationValidationString == input.RepresentationValidationString ||
                     (RepresentationValidationString != null && RepresentationValidationString.Equals(input.RepresentationValidationString))
                 ) &&
                 (
                     MinWidth == input.MinWidth ||
                     (MinWidth.Equals(input.MinWidth))
                 ) &&
                 (
                     MaxWidth == input.MaxWidth ||
                     (MaxWidth.Equals(input.MaxWidth))
                 ) &&
                 (
                     MinHeight == input.MinHeight ||
                     (MinHeight.Equals(input.MinHeight))
                 ) &&
                 (
                     MaxHeight == input.MaxHeight ||
                     (MaxHeight.Equals(input.MaxHeight))
                 ) &&
                 (
                     IsVideo == input.IsVideo ||
                     (IsVideo != null && IsVideo.Equals(input.IsVideo))
                 ) &&
                 (
                     IsImage == input.IsImage ||
                     (IsImage != null && IsImage.Equals(input.IsImage))
                 ));
        }
        /// <summary>
        /// Create url query string.
        /// </summary>
        /// <returns>query string</returns>
        public override string ToString()
        {
            var sb = new StringBuilder();

            if (!String.IsNullOrEmpty(Query))
            {
                sb.Append($"&q={HttpTools.UriEncode(Query)}");
            }

            if (Language != null)
            {
                sb.Append($"&lang={Language.ToString().ToLower()}");
            }

            if (!String.IsNullOrEmpty(Id))
            {
                sb.Append($"&id={Id}");
            }

            if (Category != null)
            {
                sb.Append($"&category={Category.ToString().ToLower()}");
            }

            if (MinWidth != null && MinWidth != 0)
            {
                sb.Append($"&min_width={MinWidth.ToString().ToLower()}");
            }

            if (MinHeight != null && MinHeight != 0)
            {
                sb.Append($"&min_height={MinHeight.ToString().ToLower()}");
            }

            if (IsEditorsChoice != null)
            {
                sb.Append($"&editors_choice={IsEditorsChoice.ToString().ToLower()}");
            }

            if (IsSafeSearch != null)
            {
                sb.Append($"&safesearch={IsSafeSearch.ToString().ToLower()}");
            }

            if (Order != null)
            {
                sb.Append($"&order={Order.ToString().ToLower()}");
            }

            if (Page != null)
            {
                sb.Append($"&page={Page}");
            }

            if (PerPage != null)
            {
                sb.Append($"&per_page={PerPage}");
            }

            return(sb.ToString());
        }