public static void DisplayValue(TextBlock obj, MediaRating rating, double ratio) { RatingConverter Conv = new RatingConverter(); RatingToColorConverter ColorConv = new RatingToColorConverter(); double?Value = rating.GetValue(ratio); obj.Text = Conv.Convert(Value, typeof(string), -1, null).ToString(); obj.Foreground = (SolidColorBrush)ColorConv.Convert(Value, typeof(SolidColorBrush), null, null); }
private void DisplayData() { DisplayValue(PMText, business.PM, Ratio); DisplayValue(PFText, business.PF, Ratio); DisplayValue(EMText, business.EM, Ratio); DisplayValue(EFText, business.EF, Ratio); DisplayValue(SMText, business.SM, Ratio); DisplayValue(SFText, business.SF, Ratio); DisplayValue(LoveText, business.Love, Ratio); DisplayValue(EgolessText, business.Egoless, Ratio); DisplayValue(Custom1Text, business.Custom1, Ratio); DisplayValue(Custom2Text, business.Custom2, Ratio); // Display intensity. RatingConverter Conv = new RatingConverter(); RatingToColorConverter ColorConv = new RatingToColorConverter(); double?IntensityValue = business.GetIntensity(); IntensityText.Text = Conv.Convert(IntensityValue, typeof(string), null, null).ToString(); IntensityText.Foreground = (SolidColorBrush)ColorConv.Convert(IntensityValue, typeof(SolidColorBrush), null, null); }