Esempio n. 1
0
        internal static BitmapEx Draw(int?unreadMessageCount, LayoutContext layoutContext)
        {
            var bitmap = layoutContext.CreateBitmap();

            string countStr;
            string example = "8888";
            string symb;

            if (unreadMessageCount == 0)
            {
                symb     = FontAwesomeRes.fa_envelope_o;
                countStr = "";
            }
            else if (unreadMessageCount == null)
            {
                symb     = FontAwesomeRes.fa_envelope_o;
                countStr = "X";
            }
            else
            {
                symb     = FontAwesomeRes.fa_envelope;
                countStr = unreadMessageCount.ToString();
            }

            DefaultDrawingAlgs.DrawIconAndText(bitmap, FontService.Instance.AwesomeFontFamily, symb, layoutContext.Options.Theme.FontFamily, countStr, example, layoutContext.Options.Theme.ForegroundColor);

            return(bitmap);
        }
Esempio n. 2
0
        internal static BitmapEx DrawIcon(WeatherInfo response, string text, LayoutContext layoutContext)
        {
            var symbol = WeatherHelpers.GetWeatherSymbol(response.Symbol);
            var bitmap = layoutContext.CreateBitmap();

            DefaultDrawingAlgs.DrawIconAndText(bitmap, WeatherHelpers.WeatherFontFamily, symbol, layoutContext.Options.Theme.FontFamily, text, "22:22", layoutContext.Options.Theme.ForegroundColor);

            return(bitmap);
        }
Esempio n. 3
0
        private static BitmapEx Draw(WeatherInfo weatherInfo, LayoutContext layoutContext)
        {
            var temperature = WeatherHelpers.TempToStr(weatherInfo.TemperatureCelsius ?? 0);
            var symbol      = WeatherHelpers.GetWeatherSymbol(weatherInfo.Symbol);

            var bitmap = layoutContext.CreateBitmap();

            DefaultDrawingAlgs.DrawIconAndText(bitmap, WeatherHelpers.WeatherFontFamily, symbol, layoutContext.Options.Theme.FontFamily, temperature, "+88", layoutContext.Options.Theme.ForegroundColor);

            return(bitmap);
        }
Esempio n. 4
0
        private async void ProcessDraw()
        {
            try
            {
                WeatherInfo weather = await _weatherService.GetCurrentWeather(_weatherOptions.Place);

                var img = Draw(weather, LayoutContext);
                DrawInvoke(new[] { new LayoutDrawElement(new Location(0, 0), img) });
            }
            catch (Exception)
            {
                var bitmap = LayoutContext.CreateBitmap();
                DefaultDrawingAlgs.DrawIconAndText(bitmap, GlobalContext.Options.Theme.FontFamily, "...", GlobalContext.Options.Theme.FontFamily, "", "88888", GlobalContext.Options.Theme.ForegroundColor);
                DrawInvoke(new[] { new LayoutDrawElement(new Location(0, 0), bitmap) });
            }
        }