コード例 #1
0
        private void ExecuteOverrideCommand()
        {
            t.Stop();             //stop refresh timer

            HandleRefreshTimer(); //run refresh to see if bad serials are still on truck

            if (BadSerials.Count() > 0)
            {
                //show correction window
                UnloadCorrectionViewModel vm = SimpleIoc.Default.GetInstance <UnloadCorrectionViewModel>();
                vm.ActiveListID = this.ActiveListID;
                vm.Initialize();
                _windowService.ShowModalWindow(WindowType.UnloadCorrectionWindow, vm);
            }
        }
コード例 #2
0
        private void ProcessQuadratureMessage(QuadratureStateChangeMessage e)
        {
            Task.Run(() =>
            {
                //if stopped after unload
                var prevEvent = QuadratureEncoderDataProvider.PreviousEvent;
                if (e.DirectionOfRotation == Enums.DirectionOfRotation.Stopped && prevEvent != null && prevEvent.DirectionOfRotation == Enums.DirectionOfRotation.RotatingCounterClockwise)
                {
                    t.Stop();             //stop refresh timer

                    HandleRefreshTimer(); //run refresh to see if bad serials are still on truck

                    if (BadSerials.Count() > 0)
                    {
                        //show correction window
                        System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
                        {
                            UnloadCorrectionViewModel vm = SimpleIoc.Default.GetInstance <UnloadCorrectionViewModel>();
                            vm.ActiveListID = this.ActiveListID;
                            vm.Initialize();
                            _windowService.ShowModalWindow(WindowType.UnloadCorrectionWindow, vm);
                        }));
                    }
                }
                else if (e.DirectionOfRotation == Enums.DirectionOfRotation.RotatingClockwise) //loading
                {
                    if (!t.Enabled)
                    {
                        t.Start();
                    }

                    if (_windowService.IsWindowOpen(WindowType.UnloadCorrectionWindow))
                    {
                        _windowService.CloseModalWindow(WindowType.UnloadCorrectionWindow);
                    }
                }
                else //we started unloading again so monitor for unloads
                {
                    if (_windowService.IsWindowOpen(WindowType.UnloadCorrectionWindow))
                    {
                        _windowService.CloseModalWindow(WindowType.UnloadCorrectionWindow);
                    }
                    _windowService.FocusLast(WindowType.WaitingForUnloadWindow);
                    t.Start();
                }
            });
        }