示例#1
0
        public static string GetWidgetUrl(ulong id, SmallWidgetType type, WidgetImageFormat format = WidgetImageFormat.Svg, int?avatarBackgroundColor = null,
                                          int?leftColor = null, int?rightColor = null, int?leftTextColor = null, int?rightTextColor = null, bool useAvatar = true)
        {
            string url = GetBaseWidgetUrl(id, format, type);

            var args = new List <string>();

            if (!useAvatar)
            {
                args.Add($"noavatar=true");
            }

            if (avatarBackgroundColor != null)
            {
                args.Add($"avatarbg={avatarBackgroundColor.Value:X}");
            }

            if (leftColor != null)
            {
                args.Add($"leftcolor={leftColor.Value:X}");
            }

            if (rightColor != null)
            {
                args.Add($"rightcolor={rightColor.Value:X}");
            }

            if (leftTextColor != null)
            {
                args.Add($"lefttextcolor={leftTextColor.Value:X}");
            }

            if (rightTextColor != null)
            {
                args.Add($"righttextcolor={rightTextColor.Value:X}");
            }

            return(CreateQuery(url, args));
        }
 /// <summary>
 /// Sets the <see cref="SmallWidgetType"/> of this <see cref="SmallWidgetBuilder"/>.
 /// </summary>
 /// <param name="type">The new <see cref="SmallWidgetType"/> that this <see cref="SmallWidgetBuilder"/> will represent.</param>
 public SmallWidgetBuilder WithType(SmallWidgetType type)
 {
     Type = type;
     return(this);
 }