Beispiel #1
0
        public static StreamDeckTitleParameters ConvertTitleParameter(StreamDeckEventPayload.TitleParameters titleParameters)
        {
            StreamDeckTitleParameters result = new StreamDeckTitleParameters()
            {
                FontName  = (titleParameters.fontFamily != "" ? titleParameters.fontFamily : "Arial"),
                FontSize  = titleParameters.fontSize,
                FontColor = titleParameters.titleColor
            };

            if (titleParameters.fontFamily != "")
            {
                result.FontStyle = (int)FontStyle.Regular;
                if (titleParameters.fontStyle.Contains(AppSettings.fontBold))
                {
                    result.FontStyle |= (int)FontStyle.Bold;
                }
                if (titleParameters.fontStyle.Contains(AppSettings.fontItalic))
                {
                    result.FontStyle |= (int)FontStyle.Italic;
                }
            }
            else
            {
                result.FontStyle = (int)FontStyle.Bold;
            }

            if (titleParameters.fontUnderline)
            {
                result.FontStyle |= (int)FontStyle.Underline;
            }

            return(result);
        }
Beispiel #2
0
 public static Color ConvertColorParameter(StreamDeckTitleParameters titleParameters)
 {
     return(ColorTranslator.FromHtml(titleParameters.FontColor));
 }
Beispiel #3
0
 public static Font ConvertFontParameter(StreamDeckTitleParameters titleParameters)
 {
     return(new Font(titleParameters.FontName, titleParameters.FontSize, (FontStyle)titleParameters.FontStyle)); //GraphicsUnit.Point ?
 }