예제 #1
0
        /// <summary>
        /// Loads the drop downs.
        /// </summary>
        private void LoadDeviceDropDown()
        {
            cboImageOption.Items.Clear();
            cboImageOption.Items.Add("Black and White");
            cboImageOption.Items.Add("Grayscale");
            cboImageOption.Items.Add("Color");

            cboScannerInterfaceType.Items.Clear();
            if (this.BatchPage.rangerScanner != null)
            {
                cboScannerInterfaceType.Items.Add("Ranger");
            }

            if (this.BatchPage.micrImage != null)
            {
                cboScannerInterfaceType.Items.Add("MagTek COM");
            }

            if (ImageSafeHelper.OpenDevice())
            {
                cboScannerInterfaceType.Items.Add("MagTek Image Safe");
            }
            if (cboScannerInterfaceType.Items.Count == 0)
            {
                lblScannerError.Visibility = Visibility.Visible;
                btnSave.IsEnabled          = false;
            }
            else
            {
                lblScannerError.Visibility = Visibility.Collapsed;
                btnSave.IsEnabled          = true;
            }

            cboMagTekCommPort.ItemsSource = System.IO.Ports.SerialPort.GetPortNames();
        }
예제 #2
0
        /// <summary>
        /// Handles the Closing event of the mainWindow control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.ComponentModel.CancelEventArgs"/> instance containing the event data.</param>
        private void mainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            //var rockConfig = RockConfig.Load();
            //var window = sender as NavigationWindow;
            //rockConfig.WindowCurrentHeight = window.ActualHeight;
            //rockConfig.WindowCurrentWidth = window.ActualWidth;
            //rockConfig.Save();
            try
            {
                ImageSafeHelper.CloseDevice();
            }
            catch
            {
                // if image safe is not loaded then just ignore driver exception.
            }

            BatchPage batchPage = null;

            if (mainWindow.Content is BatchPage)
            {
                batchPage = mainWindow.Content as BatchPage;
            }
            else if (mainWindow.Content is ScanningPage)
            {
                batchPage = (mainWindow.Content as ScanningPage)._batchPage;
            }

            if (batchPage != null && batchPage.rangerScanner != null)
            {
                batchPage.rangerScanner.ShutDown();
            }

            Application.Current.Shutdown();
        }