public static Task <bool> PrintAsync(FunctionGraph graph) { var printer = new GraphPrinter(graph); // Show the print UI, with the print manager connected to us. PrintManager printManager = PrintManager.GetForCurrentView(); printManager.PrintTaskRequested += printer.PrintTaskRequested; return(PrintManager.ShowPrintUIAsync().AsTask()); }
private GraphPrinter(FunctionGraph graph) { _graph = graph; // Resources cannot be loaded from the print thread, so do it here. _title = AppUtilities.GetString("PrintTaskTitle"); _graphSizeOption = AppUtilities.GetString(nameof(GraphSize)); _fullPageItem = AppUtilities.GetString(nameof(GraphSize.FullPage)); _windowSizeItem = AppUtilities.GetString(nameof(GraphSize.Window)); _labelLocationOption = AppUtilities.GetString(nameof(LabelLocation)); _noneItem = AppUtilities.GetString(nameof(LabelLocation.None)); _topLeftItem = AppUtilities.GetString(nameof(LabelLocation.TopLeft)); _topRightItem = AppUtilities.GetString(nameof(LabelLocation.TopRight)); _bottomLeftItem = AppUtilities.GetString(nameof(LabelLocation.BottomLeft)); _bottomRightItem = AppUtilities.GetString(nameof(LabelLocation.BottomRight)); _printDocument = new CanvasPrintDocument(); _printDocument.Preview += PrintDocument_Preview; _printDocument.Print += PrintDocument_Print; _printDocument.PrintTaskOptionsChanged += PrintDocument_PrintTaskOptionsChanged; }
public FunctionGraphAutomationPeer(FunctionGraph owner) : base(owner) { _graph = owner; }