async void OnPrintTaskSourceRequested(PrintTaskSourceRequestedArgs args)
    {
        var def = args.GetDeferral();
        await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
        {
            args.SetSource(printDoc.DocumentSource);
        });

        def.Complete();
    }
Esempio n. 2
0
        private async void OnPrintTaskSourceRequrested(PrintTaskSourceRequestedArgs args)
        {
            var def = args.GetDeferral();
            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                                      () =>
            {
                args.SetSource(printDoc?.DocumentSource);
            });

            def.Complete();
        }
Esempio n. 3
0
        private void HandlePrintTaskSourceRequested
            (PrintTaskSourceRequestedArgs args)
        {
            // Called when a printer is selected from the printers list panel
            Debug.WriteLine("PrintTask Source Requested");

            // Request a deferral to accommodate the async operation
            var deferral = args.GetDeferral();

            // Set the document source for the current print job.
            // This MUST happen on the UI thread.
            _dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                args.SetSource(_printDocument.DocumentSource);

                // Complete the deferral to indicate completion
                deferral.Complete();
            });
        }
        async void OnPrintTaskSourceRequestedHandler(PrintTaskSourceRequestedArgs args)
        {
            var deferral = args.GetDeferral();

            await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                           () =>
            {
                this.document = new PrintDocument();

                this.document.Paginate       += OnPaginate;
                this.document.GetPreviewPage += OnGetPreviewPage;
                this.document.AddPages       += OnAddPages;

                args.SetSource(this.document.DocumentSource);
            }
                                           );

            deferral.Complete();
        }