protected PrintPartDefinitionAttribute(PrintAppendixes printAppendixes, Range <int> pages)
            : this(printAppendixes)
        {
            Debug.WriteLine($"PrintRange: {printAppendixes} {pages}", "PrintOnPageAttribute");

            AddRange(pages);
        }
Ejemplo n.º 2
0
        public PrintPartStatus IsPrintOnPage(PrintAppendixes printA, int page)
        {
            if (page <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(page));
            }

            var printOnPageAttributes = GetPossiblePrintDefinitionAttributes(printA).ToList();

            if (!printOnPageAttributes.Any())
            {
                return(PrintPartStatus.NotDefined);
            }

            var list = printOnPageAttributes.Select(printOnAttribute => printOnAttribute.GetPrintDefinition(page)).ToList();

            var excludedOnAny = list.Any(i => i == PrintPartStatus.Exclude);

            if (excludedOnAny)
            {
                return(PrintPartStatus.Exclude);
            }

            var includedOnAny = list.Any(i => i == PrintPartStatus.Include);

            if (includedOnAny)
            {
                return(PrintPartStatus.Include);
            }

            return(PrintPartStatus.NotDefined);
        }
        protected PrintPartDefinitionAttribute(PrintAppendixes printAppendixes, params int[] definedPages)
        {
            PrintAppendixes = printAppendixes;

            var ranges = definedPages.Select(e => PageRange.FromPoint(e)).ToArray();

            AddRange(ranges);
        }
Ejemplo n.º 4
0
        public Printer(PrintAppendixes printingAppendix, IEnumerable<MyShownObject> collToPrint)
        {
            _printingAppendix = printingAppendix;
            _collToPrint = collToPrint;

            FileName = "FileName";
            PrintDimension = _printDimensions;
        }
Ejemplo n.º 5
0
 /// <summary>
 ///     Checks whether the passed <see cref="PrintAppendixes" /> value is set as valid
 ///     <see
 ///         cref="PrintAppendixes" />
 ///     for printing
 /// </summary>
 /// <returns>
 ///     True if the passed <see cref="PrintAppendixes" /> is set, false otherwise.
 /// </returns>
 private PrintPartStatus GetPrintPrintDefinitionForPage(PrintAppendixes pa, int pageNumber)
 {
     if (!Enum.IsDefined(typeof(PrintAppendixes), pa))
     {
         throw new ArgumentException(nameof(pa));
     }
     return(_prinOnAttributeHelper.IsPrintOnPage(pa, pageNumber));
 }
 /// <summary>
 ///     Checks whether the passed <see cref="PrintAppendixes" /> value is set as valid
 ///     <see
 ///         cref="PrintAppendixes" />
 ///     for printing
 /// </summary>
 /// <returns>
 ///     True if the passed <see cref="PrintAppendixes" /> is set, false otherwise.
 /// </returns>
 private PrintPartStatus GetPrintPrintDefinitionForPage(PrintAppendixes pa, int pageNumber)
 {
     if (!Enum.IsDefined(typeof(PrintAppendixes), pa))
     {
         throw new ArgumentException($"Enum value {pa} is not defined on enum {typeof(PrintAppendixes).FullName}", nameof(pa));
     }
     return(_printOnAttributeHelper.IsPrintOnPage(pa, pageNumber));
 }
Ejemplo n.º 7
0
        public Printer(PrintAppendixes printingAppendix, IEnumerable <MyShownObject> collToPrint)
        {
            _printingAppendix = printingAppendix;
            _collToPrint      = collToPrint;

            FileName       = "FileName";
            PrintDimension = _printDimensions;
        }
Ejemplo n.º 8
0
 /// <summary>
 ///     Checks whether the passed <see cref="PrintAppendixes" /> value is set as valid
 ///     <see
 ///         cref="PrintAppendixes" />
 ///     for printing
 /// </summary>
 /// <returns>
 ///     True if the passed <see cref="PrintAppendixes" /> is set, false otherwise.
 /// </returns>
 private PrintPartStatus GetPrintPrintDefinitionForPage(PrintAppendixes pa, int pageNumber)
 {
     if (!Enum.IsDefined(typeof(PrintAppendixes), pa))
     {
         throw new ArgumentException(nameof(pa));
     }
     return _prinOnAttributeHelper.IsPrintOnPage(pa, pageNumber);
 }
 protected PrintPartDefinitionAttribute(PrintAppendixes printAppendixes, params int[] definedPages)
 {
     PrintAppendixes = printAppendixes;
     if (definedPages != null)
     {
         var ranges = definedPages.Select(Range.FromPoint).ToArray();
         AddRange(ranges);
     }
 }
