Exemplo n.º 1
0
        /// <summary>
        /// Dispatch the scancode with the given workitem delegate.
        /// The scanCode must already be normalized. The delegate should take care of dispatching
        /// to the correct upcc handler AND must include the delegate to remove the reentrancy item
        /// </summary>
        /// <param name="delDispatch"></param>
        /// <param name="delAdjust"></param>
        /// <param name="scanCode"></param>
        /// <param name="fErrorSoundsOnly"></param>
        /// <param name="crids"></param>
        void DispatchScanCodeCore(
            AdjustScanCode delAdjust,
            DoHandleDispatchScanCodeDelegate delDispatch,
            string scanCode,
            string sExtra,
            string sExtra2,
            bool fCheckOnly,
            bool fErrorSoundsOnly,
            Guid crids)
        {
            string scanCodeAdjusted = delAdjust(scanCode);

            if (scanCodeAdjusted.StartsWith("!!"))
            {
                m_lp.LogEvent(crids, EventType.Error, scanCodeAdjusted);
                SetFocus(ebScanCode, false);
                m_sb.AddMessage(m_fErrorSoundsOnly ? AlertType.None : AlertType.BadInfo, scanCodeAdjusted);
                return;
            }

            // guard against reentrancy on the same scan code.
            m_lp.LogEvent(crids, EventType.Verbose, "About to check for already processing: {0}", scanCodeAdjusted);
            if (!FAddProcessingCode(scanCodeAdjusted, CorrelationID.FromCrids(crids)))
            {
                // even if we bail out...set the focus
                SetFocus(ebScanCode, false);
                return;
            }

            // The removal of the reentrancy guard will happen asynchronously

            int workId = m_board.CreateWork(scanCodeAdjusted, null);

            WorkBoard.WorkItemDispatch del = async() =>
            {
                await delDispatch(
                    workId,
                    scanCodeAdjusted,
                    sExtra,
                    sExtra2,
                    fCheckOnly,
                    fErrorSoundsOnly,
                    crids,
                    ReportAndRemoveReentrancyEntry);
            };

            m_board.SetWorkDelegate(workId, del);

            WorkItemView view = m_board.GetWorkItemView(workId);

            lstWorkBoard.Items.Insert(0, view);
            m_pipeline.Producer.QueueRecord(new Transaction(workId));
            SetFocus(ebScanCode, false);
            ResetWineInventoryControls();
        }
Exemplo n.º 2
0
 public void WriteLine(string sMessage)
 {
     m_sb.AddMessage(sMessage, StatusBox.MSGT.Body);
 }