public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            const double maxStickerDimension = 93.0;
            var          isWidth             = string.Equals((string)parameter, "Width", StringComparison.OrdinalIgnoreCase);

            var attributes = value as IAttributes;

            if (attributes != null)
            {
                return(StickerToDimensionConverter.GetAttributesDimension(attributes, isWidth, maxStickerDimension));
            }

            return(isWidth ? double.NaN : maxStickerDimension);
        }
        public static double GetWebDocumentDimension(TLWebDocumentBase webDocument, bool isWidth)
        {
            const double width = Constants.DefaultMessageContentWidth;

            if (isWidth)
            {
                return(width);
            }

            var attributes = webDocument as IAttributes;

            if (attributes == null)
            {
                return(double.NaN);
            }

            return(StickerToDimensionConverter.GetAttributesDimension(attributes, isWidth, width));
        }