Ejemplo n.º 10
0
 protected PrintPartDefinitionAttribute(PrintAppendixes printAppendixes, params int[] definedPages)
 {
     PrintAppendixes = printAppendixes;
     if (definedPages != null)
     {
         var ranges = definedPages.Select(Range.FromPoint).ToArray();
         AddRange(ranges);
     }
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Sets the height for <paramref name="printAppendix"/> to a specific value
 /// </summary>
 /// <param name="printAppendix">The <see cref="PrintAppendixes"/> which the height is set.</param>
 /// <param name="value">The height for the item.</param>
 /// <exception cref="ArgumentOutOfRangeException"><paramref name="value"/> is negative.</exception>
 public void SetHeightValue(PrintAppendixes printAppendix, double?value)
 {
     if (value < 0)
     {
         throw new ArgumentOutOfRangeException(nameof(value), value, l10n.PrintDimension_SetHeightValue_Must_be_a_positive_number_or_null);
     }
     if (_printPartDimensions.ContainsKey(printAppendix))
     {
         _printPartDimensions[printAppendix] = value;
     }
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Recalculates the height for <paramref name="printAppendix"/> when the specific <paramref name="condition"/> is met.
 /// </summary>
 /// <param name="condition">The condition when to reset the height for <paramref name="printAppendix"/></param>
 /// <param name="printAppendix">The <see cref="PrintAppendixes"/> whichs value is reset.</param>
 /// <exception cref="ArgumentNullException"><paramref name="condition"/> is null.</exception>
 public void RecalculateHeightValueWhen(Func <bool> condition, PrintAppendixes printAppendix)
 {
     if (condition == null)
     {
         throw new ArgumentNullException(nameof(condition));
     }
     if (condition())
     {
         SetHeightValue(printAppendix, null);
     }
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Sets the height for <paramref name="printAppendix"/> to a specific value
 /// </summary>
 /// <param name="printAppendix">The <see cref="PrintAppendixes"/> whichs the heigth is set.</param>
 /// <param name="value">The height for the item.</param>
 /// <exception cref="ArgumentOutOfRangeException"><paramref name="value"/> is negative.</exception>
 public void SetHeightValue(PrintAppendixes printAppendix, double?value)
 {
     if (value < 0)
     {
         throw new ArgumentOutOfRangeException(nameof(value), value, "Must be a positive number or null");
     }
     if (_printPartDimensions.ContainsKey(printAppendix))
     {
         _printPartDimensions[printAppendix] = value;
     }
 }
        private PrintPartStatus IsPrintPartToPrintOnLastPage(PrintAppendixes pa, int page)
        {
            var printOnLastPage = GetPrintPrintDefinitionForPage(pa, PrintPartDefinitionAttribute.LastPage);

            if (printOnLastPage == PrintPartStatus.NotDefined)
            {
                return(GetPrintPrintDefinitionForPage(pa, page));
            }

            return(printOnLastPage);
        }
        protected PrintPartDefinitionAttribute(PrintAppendixes printAppendixes, params int[] definedPages)
        {
            if (definedPages == null)
            {
                throw new ArgumentNullException(nameof(definedPages));
            }

            PrintAppendixes = printAppendixes;

            var ranges = definedPages.Select <int, Range <int> >(Range.FromPoint).ToArray();

            AddRange(ranges);
        }
        private void PositionizeUiElement(PageContent pageContent, UIElement panel, PrintAppendixes printAppendix, int pageNumber, bool isLastPage)
        {
            var positioninRange = _printProcessor.PrintDimension.GetRangeFor(printAppendix, pageNumber, isLastPage);
            var position        = new Point(_printProcessor.PrintDimension.Margin.Left, positioninRange.From);

            var contentControl = new ContentControl
            {
                Width = _printProcessor.PrintDimension.PrintablePageSize.Width
            };

            if (_printProcessor.ColorPrintPartsForDebug)
            {
                contentControl.Content = new Grid
                {
                    Background = ComputeBackGround(printAppendix),
                    Children   =
                    {
                        new Rectangle
                        {
                            StrokeDashArray = new DoubleCollection(new double[]
                            {
                                20,
                                20
                            }),
                            Stroke          = Brushes.Black,
                            StrokeThickness = 2d
                        },
                        new TextBlock
                        {
                            Text                = printAppendix.ToString(),
                            FontSize            = 48d,
                            Opacity             = 0.5d,
                            HorizontalAlignment = HorizontalAlignment.Center,
                            VerticalAlignment   = VerticalAlignment.Center
                        },
                        panel
                    }
                };
            }
            else
            {
                contentControl.Content = panel;
            }

            PositionizeUiElement(pageContent, contentControl, position);
        }
Ejemplo n.º 17
0
        private PrintPartStatus GetPrintPrintDefinitionForPage(PrintAppendixes pa, int pageNumber, bool isLastPage)
        {
            PrintPartStatus result;

            if (isLastPage && (pageNumber == PrintPartDefinitionAttribute.FirstPage))
            {
                result = GetPrintPrintDefinitionForPage(pa, pageNumber) & IsPrintPartToPrintOnLastPage(pa, pageNumber);
            }
            else if (isLastPage)
            {
                result = IsPrintPartToPrintOnLastPage(pa, pageNumber);
            }
            else
            {
                result = GetPrintPrintDefinitionForPage(pa, pageNumber);
            }

            Debug.WriteLine($"{pa,-20}| {result,-12}| {(isLastPage ? "last page" : $"page {pageNumber}")}");
Ejemplo n.º 18
0
        private PrintPartStatus GetPrintPrintDefinitionForPage(PrintAppendixes pa, int pageNumber, bool isLastPage)
        {
            PrintPartStatus result;

            if (isLastPage && (pageNumber == PrintPartDefinitionAttribute.FirstPage))
            {
                result = GetPrintPrintDefinitionForPage(pa, pageNumber) & IsPrintPartToPrintOnLastPage(pa, pageNumber);
            }
            else if (isLastPage)
            {
                result = IsPrintPartToPrintOnLastPage(pa, pageNumber);
            }
            else
            {
                result = GetPrintPrintDefinitionForPage(pa, pageNumber);
            }

            Debug.WriteLine($"{pa,-20}| {result,-12}| {(isLastPage ? "last page" : $"page {pageNumber}")}");
        private void PositionizeUiElement(PageContent pageContent, UIElement panel, PrintAppendixes printAppendix, int pageNumber, bool isLastPage)
        {
            var positioninRange = _printProcessor.PrintDimension.GetRange(printAppendix, pageNumber, isLastPage);
            var position        = new Point(_printProcessor.PrintDimension.Margin.Left, positioninRange.From);

            var panelHeight = positioninRange.Length;

            var contentControl = new ContentControl {
                Height = panelHeight, Width = _printProcessor.PrintDimension.PrintablePageSize.Width
            };

            if (_printProcessor.ColorPrintPartsForDebug)
            {
                var grid      = new Grid();
                var rectangle = new Rectangle
                {
                    StrokeDashArray = new DoubleCollection(new double[]
                    {
                        20,
                        20
                    }),
                    Stroke          = Brushes.Black,
                    StrokeThickness = 2d
                };

                var textBlock = new TextBlock {
                    Text = printAppendix.ToString(), FontSize = 48d, Opacity = 0.5d, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center
                };

                grid.Children.Add(panel);
                grid.Children.Add(textBlock);
                grid.Children.Add(rectangle);

                contentControl.Content = grid;
            }
            else
            {
                contentControl.Content = panel;
            }

            PositionizeUiElement(pageContent, contentControl, position);
        }
Ejemplo n.º 20
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);
 }
Ejemplo n.º 21
0
 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);
 }
        private PrintAppendixes PrintAppendixes()
        {
            PrintAppendixes pa = Definition.PrintAppendixes.PageNumbers;

            if (_mcv.PrintParts.PrintFooter)
            {
                pa = pa | Definition.PrintAppendixes.Footer;
            }
            if (_mcv.PrintParts.PrintHeader)
            {
                pa = pa | Definition.PrintAppendixes.Header;
            }
            if (_mcv.PrintParts.PrintHeaderDesription)
            {
                pa = pa | Definition.PrintAppendixes.HeaderDescription;
            }
            if (_mcv.PrintParts.PrintSummary)
            {
                pa = pa | Definition.PrintAppendixes.Summary;
            }
            return(pa);
        }
Ejemplo n.º 23
0
        public PrintPartStatus IsPrintOnPage(PrintAppendixes printA, int page)
        {
            if (page <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(page));
            }

            var printOnPageAttributes = _printOnAttributes.Where(v => v.PrintAppendixes.HasFlag(printA)).ToArray();

            if (printOnPageAttributes.Length == 0)
            {
                if (!_printedWarnings.Contains(printA))
                {
                    _printedWarnings.Add(printA);
                    Trace.TraceWarning("The {0}-Attribute is not defined as PrintOnPageAttribute on Your PrintProcessor. Remove {0} as PrintAppendix or add it as PrintOnPageAttribute", printA);
                }

                return(PrintPartStatus.NotDefined);
            }

            var list = printOnPageAttributes.Select(printOnAttribute => printOnAttribute.GetPrintDefinition(page)).ToList();

            var excludedOnAny = list.Any(i => i == PrintPartStatus.Exclude);

            if (excludedOnAny)
            {
                return(PrintPartStatus.Exclude);
            }

            var includedOnAny = list.Any(i => i == PrintPartStatus.Include);

            if (includedOnAny)
            {
                return(PrintPartStatus.Include);
            }

            return(PrintPartStatus.NotDefined);
        }
        public PrintPartStatus IsPrintOnPage(PrintAppendixes printA, int page)
        {
            if (page <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(page));
            }

            var printOnPageAttributes = GetPossiblePrintDefinitionAttributes(printA).ToList();

            if (!printOnPageAttributes.Any())
            {
                if (!_printedWarnings.Contains(printA))
                {
                    _printedWarnings.Add(printA);
                    Debug.WriteLine("PRINTING: The {0}-Attribute is not defined as PrintOnPageAttribute on Your PrintProcessor. Remove {0} as PrintAppendix or add it as PrintOnPageAttribute", printA);
                }

                return(PrintPartStatus.NotDefined);
            }

            var list = printOnPageAttributes.Select(printOnAttribute => printOnAttribute.GetPrintDefinition(page)).ToList();

            var excludedOnAny = list.Any(i => i == PrintPartStatus.Exclude);

            if (excludedOnAny)
            {
                return(PrintPartStatus.Exclude);
            }

            var includedOnAny = list.Any(i => i == PrintPartStatus.Include);

            if (includedOnAny)
            {
                return(PrintPartStatus.Include);
            }

            return(PrintPartStatus.NotDefined);
        }
