private void _submit(object o)
        {
            string str = o as string;

            if (str == null)
            {
                return;
            }

            StringBuilder errorstr = new StringBuilder();
            TextBoxUpdate update   = new TextBoxUpdate(_textBoxUpdate);

            this.Dispatcher.Invoke(update, "\n\n--------------\n");
            int counts = 0, successcount = 0;
            var stocks = _getStocks(str);

            foreach (var v in stocks)
            {
                ++counts;
                if (v.IsAvailable)
                {
                    int    count   = m_manager.Submit(v);
                    string showStr = _getSubmitFeedback(v.OriginalString, v, count, errorstr);
                    if (count > 0)
                    {
                        ++successcount;
                    }
                    this.Dispatcher.Invoke(update, showStr);
                }
                else
                {
                    this.Dispatcher.Invoke(update, v.OriginalString + "\t---\t数据无效\n");
                    errorstr.Append(v.OriginalString).Append("\t---\t数据无效\n");
                }
            }
            this.Dispatcher.Invoke(update, $"--------------\n总计/成功/失败  {counts}/{successcount}/{counts - successcount}(条) nnns\n");

            _statusBarState("就绪", false);

            if (!string.IsNullOrWhiteSpace(errorstr.ToString()))
            {
                WarnWindow.ShowMessage(errorstr.ToString());
            }

            // 每次更新结束后检查是否需要备份数据库
            _checkBackup();
        }
 public void AddTextBoxSubscriber(TextBoxUpdate update)
 {
     textBoxUpdate += update;
 }
        /// <summary>
        /// Updates the tram number when a new RFID tag is scanned.
        /// </summary>
        /// <param name="sender">Contains a reference to the RFID manager.</param>
        /// <param name="e">Contains the RFID tag that was scanned.</param>
        private void RFIDManager_DataReceived(object sender, Phidgets.Events.TagEventArgs e)
        {
            this.tramNumber = e.Tag;

            TextBoxUpdate textBoxUpdate = new TextBoxUpdate(this.UpdateTextBox);
            this.Invoke(textBoxUpdate);
        }