void T1_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { if (!T1.Enabled) { return; } if ((DateTime.Now - LastKeyPress).TotalMilliseconds > 500) { T1.Stop(); this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate() { string EgaisCode = ""; bool res = EGAISCodeReader.GetEgaisCode(tbCode.Text, out EgaisCode); bool AlreadyScan = EGAISCodeReader.GetEgaisAlreadyScanFrom1C(tbCode.Text); if (EgaisCode != "") { tbName.Text = EgaisCode; if (AlreadyScan) { tbName.Text += Environment.NewLine + "Отсканировано ранее!!!"; } else { btnSend.IsEnabled = res; } } } ); } }
private void btnSend_Click(object sender, RoutedEventArgs e) { if (btnSend.IsEnabled) { btnSend.IsEnabled = false; if (EGAISCodeReader.SendEgaisTo1C(tbCode.Text)) { tbName.Text = tbName.Text + Environment.NewLine + "Успешно отправлено"; } tbCode.Focus(); } }
private void btnBeer_Click(object sender, RoutedEventArgs e) { EGAISSrv2.Element[] Data = EGAISCodeReader.GetEgaisListFrom1C(); if ((Data != null) && (Data.Count() > 0)) { ctrlBeer.Init(Data, this); StAlc.Visibility = System.Windows.Visibility.Hidden; GrBeer.Visibility = System.Windows.Visibility.Visible; } else { tbName.Text = "Для вашего подразделения нет остатков пива"; } tbCode.Focus(); }
internal void SendBeer(EGAISSrv2.Element SelectedBeer) { bool res = EGAISCodeReader.SendBeerEgaisTo1C(SelectedBeer.AlcoCode); StAlc.Visibility = System.Windows.Visibility.Visible; GrBeer.Visibility = System.Windows.Visibility.Hidden; if (res) { tbName.Text = SelectedBeer.AlcoName + " успешно отправленно"; } else { tbName.Text = "Ошибка отправки!!!"; tbName.Background = new SolidColorBrush(Colors.Red); } tbCode.Focus(); }