private void levelControlSlider_LevelChanged(object sender, double level) { dynamic hsv = UiHelper.RgbToHsv(levelControlSlider.LevelColor); if (level <= 0.5) { hsv.V = level * 2F; hsv.S = 1F; } else { hsv.V = 1F; hsv.S = (1F - ((level - 0.5F) * 2F)); } string command = "Control.ColorHsb/" + (hsv.H).ToString(System.Globalization.CultureInfo.InvariantCulture) + "," + (hsv.S).ToString(System.Globalization.CultureInfo.InvariantCulture) + "," + (hsv.V).ToString(System.Globalization.CultureInfo.InvariantCulture); module.ExecuteCommand(command); }
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); }); } }
public override void Refresh() { UiHelper.SafeInvoke(this, () => { RefreshView(); }); }