Example #1
0
        //Returns font for bg label
        public Font GetFontForBgLabel(int currentScale)
        {
            BgRip bgRipMisc = new BgRip();

            appSetMisc.getAllSettings();
            bgRipMisc.getSourceFromUrl(appSetMisc.NightscoutUrl);
            Font returnFont;

            if (currentScale == 1)
            {
                returnFont = new Font("Impact", 72, FontStyle.Regular);
            }
            else if (currentScale == 2)
            {
                returnFont = new Font("Impact", 56, FontStyle.Regular);
            }
            else
            {
                returnFont = new Font("Impact", 36, FontStyle.Regular);
            }
            try
            {
                int minutesSinceLastBg = int.Parse(bgRipMisc.MinutesSinceLastBg);
                if (minutesSinceLastBg > 18)
                {
                    if (currentScale == 1)
                    {
                        returnFont = new Font("Impact", 72, FontStyle.Strikeout | FontStyle.Italic);
                    }
                    else if (currentScale == 2)
                    {
                        returnFont = new Font("Impact", 56, FontStyle.Strikeout | FontStyle.Italic);
                    }
                    else
                    {
                        returnFont = new Font("Impact", 36, FontStyle.Strikeout | FontStyle.Italic);
                    }
                }
            }
            catch (Exception)
            {
                //What to doo
            }

            return(returnFont);
        }