Ejemplo n.º 25
0
        internal Range <double> GetRange(PrintAppendixes printAppendix, int pageNumber, bool isLastPage)
        {
            switch (printAppendix)
            {
            case PrintAppendixes.Header:
                return(GetHeaderRange(pageNumber, isLastPage));

            case PrintAppendixes.Footer:
                return(GetFooterRange(pageNumber, isLastPage));

            case PrintAppendixes.Summary:
                return(GetSummaryRange(pageNumber, isLastPage));

            case PrintAppendixes.HeaderDescription:
                return(GetHeaderDescriptionRange(pageNumber, isLastPage));

            case PrintAppendixes.PageNumbers:
                return(GetPageNumberRange(pageNumber, isLastPage));

            default:
                throw new ArgumentOutOfRangeException(nameof(printAppendix));
            }
        }
        private PrintPartStatus GetPrintPrintDefinitionForPage(PrintAppendixes pa, int pageNumber, bool isLastPage)
        {
            PrintPartStatus result;

            if (isLastPage && (pageNumber == PrintPartDefinitionAttribute.FirstPage))
            {
                result = GetPrintPrintDefinitionForPage(pa, pageNumber) & IsPrintPartToPrintOnLastPage(pa, pageNumber);
            }
            else if (isLastPage)
            {
                result = IsPrintPartToPrintOnLastPage(pa, pageNumber);
            }
            else
            {
                result = GetPrintPrintDefinitionForPage(pa, pageNumber);
            }

            Debug.WriteLineIf(result == PrintPartStatus.NotDefined, pa + " not defined on page " + pageNumber + " (lastpage=" + isLastPage + ")");
            Debug.WriteLineIf(result == PrintPartStatus.Include, pa + " included on page " + pageNumber + " (lastpage=" + isLastPage + ")");
            Debug.WriteLineIf(result == PrintPartStatus.Exclude, pa + " excluded on page " + pageNumber + " (lastpage=" + isLastPage + ")");

            return(result);
        }
