Example #1
0
        /// <summary>
        /// The cbPrinter_SelectedIndexChanged
        /// </summary>
        /// <param name="sender">The sender<see cref="object"/></param>
        /// <param name="e">The e<see cref="EventArgs"/></param>
        private void cbPrinter_SelectedIndexChanged(object sender, EventArgs e)
        {
            try {
                if (this.cbPrinter.Text != Settings1.Default.Printer_name)
                {
                    Settings1.Default.LoggedIn = false;
                }

                Printer printer = new Printer(cbPrinter.Text);
                this.printerConfiguration      = new PrinterConfiguration();
                this.printerConfiguration.Name = cbPrinter.Text;

                foreach (PaperSource paperSource in printer.PaperSources)
                {
                    this.printerConfiguration.PaperSources.Add(paperSource.Name);
                }
                foreach (Resolution resolution in printer.Resolutions)
                {
                    this.printerConfiguration.Resolutions.Add(resolution.HorizontalDpi + " x " + resolution.VerticalDpi);
                }

                this.UpdateControls(ConfigState.SELECT_PRINTER);
                InitPrintConfiguration();
            } catch (Exception ex) {
                LogException(ex);
            }
        }
Example #2
0
 public FormPrint(String sessionId, PrinterConfiguration printerConfiguration)
 {
     try {
         InitializeComponent();
         this.sessionId              = sessionId;
         this.printerConfiguration   = printerConfiguration;
         this.restProxy              = new WebPrintRestProxy(sessionId);
         this.isPrintInitiated       = false;
         this.lblCurrentUser.Text    = Properties.Settings.Default.UserUid;
         this.lblLastLogin.Text      = Settings1.Default.LoggedInDateTime;
         this.lblPrintMediaDisp.Text = Settings1.Default.MediaSelected;
         waitHandle     = new AutoResetEvent(false);
         timer          = new System.Windows.Forms.Timer();
         timer.Interval = 5000;
         timer.Tick    += Timer_TickAsync;
         timer.Start();
     } catch (Exception ex) {
         LogException(ex);
     }
 }