Beispiel #1
0
        /// <summary>
        /// Get font size
        /// </summary>
        /// <param name="language">language</param>
        /// <returns>font size</returns>
        public async Task <ePaperFontSize> GetFontSizeAsync(ePaperLanguage language)
        {
            ePaperCommand cmd;

            if (language == ePaperLanguage.English)
            {
                cmd = ePaperCommand.GetFontSizeEn;
            }
            else
            {
                cmd = ePaperCommand.GetFontSizeCn;
            }
            string result = await SendCommand(cmd);

            ePaperFontSize fontSize;

            if (!Enum.TryParse <ePaperFontSize>(result, out fontSize))
            {
                ThrowException(result);
            }
            return(fontSize);
        }
Beispiel #2
0
        /// <summary>
        /// Set font size
        /// </summary>
        /// <param name="language">language</param>
        /// <param name="fontSize">font size</param>
        /// <returns></returns>
        public async Task SetFontSizeAsync(ePaperLanguage language, ePaperFontSize fontSize)
        {
            byte[] parameters = new byte[1] {
                (byte)fontSize
            };
            ePaperCommand cmd;

            if (language == ePaperLanguage.English)
            {
                cmd = ePaperCommand.SetFontSizeEn;
            }
            else
            {
                cmd = ePaperCommand.SetFontSizeCn;
            }
            string result = await SendCommand(cmd, parameters);

            if (result != "OK")
            {
                ThrowException(result);
            }
        }