Esempio n. 1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            RegisterHotkeys();
            SetInfoLabel();
            LoadHistory();
            BarcodeTypeComboBox.ItemsSource  = Enum.GetValues(typeof(BarcodeFormat));
            BarcodeTypeComboBox.SelectedItem = BarcodeFormat.CODE_128;

            ScanTextBox.Focus();
            if (HistoryStackpanel.Children.Count > 0)
            {
                ScrollToTarget((BarcodeHistoryUserControl)HistoryStackpanel.Children[0]);
            }

            InitializeNotifyIcon();
        }
Esempio n. 2
0
        private void ScrollToTarget(BarcodeHistoryUserControl target, string textToSet = "")
        {
            if (CurrentBarcode != null)
            {
                CurrentBarcode.MainGrid.Background = (SolidColorBrush) new BrushConverter().ConvertFrom(ColorConstants.Blue);
            }
            CurrentBarcode = target;
            CurrentBarcode.MainGrid.Background = (SolidColorBrush) new BrushConverter().ConvertFrom(ColorConstants.Orange);
            HistoryScrollViewer.ScrollToVerticalOffset(target.TranslatePoint(new System.Windows.Point(), HistoryStackpanel).Y);

            if (string.IsNullOrEmpty(textToSet))
            {
                ScanTextBox.Text = target.Barcode.Text.Replace(BarcodeConstants.FNC1.ToString(), BarcodeConstants.FNC1_DisplayPlaceholder);
            }
            else
            {
                ScanTextBox.Text = textToSet.Replace(BarcodeConstants.FNC1.ToString(), BarcodeConstants.FNC1_DisplayPlaceholder);
            }

            BarcodeTypeComboBox.SelectedItem = target.Barcode.Format;
            ScanTextBox.SelectAll();
        }