internal double GetHeightFor(PrintAppendixes printAppendix, int pageNumber, bool isLastPage)
 {
     if (InternalPrintDefinition.IsToPrint(printAppendix, pageNumber, isLastPage))
     {
         double?value = _printPartDimensions[printAppendix];
         if (!value.HasValue)
         {
             var uiElement = _printPartDimensionsRetrievalDictionary[printAppendix](PrintProcessor);
             if (uiElement == null)
             {
                 throw new ArgumentNullException($"{nameof(PrintProcessor)}.Get{printAppendix}()", $"{typeof(PrintProcessor)} must return a value for \"Get{printAppendix}()\" if \"{printAppendix}\" is set.");
             }
             uiElement.Measure(new Size(double.MaxValue, double.MaxValue));
             value = uiElement.DesiredSize.Height;
             _printPartDimensions[printAppendix] = value;
         }
         return(value.Value);
     }
     return(0);
 }
Beispiel #2
0
 internal double GetHeightFor(PrintAppendixes printAppendix, int pageNumber, bool isLastPage)
 {
     if (InternalPrintDefinition?.IsToPrint(printAppendix, pageNumber, isLastPage) == true)
     {
         double?value = _printPartDimensions[printAppendix];
         if (!value.HasValue && PrintProcessor != null)
         {
             var uiElement = _printPartDimensionsRetrievalDictionary[printAppendix](PrintProcessor);
             if (uiElement == null)
             {
                 throw new ArgumentNullException($"{nameof(PrintProcessor)}.Get{printAppendix}()", string.Format(l10n.PrintDimension_GetHeightFor__0__must_return_a_value_for__Get_1_____if___2___is_set_, typeof(PrintProcessor), printAppendix, printAppendix));
             }
             uiElement.Measure(new Size(double.MaxValue, double.MaxValue));
             value = uiElement.DesiredSize.Height;
             _printPartDimensions[printAppendix] = value;
         }
         return(value ?? 0);
     }
     return(0);
 }