protected APrintControlViewModel(PrintControlView view) : base(view) { PrintControlView = view; PrintControlView.Loaded += PrintControlViewLoaded; _oldPrintingOptions = new PrintingOptions(); _newPrintingOptions = new PrintingOptions(); WaitScreen = new WaitScreenViewModel(new WaitScreenView()); PrintUtility = new PrintUtility(); CancelPrintCommand = new DelegateCommand(ExecuteCancelPrint); PrintDocumentCommand = new DelegateCommand(ExecutePrint); PageOrientationCommand = new DelegateCommand(ExecutePageOrientation); SetPrintingOptionsCommand = new DelegateCommand(ExecuteSetPrintingOptions); CancelPrintingOptionsCommand = new DelegateCommand(ExecuteCancelPrintingOptions); MarkPageNumbersCommand = new DelegateCommand(ExecuteMarkPageNumbers); AllPagesCommand = new DelegateCommand(ExecuteAllPages); ActualPageSizeCommand = new DelegateCommand(ExecuteActualPageSizeCommand); ChangePaperCommand = new DelegateCommand(ExecuteChangePaper); }
public void WhenToStringCalled_ThenReturnFormattedString( string printerName, string filePath, string pages, uint?copies, string focus, string expected) { var options = new PrintingOptions(printerName, filePath) { Copies = copies, Focus = focus, Pages = pages }; string result = options.ToString(); Assert.AreEqual(expected, result); }
protected APrintControlViewModel(PrintControlView view, IUnityContainer unityContainer) : base(view) { PrintControlView = view; PrintControlView.Loaded += PrintControlViewLoaded; _oldPrintingOptions = new PrintingOptions(); _newPrintingOptions = new PrintingOptions(); UnityContainer = unityContainer; WaitScreen = UnityContainer.Resolve <IWaitScreenViewModel>(); PrintUtility = unityContainer.Resolve <PrintUtility>(); CancelPrintCommand = new DelegateCommand <object>(ExecuteCancelPrint); PrintDocumentCommand = new DelegateCommand <object>(ExecutePrint); PageOrientationCommand = new DelegateCommand <object>(ExecutePageOrientation); SetPrintingOptionsCommand = new DelegateCommand <object>(ExecuteSetPrintingOptions); CancelPrintingOptionsCommand = new DelegateCommand <object>(ExecuteCancelPrintingOptions); MarkPageNumbersCommand = new DelegateCommand <object>(ExecuteMarkPageNumbers); AllPagesCommand = new DelegateCommand <object>(ExecuteAllPages); ActualPageSizeCommand = new DelegateCommand <object>(ExecuteActualPageSizeCommand); ChangePaperCommand = new DelegateCommand <object>(ExecuteChangePaper); }
protected void ResolvePrintLink() { if (!ckEndorsements.Checked) { ckIncludeEndorsementImages.Checked = false; } lnkPrintView.NavigateUrl = PrintingOptions.PermaLink(Restriction, new PrintingOptions() { Sections = new PrintingSections() { Endorsements = ckEndorsements.Checked ? (ckIncludeEndorsementImages.Checked ? PrintingSections.EndorsementsLevel.DigitalAndPhotos : PrintingSections.EndorsementsLevel.DigitalOnly) : PrintingSections.EndorsementsLevel.None, IncludeCoverPage = ckIncludeCoverSheet.Checked, IncludeFlights = true, IncludeTotals = ckTotals.Checked } }, Request.Url.Host, Request.Url.Scheme, (nvc) => { nvc["u"] = hdnStudent.Value; }).ToString(); }
protected void RefreshLogbookData() { MyFlightbook.Profile pf = MyFlightbook.Profile.GetUser(Page.User.Identity.Name); PrintingOptions printingOptions = PrintOptions1.Options; mvLayouts.ActiveViewIndex = (int)printingOptions.Layout; List <LogbookEntryDisplay> lstFlights = LogbookEntryDisplay.GetFlightsForQuery(LogbookEntry.QueryCommand(mfbSearchForm1.Restriction, fAsc: true), pf.UserName, string.Empty, SortDirection.Ascending, pf.UsesHHMM, pf.UsesUTCDateOfFlight); IPrintingTemplate pt = ActiveTemplate; PrintLayout pl = PrintLayout.LayoutForType(printingOptions.Layout, CurrentUser); bool fCanIncludeImages = pl.SupportsImages; List <int> lstPropsToExclude = new List <int>(printingOptions.ExcludedPropertyIDs); 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); lstProps.RemoveAll(cfp => lstPropsToExclude.Contains(cfp.PropTypeID)); led.CustomProperties = lstProps.ToArray(); led.CustPropertyDisplay = CustomFlightProperty.PropListDisplay(lstProps, pf.UsesHHMM, szPropSeparator); if (printingOptions.IncludeImages) { led.PopulateImages(true); } led.RowHeight = pl.RowHeight(led); } Master.PrintingCSS = pl.CSSPath.ToAbsoluteURL(Request).ToString(); pt.BindPages(LogbookPrintedPage.Paginate(lstFlights, printingOptions.FlightsPerPage, printingOptions.OptionalColumns), CurrentUser, printingOptions.IncludeImages, !SuppressFooter, printingOptions.OptionalColumns); pnlResults.Visible = true; }
public override void BindPages(IEnumerable <LogbookPrintedPage> lst, Profile user, PrintingOptions options, bool showFooter = true) { base.BindPages(lst, user, options, showFooter); rptPages.DataSource = lst; rptPages.DataBind(); }
protected void RefreshLogbookData() { MyFlightbook.Profile pf = MyFlightbook.Profile.GetUser(Page.User.Identity.Name); PrintingOptions printingOptions = PrintOptions1.Options; mvLayouts.ActiveViewIndex = (int)printingOptions.Layout; List <LogbookEntryDisplay> lstFlights = LogbookEntryDisplay.GetFlightsForQuery(LogbookEntry.QueryCommand(mfbSearchForm1.Restriction, fAsc: true), pf.UserName, string.Empty, SortDirection.Ascending, pf.UsesHHMM, pf.UsesUTCDateOfFlight); IPrintingTemplate pt = ActiveTemplate; PrintLayout pl = PrintLayout.LayoutForType(printingOptions.Layout, CurrentUser); bool fCanIncludeImages = pl.SupportsImages; // 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); } Master.PrintingCSS = pl.CSSPath.ToAbsoluteURL(Request).ToString(); pt.BindPages(LogbookPrintedPage.Paginate(lstFlights, printingOptions), CurrentUser, printingOptions, !SuppressFooter); pnlResults.Visible = true; }
public override void BindPages(IEnumerable <LogbookPrintedPage> lst, Profile user, PrintingOptions options, bool showFooter = true) { base.BindPages(lst, user, options, showFooter); if (lst == null) { throw new ArgumentNullException(nameof(lst)); } ShowRole = false; foreach (LogbookPrintedPage lpp in lst) { foreach (LogbookEntryBase le in lpp.Flights) { if (le.CustomProperties.PropertyExistsWithID(CustomPropertyType.KnownProperties.IDPropRole)) { ShowRole = true; } } } rptPages.DataSource = lst; rptPages.DataBind(); }