Ejemplo n.º 27
0
        /// <summary>
        ///     Gets the range from which point the <paramref name="printAppendix" /> starts and where it ends.
        ///     The layout of the page is constructed as follows:
        ///     <list type="bullet">
        ///         <item>
        ///             <see cref="IPrintProcessor.GetHeader">Header</see>
        ///         </item>
        ///         <item>
        ///             <see cref="IPrintProcessor.GetHeaderDescription">HeaderDescription</see>
        ///         </item>
        ///         <item>
        ///             <see cref="IPrintProcessor.ItemCollection">Body Grid</see>
        ///         </item>
        ///         <item>
        ///             <see cref="IPrintProcessor.GetSummary">Summary</see>
        ///         </item>
        ///         <item>
        ///             <see cref="IPrintProcessor.GetFooter">Footer</see>
        ///         </item>
        ///         <item>Page numbers</item>
        ///     </list>
        /// </summary>
        /// <param name="printAppendix"></param>
        /// <param name="pageNumber"></param>
        /// <param name="isLastPage"></param>
        /// <returns></returns>
        internal Range <double> GetRangeFor(PrintAppendixes printAppendix, int pageNumber, bool isLastPage)
        {
            double fromValue;
            double height;

            switch (printAppendix)
            {
            case PrintAppendixes.Header:
                fromValue = Margin.Top;
                height    = GetHeightFor(printAppendix, pageNumber, isLastPage);
                break;

            case PrintAppendixes.HeaderDescription:
                fromValue = GetRangeFor(PrintAppendixes.Header, pageNumber, isLastPage).To;
                height    = GetHeightFor(printAppendix, pageNumber, isLastPage);
                break;

            case PrintAppendixes.Summary:
                fromValue = GetRangeFor(PrintAppendixes.HeaderDescription, pageNumber, isLastPage).To + GetHeightForBodyGrid(pageNumber, isLastPage);
                height    = GetHeightFor(printAppendix, pageNumber, isLastPage);
                break;

            case PrintAppendixes.Footer:
                fromValue = GetRangeFor(PrintAppendixes.Summary, pageNumber, isLastPage).To;
                height    = GetHeightFor(printAppendix, pageNumber, isLastPage);
                break;

            case PrintAppendixes.PageNumbers:
                fromValue = GetRangeFor(PrintAppendixes.Footer, pageNumber, isLastPage).To;
                height    = GetHeightFor(printAppendix, pageNumber, isLastPage);
                break;

            default:
                throw new ArgumentException(nameof(printAppendix));
            }
            return(new Range <double>(fromValue, fromValue + height));
        }
