Exemple #1
0
        /// <summary>
        /// Handles the scan button click.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
        /// <param name="navigate">if set to <c>true</c> [navigate].</param>
        public void HandleScanButtonClick(object sender, RoutedEventArgs e, bool navigate)
        {
            Button scanButton = sender as Button;

            if (ScanButtonText.IsStartScan(scanButton.Content as string))
            {
                if (ScannerFeederType.Equals(FeederType.SingleItem))
                {
                    rangerScanner.StartFeeding(FeedSource.FeedSourceManualDrop, FeedItemCount.FeedOne);
                }
                else
                {
                    rangerScanner.StartFeeding(FeedSource.FeedSourceMainHopper, FeedItemCount.FeedContinuously);
                }

                if (navigate)
                {
                    this.NavigationService.Navigate(ScanningPage);
                }
            }
            else
            {
                rangerScanner.StopFeeding();
                if (navigate)
                {
                    this.NavigationService.Navigate(this);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Rangers the new state of the scanner_ transport.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        private void rangerScanner_TransportNewState(object sender, AxRANGERLib._DRangerEvents_TransportNewStateEvent e)
        {
            mnuConnect.IsEnabled            = false;
            btnScan.Visibility              = Visibility.Hidden;
            ScanningPage.btnDone.Visibility = Visibility.Visible;
            string status = rangerScanner.GetTransportStateString().Replace("Transport", string.Empty).SplitCase();

            shapeStatus.ToolTip = status;

            switch ((XportStates)e.currentState)
            {
            case XportStates.TransportReadyToFeed:
                shapeStatus.Fill = new SolidColorBrush(Colors.LimeGreen);
                btnScan.Content  = "Scan";
                if (ScannerFeederType.Equals(FeederType.MultipleItems))
                {
                    ScanningPage.btnStartStop.Content = ScanButtonText.Scan;
                }
                else
                {
                    ScanningPage.btnStartStop.Content = ScanButtonText.ScanCheck;
                }

                btnScan.Visibility = Visibility.Visible;
                break;

            case XportStates.TransportShutDown:
                shapeStatus.Fill     = new SolidColorBrush(Colors.Red);
                mnuConnect.IsEnabled = true;
                break;

            case XportStates.TransportFeeding:
                shapeStatus.Fill = new SolidColorBrush(Colors.Blue);
                btnScan.Content  = "Stop";
                ScanningPage.btnStartStop.Content = ScanButtonText.Stop;
                ScanningPage.btnDone.Visibility   = Visibility.Hidden;
                btnScan.Visibility = Visibility.Visible;
                break;

            case XportStates.TransportStartingUp:
                shapeStatus.Fill = new SolidColorBrush(Colors.Yellow);
                break;

            default:
                shapeStatus.Fill = new SolidColorBrush(Colors.White);
                break;
            }

            ScanningPage.shapeStatus.ToolTip = this.shapeStatus.ToolTip;
            ScanningPage.shapeStatus.Fill    = this.shapeStatus.Fill;
        }