void UpdateDisplay(EvCapability parameter) { if (parameter == null || parameter.Candidate == null) { return; } Slider.Minimum = parameter.Candidate.MinIndex; Slider.Maximum = parameter.Candidate.MaxIndex; if (parameter.CurrentIndex < parameter.Candidate.MinIndex || parameter.CurrentIndex > parameter.Candidate.MaxIndex) { return; } Slider.Value = parameter.CurrentIndex; var max = EvConverter.GetEv(parameter.Candidate.MaxIndex, parameter.Candidate.IndexStep); MaxLabel.Text = Math.Round(max, 1, MidpointRounding.AwayFromZero).ToString("0.0"); var min = EvConverter.GetEv(parameter.Candidate.MinIndex, parameter.Candidate.IndexStep); MinLabel.Text = Math.Round(min, 1, MidpointRounding.AwayFromZero).ToString("0.0"); var center = EvConverter.GetEv(0, parameter.Candidate.IndexStep); CenterLabel.Text = Math.Round(center, 1, MidpointRounding.AwayFromZero).ToString("0.0"); }
void UpdateDisplay(EvCapability parameter) { if (parameter == null || parameter.Candidate == null) { return; } Slider.Minimum = parameter.Candidate.MinIndex; Slider.Maximum = parameter.Candidate.MaxIndex; if (parameter.CurrentIndex < parameter.Candidate.MinIndex || parameter.CurrentIndex > parameter.Candidate.MaxIndex) { return; } Slider.Value = parameter.CurrentIndex; var max = EvConverter.GetEv(parameter.Candidate.MaxIndex, parameter.Candidate.IndexStep); MaxLabel.Text = Math.Round(max, 1, MidpointRounding.AwayFromZero).ToString("0.0"); var min = EvConverter.GetEv(parameter.Candidate.MinIndex, parameter.Candidate.IndexStep); MinLabel.Text = Math.Round(min, 1, MidpointRounding.AwayFromZero).ToString("0.0"); var center = EvConverter.GetEv(0, parameter.Candidate.IndexStep); CenterLabel.Text = Math.Round(center, 1, MidpointRounding.AwayFromZero).ToString("0.0"); var labels = new Dictionary <int, string>(); double unit = parameter.Candidate.IndexStep == EvStepDefinition.EV_1_3 ? 1.0 / 3.0 : 0.5; for (int i = parameter.Candidate.MinIndex; i <= parameter.Candidate.MaxIndex; i++) { var value = EvConverter.GetEv(i, parameter.Candidate.IndexStep); var strValue = Math.Round(value, 1, MidpointRounding.AwayFromZero).ToString("0.0"); if (value < 0) { strValue = "EV " + strValue; } else if (value == 0.0f) { strValue = "EV " + strValue; } else { strValue = "EV +" + strValue; } labels.Add(i, strValue); } Slider.ThumbToolTipValueConverter = new EvValueConverter() { Labels = labels }; }
private static string FromExposureCompensation(int index, EvStepDefinition def) { var value = EvConverter.GetEv(index, def); var strValue = Math.Round(value, 1, MidpointRounding.AwayFromZero).ToString("0.0"); if (value <= 0) { return("EV " + strValue); } else { return("EV +" + strValue); } }