コード例 #1
0
ファイル: MainPage.xaml.cs プロジェクト: rlittletht/UpcInv
        /// <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();
        }
コード例 #2
0
ファイル: MainPage.xaml.cs プロジェクト: rlittletht/UpcInv
 async void UpdateWorkBoard(WorkItemView view)
 {
     if (lstWorkBoard.Dispatcher.HasThreadAccess)
     {
         UpdateWorkBoardCore(view);
     }
     else
     {
         await lstWorkBoard.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { UpdateWorkBoardCore(view); });
     }
 }
コード例 #3
0
ファイル: MainPage.xaml.cs プロジェクト: rlittletht/UpcInv
        void UpdateWorkBoardCore(WorkItemView view)
        {
            // find the item in the view and update it
            for (int i = 0; i < lstWorkBoard.Items.Count; i++)
            {
                if (((WorkItemView)lstWorkBoard.Items[i]).WorkId == view.WorkId)
                {
                    lstWorkBoard.Items[i] = view;
                    return;
                }
            }

            throw new Exception("Can't find work item to update");
        }
コード例 #4
0
ファイル: MainPage.xaml.cs プロジェクト: rlittletht/UpcInv
 void AddToWorkBoard(WorkItemView view)
 {
     lstWorkBoard.Items.Insert(0, view);
 }