Ejemplo n.º 28
0
        /// <summary>
        ///     Gets the range from which point the <paramref name="printAppendix" /> starts and where it ends.
        ///     The layout of the page is constructed as follows:
        ///     <list type="bullet">
        ///         <item>
        ///             <see cref="IPrintProcessor.GetHeader">Header</see>
        ///         </item>
        ///         <item>
        ///             <see cref="IPrintProcessor.GetHeaderDescription">HeaderDescription</see>
        ///         </item>
        ///         <item>
        ///             <see cref="IPrintProcessor.ItemCollection">Body Grid</see>
        ///         </item>
        ///         <item>
        ///             <see cref="IPrintProcessor.GetSummary">Summary</see>
        ///         </item>
        ///         <item>
        ///             <see cref="IPrintProcessor.GetFooter">Footer</see>
        ///         </item>
        ///         <item>Page numbers</item>
        ///     </list>
        /// </summary>
        /// <param name="printAppendix"></param>
        /// <param name="pageNumber"></param>
        /// <param name="isLastPage"></param>
        /// <returns></returns>
        internal PageRange GetRangeFor(PrintAppendixes printAppendix, int pageNumber, bool isLastPage)
        {
            double fromValue;
            double height;

            switch (printAppendix)
            {
            case PrintAppendixes.Header:
                fromValue = Margin.Top;
                height    = GetHeightFor(printAppendix, pageNumber, isLastPage);
                break;

            case PrintAppendixes.HeaderDescription:
                fromValue = GetRangeFor(PrintAppendixes.Header, pageNumber, isLastPage).To;
                height    = GetHeightFor(printAppendix, pageNumber, isLastPage);
                break;

            case PrintAppendixes.Summary:
                fromValue = GetRangeFor(PrintAppendixes.HeaderDescription, pageNumber, isLastPage).To + GetHeightForBodyGrid(pageNumber, isLastPage);
                height    = GetHeightFor(printAppendix, pageNumber, isLastPage);
                break;

            case PrintAppendixes.Footer:
                fromValue = GetRangeFor(PrintAppendixes.Summary, pageNumber, isLastPage).To;
                height    = GetHeightFor(printAppendix, pageNumber, isLastPage);
                break;

            case PrintAppendixes.PageNumbers:
                fromValue = GetRangeFor(PrintAppendixes.Footer, pageNumber, isLastPage).To;
                height    = GetHeightFor(printAppendix, pageNumber, isLastPage);
                break;

            default:
                throw new ArgumentException($"Enum value {printAppendix} is not defined on enum {typeof(PrintAppendixes).FullName}", nameof(printAppendix));
            }
            return(new PageRange(fromValue, fromValue + height));
        }
 /// <summary>
 ///     Initializes a new instance of the <see cref="PrintOnPageAttribute" /> class regarding the specified single page and
 ///     print parts
 /// </summary>
 /// <param name="printAppendixes">The print parts that are defined by this attribute.</param>
 /// <param name="singlePage">The page where the print parts is defined.</param>
 public PrintOnPageAttribute(PrintAppendixes printAppendixes, int singlePage)
     : base(printAppendixes, singlePage)
 {
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="PrintOnPageAttribute" /> class regarding the specified pages and print
 ///     parts
 /// </summary>
 /// <param name="printAppendixes">The print parts that are defined by this attribute.</param>
 /// <param name="definedPages">The pages  where the print parts are defined.</param>
 public PrintOnPageAttribute(PrintAppendixes printAppendixes, params int[] definedPages)
     : base(printAppendixes, definedPages)
 {
 }
 private PrintPartDefinitionAttribute(PrintAppendixes printAppendixes, int firstPage, int lastPage)
     : this(printAppendixes, new Range<int>(firstPage, lastPage))
 {
 }
Ejemplo n.º 32
0
 public bool IsToPrint(PrintAppendixes pa, int pageNumber, bool isLastPage)
 {
     return(GetPrintPrintDefinitionForPage(pa, pageNumber, isLastPage) == PrintPartStatus.Include);
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="ExcludeFromAllPagesAttribute" /> class regarding the specified range
 ///     and print parts
 /// </summary>
 /// <param name="printAppendixes">The print parts that are defined by this attribute.</param>
 public ExcludeFromAllPagesAttribute(PrintAppendixes printAppendixes)
     : base(printAppendixes, new Range<int>(FirstPage, LastPage))
 {
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="ExcludeFromPageAttribute" /> class regarding the specified pages and
 ///     print parts
 /// </summary>
 /// <param name="printAppendixes">The print parts that are defined by this attribute.</param>
 /// <param name="definedPages">The pages where the print parts are not defined.</param>
 public ExcludeFromPageAttribute(PrintAppendixes printAppendixes, params int[] definedPages)
     : base(printAppendixes, definedPages)
 {
 }
 protected PrintPartDefinitionAttribute(PrintAppendixes printAppendixes, Range<int> pages)
     : this(printAppendixes)
 {
     AddRange(pages);
 }
Ejemplo n.º 36
0
 public bool IsToPrint(PrintAppendixes pa, int pageNumber, bool isLastPage)
 {
     return GetPrintPrintDefinitionForPage(pa, pageNumber, isLastPage) == PrintPartStatus.Include;
 }
Ejemplo n.º 37
0
 public bool IsDefined(PrintAppendixes value)
 {
     return _prinOnAttributeHelper.IsDefined(value);
 }
 protected PrintPartDefinitionAttribute(PrintAppendixes printAppendixes, int singlePage)
     : this(printAppendixes, singlePage, singlePage)
 {
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="PrintOnPageAttribute" /> class regarding the specified range and print
 ///     parts
 /// </summary>
 /// <param name="printAppendixes">The print parts that are defined by this attribute.</param>
 /// <param name="pages">The page range where the print parts are defined</param>
 public PrintOnPageAttribute(PrintAppendixes printAppendixes, Range<int> pages)
     : base(printAppendixes, pages)
 {
 }
Ejemplo n.º 40
0
 public bool IsDefined(PrintAppendixes value)
 {
     return(_prinOnAttributeHelper.IsDefined(value));
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="ExcludeFromPageAttribute" /> class regarding the specified single page
 ///     and print parts
 /// </summary>
 /// <param name="printAppendixes">The print parts that are defined by this attribute.</param>
 /// <param name="singlePage">The page where the print parts is not defined.</param>
 public ExcludeFromPageAttribute(PrintAppendixes printAppendixes, int singlePage)
     : base(printAppendixes, singlePage)
 {
 }
 public ExludeHeaderOnPageTwo(PrintAppendixes printingAppendix, IEnumerable<MyShownObject> collToPrint)
     : base(printingAppendix, collToPrint)
 {
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="PrintOnPageAttribute" /> class regarding the specified single page and
 ///     print parts
 /// </summary>
 /// <param name="printAppendixes">The print parts that are defined by this attribute.</param>
 /// <param name="singlePage">The page where the print parts is defined.</param>
 public PrintOnPageAttribute(PrintAppendixes printAppendixes, int singlePage)
     : base(printAppendixes, singlePage)
 {
 }
        private void AddSpecialElement(bool isLastpage, int pageNumber, PageContent pageContent, PrintAppendixes appendix, Func <UIElement> printElement)
        {
            if (printElement == null)
            {
                throw new ArgumentNullException(nameof(printElement));
            }
            if (!_printProcessor.PrintDefinition.IsToPrint(appendix, pageNumber, isLastpage))
            {
                return;
            }

            var elementToPrint = printElement();

            if (elementToPrint == null)
            {
                throw new InvalidOperationException($"The {appendix} cannot be null if the corresponding flag in the PrintAppendix is set");
            }

            Debug.WriteLine($"PRINTING: Print {appendix} desciption on page #{pageNumber} ");
            PositionizeUiElement(pageContent, elementToPrint, appendix, pageNumber, isLastpage);
        }
 /// <summary>
 ///     Initializes a new instance of the <see cref="PrintOnPageAttribute" /> class regarding the specified pages and print
 ///     parts
 /// </summary>
 /// <param name="printAppendixes">The print parts that are defined by this attribute.</param>
 /// <param name="definedPages">The pages  where the print parts are defined.</param>
 public PrintOnPageAttribute(PrintAppendixes printAppendixes, params int[] definedPages)
     : base(printAppendixes, definedPages)
 {
 }
        private static Brush ComputeBackGround(PrintAppendixes printAppendix)
        {
            var factor = (byte)(byte.MaxValue - (byte)((byte.MaxValue / (byte)Enum.GetValues(typeof(PrintAppendixes)).Length) * (byte)printAppendix));

            return(new SolidColorBrush(Color.FromArgb(128, factor, factor, factor)));
        }
 /// <summary>
 ///     Initializes a new instance of the <see cref="ExcludeFromPageAttribute" /> class regarding the specified range and
 ///     print parts
 /// </summary>
 /// <param name="printAppendixes">The print parts that are defined by this attribute.</param>
 /// <param name="pages">The page range where the print parts are not defined</param>
 public ExcludeFromPageAttribute(PrintAppendixes printAppendixes, Range<int> pages)
     : base(printAppendixes, pages)
 {
 }