/// <summary>
        /// Commits the input print ticket asynchronously. The completed event handler is expected to close the window.
        /// </summary>
        /// <param name="validatedTicket"></param>
        private void CommitPrintTicketAsync(IPrintSchemaTicket validatedTicket)
        {
            IPrintSchemaAsyncOperation commitAsyncOperation = printerExtensionEventArgs.Ticket.CommitAsync(validatedTicket);

            commitAsyncOperation.Completed += PrintTicketCommitCompleted;
            commitAsyncOperation.Start();
        }
        /// <summary>
        /// Invoked when there are constraints in the print ticket selections.
        /// </summary>
        /// <param name="validatedTicket"></param>
        private void HandleTicketConstraints(IPrintSchemaTicket validatedTicket)
        {
            //
            // Retrieved localized display strings from a resource file/
            //
            string selectionConflictsFound = PrinterExtensionSample.Strings.SelectionConflictsFound;
            string selectionConflictsTitle = PrinterExtensionSample.Strings.SelectionConflictsTitle;

            MessageBoxResult result = MessageBox.Show(
                this,
                selectionConflictsFound,
                selectionConflictsTitle,
                MessageBoxButton.YesNoCancel);

            if (result == MessageBoxResult.Yes)
            {
                CommitPrintTicketAsync(validatedTicket);
            }
            else
            {
                PropertyChanged(this, new PropertyChangedEventArgs("PrintSchemaHelperSource"));
            }
        }
 /// <summary>
 /// Constructor. Warning constructing this object is expensive, and is best performed
 /// asynchronously.
 /// </summary>
 /// <param name="ticket">The print ticket for which features/options will be retrieved</param>
 /// <param name="featureNameCollection">List of features requested</param>
 internal PrintSchemaHelper(IPrintSchemaTicket ticket, IEnumerable<String> featureNameCollection)
 {
     _ticket = ticket;
     _featureNameCollection = featureNameCollection;
     _capabilities = _ticket.GetCapabilities();
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Constructor. Warning constructing this object is expensive, and is best performed
 /// asynchronously.
 /// </summary>
 /// <param name="ticket">The print ticket for which features/options will be retrieved</param>
 /// <param name="featureNameCollection">List of features requested</param>
 internal PrintSchemaHelper(IPrintSchemaTicket ticket, IEnumerable <String> featureNameCollection)
 {
     _ticket = ticket;
     _featureNameCollection = featureNameCollection;
     _capabilities          = _ticket.GetCapabilities();
 }
 //
 // Implementation details
 //
 internal PrintSchemaAsyncOperationEventArgs(IPrintSchemaTicket printTicket, int statusHResult)
 {
     _statusHResult = statusHResult;
     _printTicket = printTicket;
 }
 //
 // Implementation details
 //
 internal PrintSchemaAsyncOperationEventArgs(IPrintSchemaTicket printTicket, int statusHResult)
 {
     _statusHResult = statusHResult;
     _printTicket   = printTicket;
 }
 /// <summary>
 /// Commits the input print ticket asynchronously. The completed event handler is expected to close the window.
 /// </summary>
 /// <param name="validatedTicket"></param>
 private void CommitPrintTicketAsync(IPrintSchemaTicket validatedTicket)
 {
     IPrintSchemaAsyncOperation commitAsyncOperation = printerExtensionEventArgs.Ticket.CommitAsync(validatedTicket);
     commitAsyncOperation.Completed += PrintTicketCommitCompleted;
     commitAsyncOperation.Start();
 }
        /// <summary>
        /// Invoked when there are constraints in the print ticket selections.
        /// </summary>
        /// <param name="validatedTicket"></param>
        private void HandleTicketConstraints(IPrintSchemaTicket validatedTicket)
        {
            //
            // Retrieved localized display strings from a resource file/
            //
            string selectionConflictsFound = PrinterExtensionSample.Strings.SelectionConflictsFound;
            string selectionConflictsTitle = PrinterExtensionSample.Strings.SelectionConflictsTitle;

            MessageBoxResult result = MessageBox.Show(
                                        this,
                                        selectionConflictsFound,
                                        selectionConflictsTitle,
                                        MessageBoxButton.YesNoCancel);

            if (result == MessageBoxResult.Yes)
            {
                CommitPrintTicketAsync(validatedTicket);
            }
            else
            {
                PropertyChanged(this, new PropertyChangedEventArgs("PrintSchemaHelperSource"));
            }
        }
        /// <summary>
        /// This method sets up data binding sources and performs other initialization tasks.
        /// </summary>
        /// <param name="eventArgs"></param>
        public void Initialize(PrinterExtensionEventArgs eventArgs)
        {
            //
            // Populate the data binding sources.
            //

            DataContext = this;

            printerExtensionEventArgs = eventArgs;
            PrinterQueue = eventArgs.Queue;
            displayedPrintTicket = eventArgs.Ticket;

            //
            // Send a bidi query requesting ink levels.
            //
            // Please note: As this event will fire many times, it is recommended to maintain event
            // listeners for the life time of the application. Furthermore, the relationship to this
            // being invoked and the calling SendBidiQuery() is not 1:1; in fact, it is *:N, where the
            // listener may be called several times with bidi updates.
            //
            //

            PrinterQueue.OnBidiResponseReceived += OnBidiResponseReceived;
            PrinterQueue.SendBidiQuery("\\Printer.consumables");
        }