Inheritance: IPrintTask
        private void GenerateOptions(PrintTask printTask)
        {
            var optionDetails = PrintTaskOptionDetails.GetFromPrintTaskOptions(printTask.Options);
            
            var listOption1 = optionDetails.CreateItemListOption("listOption1", "List Option 1");
            listOption1.AddItem("Foo", "Foo");
            listOption1.AddItem("Bar", "Bar");

            var textOption1 = optionDetails.CreateTextOption("textOption1", "Text Option 1");

            optionDetails.DisplayedOptions.Add("listOption1");
            optionDetails.DisplayedOptions.Add("textOption1");

            optionDetails.Options["listOption1"].TrySetValue("Bar");
            optionDetails.Options[StandardPrintTaskOptions.Orientation].TrySetValue(PrintOrientation.Landscape);

            optionDetails.OptionChanged += (details, e) =>
            {
                // TODO Store options to use when generating document
            };
        }
 void OnPrintTaskCompleted(PrintTask sender, PrintTaskCompletedEventArgs args)
 {
     this.pageSize = null;
     this.imageableRect = null;
     this.document = null;
     this.pages = null;
 } 
        void printTask_Completed(PrintTask sender, PrintTaskCompletedEventArgs args)
        {
            _PrintTaskCompletionValue = args.Completion;

            _ResetEvent.Set();
        }
示例#4
0
        protected virtual void PrintTaskRequested(PrintManager sender,
            PrintTaskRequestedEventArgs e)
        {
            Task = e.Request.CreatePrintTask(PrintTitle, async sourceRequested =>
            {
                PrintTaskOptionDetails printDetailedOptions = PrintTaskOptionDetails.GetFromPrintTaskOptions(Task.Options);

                printDetailedOptions.DisplayedOptions.Clear();
                printDetailedOptions.DisplayedOptions.Add(StandardPrintTaskOptions.Copies);

                Task.Options.Orientation = PrintOrientation.Portrait;

                Task.Completed += async (s, args) =>
                {
                    if (args.Completion == PrintTaskCompletion.Failed)
                    {
                        await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                        {
                            Debug.WriteLine("Failed to print.");
                        });
                    }
                };

                await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    sourceRequested.SetSource(PrintDoc?.DocumentSource);
                });
            });
        }
 public PrintTaskEvents(PrintTask This)
 {
     this.This = This;
 }
 void OnPrintTaskCompleted(PrintTask sender, PrintTaskCompletedEventArgs args)
 {
     this.pageCount = 0;
     this.document = null;
 }