コード例 #1
0
        protected void AdjustForLayoutCapabilities(PrintingOptions po)
        {
            if (po == null)
            {
                throw new ArgumentNullException(nameof(po));
            }
            PrintLayout pl = PrintLayout.LayoutForType(po.Layout);

            pnlIncludeImages.Visible = pl.SupportsImages;
            if (!pl.SupportsImages)
            {
                ckIncludeImages.Checked = m_options.IncludeImages = false;
            }
            pnlOptionalColumns.Visible = pl.SupportsOptionalColumns;
        }
コード例 #2
0
        public static PrintLayout LayoutLogbook(Profile pf, IList <LogbookEntryDisplay> lstFlights, IPrintingTemplate pt, PrintingOptions printingOptions, bool fSuppressFooter)
        {
            if (pf == null)
            {
                throw new ArgumentNullException(nameof(pf));
            }
            if (pt == null)
            {
                throw new ArgumentNullException(nameof(pt));
            }
            if (printingOptions == null)
            {
                throw new ArgumentNullException(nameof(printingOptions));
            }
            if (lstFlights == null)
            {
                throw new ArgumentNullException(nameof(lstFlights));
            }

            PrintLayout pl = PrintLayout.LayoutForType(printingOptions.Layout, pf);

            // Exclude both excluded properties and properties that have been moved to their own columns
            HashSet <int> lstPropsToExclude    = new HashSet <int>(printingOptions.ExcludedPropertyIDs);
            HashSet <int> lstPropsInOwnColumns = new HashSet <int>();

            foreach (OptionalColumn oc in printingOptions.OptionalColumns)
            {
                if (oc.ColumnType == OptionalColumnType.CustomProp)
                {
                    lstPropsInOwnColumns.Add(oc.IDPropType);
                }
            }
            string szPropSeparator = printingOptions.PropertySeparatorText;

            // set up properties per flight, and compute rough lineheight
            foreach (LogbookEntryDisplay led in lstFlights)
            {
                // Fix up properties according to the printing options
                List <CustomFlightProperty> lstProps = new List <CustomFlightProperty>(led.CustomProperties);

                // And fix up model as well.
                switch (printingOptions.DisplayMode)
                {
                case PrintingOptions.ModelDisplayMode.Full:
                    break;

                case PrintingOptions.ModelDisplayMode.Short:
                    led.ModelDisplay = led.ShortModelName;
                    break;

                case PrintingOptions.ModelDisplayMode.ICAO:
                    led.ModelDisplay = led.FamilyName;
                    break;
                }


                // Remove from the total property set all explicitly excluded properties...
                lstProps.RemoveAll(cfp => lstPropsToExclude.Contains(cfp.PropTypeID));

                // ...and then additionally exclude from the display any that's in its own column to avoid redundancy.
                lstProps.RemoveAll(cfp => lstPropsInOwnColumns.Contains(cfp.PropTypeID));
                led.CustPropertyDisplay = CustomFlightProperty.PropListDisplay(lstProps, pf.UsesHHMM, szPropSeparator);

                if (printingOptions.IncludeImages)
                {
                    led.PopulateImages(true);
                }

                if (!printingOptions.IncludeSignatures)
                {
                    led.CFISignatureState = LogbookEntryBase.SignatureState.None;
                }
                led.RowHeight = pl.RowHeight(led);
            }

            pt.BindPages(LogbookPrintedPage.Paginate(lstFlights, printingOptions), pf, printingOptions, !fSuppressFooter);

            return(pl);
        }