/// <summary>
        ///  Button click event handler.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button clickedButton = (Button)sender;

            switch (clickedButton.Name)
            {
            case "CancelButton":
                CancelRequestAndCloseWindow();
                break;

            case "OkButton":
                //
                // Validate the print ticket asynchronously. The event handler is invoked when the validation is completed.
                //

                IPrintSchemaAsyncOperation asyncOperation = displayedPrintTicket.ValidateAsync();

                //
                // Pop up a modal dialog that prevents the user from changing selections when validation is in progress.
                // Since this dialog lives as long as the parent window, it is not mandatory to unregister the delegate for the
                // 'Completed' event.
                //

                ValidationModalDialog.Completed += PrintTicketValidateCompleted;     // This operation is idempotent.
                ValidationModalDialog.StartAsyncOperation(asyncOperation);
                break;

            case "VerifyButton":
                //
                // Force WPF Data binding to refresh the UI. This operation retrieves
                // a fresh print capabilities for the print ticket based on the user selections.
                //

                PropertyChanged(this, new PropertyChangedEventArgs("PrintSchemaHelperSource"));
                break;
            }
        }
Пример #2
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 9 "..\..\..\PrintPreferenceWindow.xaml"
                ((Microsoft.Samples.Printing.PrinterExtension.PrintPreferenceWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.PrintPreferenceWindow_Closing);

            #line default
            #line hidden
                return;

            case 2:
                this.MainGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.LeftHalf = ((System.Windows.Controls.ColumnDefinition)(target));
                return;

            case 4:
                this.RightHalf = ((System.Windows.Controls.ColumnDefinition)(target));
                return;

            case 5:
                this.BrandingRow = ((System.Windows.Controls.RowDefinition)(target));
                return;

            case 6:
                this.ContentRow = ((System.Windows.Controls.RowDefinition)(target));
                return;

            case 7:
                this.StatusRow = ((System.Windows.Controls.RowDefinition)(target));
                return;

            case 8:
                this.ValidationModalDialog = ((Microsoft.Samples.Printing.PrinterExtension.ValidationModalDialog)(target));
                return;

            case 9:
                this.InkIndicatorC = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 10:
                this.InkIndicatorM = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 11:
                this.InkIndicatorY = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 12:
                this.InkIndicatorK = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 13:
                this.OkButton = ((System.Windows.Controls.Button)(target));

            #line 142 "..\..\..\PrintPreferenceWindow.xaml"
                this.OkButton.Click += new System.Windows.RoutedEventHandler(this.Button_Click);

            #line default
            #line hidden
                return;

            case 14:
                this.CancelButton = ((System.Windows.Controls.Button)(target));

            #line 143 "..\..\..\PrintPreferenceWindow.xaml"
                this.CancelButton.Click += new System.Windows.RoutedEventHandler(this.Button_Click);

            #line default
            #line hidden
                return;

            case 15:
                this.VerifyButton = ((System.Windows.Controls.Button)(target));

            #line 144 "..\..\..\PrintPreferenceWindow.xaml"
                this.VerifyButton.Click += new System.Windows.RoutedEventHandler(this.Button_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }