GetValue() public method

Returns the computed value of Height * Depth on a scale of 11.
public GetValue ( double ratio ) : double?
ratio double Ratio between -1 and 1 representing the priority between Height and Depth. /// If Ratio is under 0, Height is prioritized. If Ratio is over 0, Depth is prioritized.
return double?
コード例 #1
0
 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);
 }
コード例 #2
0
        private void CreateToolTip(TextBlock ctrl, MediaRating rating) {
            if (rating.Height.HasValue || rating.Depth.HasValue) {
                ToolTip NewToolTip = new ToolTip();
                ctrl.ToolTip = NewToolTip;
                StackPanel NewPanel = new StackPanel();
                NewToolTip.Content = NewPanel;
                TextBlock NewTextBlock = new TextBlock();
                NewTextBlock.TextAlignment = TextAlignment.Center;
                NewPanel.Children.Add(NewTextBlock);

                if (rating.Height.HasValue) {
                    NewTextBlock.Inlines.Add(new Run("Height: " + rating.Height.Value));
                    NewTextBlock.Inlines.Add(new LineBreak());
                }
                if (rating.Depth.HasValue) {
                    NewTextBlock.Inlines.Add(new Run("Depth: " + rating.Depth.Value));
                    NewTextBlock.Inlines.Add(new LineBreak());
                }
                NewTextBlock.Inlines.Add(new Run(string.Format("{0} × {1} × 0.11 = {2:0.0}",
                    rating.Height.HasValue ? rating.Height.Value : rating.Depth.Value,
                    rating.Depth.HasValue ? rating.Depth.Value : rating.Height.Value,
                    rating.GetValue(0))));
            } else
                ctrl.ToolTip = null;
        }