private void RefreshView()
        {
            labelTitle.Text  = module.Name;
            labelStatus.Text = module.GetStatusText();
            //
            var hsbParameter = module.GetProperty("Status.ColorHsb");

            if (hsbParameter != null)
            {
                string[] hsbValues = hsbParameter.Value.Split(',');
                double   h = 0, s = 0, v = 0;
                double.TryParse(hsbValues[0], System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.InvariantCulture, out h);
                double.TryParse(hsbValues[1], System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.InvariantCulture, out s);
                double.TryParse(hsbValues[2], System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.InvariantCulture, out v);
                levelControlSlider.Level      = (s == 1 ? v / 2D : (1D - (s / 2D)));
                levelControlSlider.LevelColor = UiHelper.HsvToRgb(h, 1, 1);
            }
            module.GetImage((img) =>
            {
                UiHelper.SafeInvoke(pictureBoxIcon, () =>
                {
                    this.pictureBoxIcon.Image = UiHelper.ImageFromBytes(img);
                });
            });
        }
Esempio n. 2
0
 private void RefreshView()
 {
     labelTitle.Text          = module.Name;
     labelStatus.Text         = module.GetStatusText();
     levelControlSlider.Level = module.GetLevel();
     module.GetImage((img) =>
     {
         UiHelper.SafeInvoke(pictureBoxIcon, () => {
             this.pictureBoxIcon.Image = UiHelper.ImageFromBytes(img);
         });
     });
 }
Esempio n. 3
0
        private void RefreshView()
        {
            //labelTitle.Text = module.Name;
            //labelStatus.Text = module.GetStatusText();

            var location = module.GetProperty("Conditions.DisplayLocation");

            if (location != null)
            {
                labelLocation.Text = location.Value;
            }

            var conditions = module.GetProperty("Conditions.Description");

            if (conditions != null)
            {
                labelConditions.Text = conditions.Value;
            }

            var temperature = "";
            var feelslikeC  = module.GetProperty("Conditions.FeelsLikeC");

            if (feelslikeC != null)
            {
                temperature = "  " + feelslikeC.Value + "°C  ";
            }
            var feelslikeF = module.GetProperty("Conditions.FeelsLikeF");

            if (feelslikeF != null)
            {
                temperature += "  " + feelslikeF.Value + "°F  ";
            }
            labelTemperature.Text = temperature;

            var imageUrl = module.GetProperty("Conditions.IconUrl");

            if (imageUrl != null)
            {
                Utility.DownloadImage(imageUrl.Value, new NetworkCredential(), (img) => {
                    this.pictureBoxIcon.Image = UiHelper.ImageFromBytes(img);
                });
            }
        }