示例#1
0
        public ApproveOrderViewModel(Order order)
        {
            _svc         = new DriverService();
            Order        = order;
            Driver       = _svc.GetCurrent();
            _rejectOrder = new Command(RejectOrderAction);
            _acceptOrder = new Command(AcceptOrderAction);

            _dispatcherTimer          = new DispatcherTimer();
            _dispatcherTimer.Tick    += UpdateRemainingTime;
            _dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
            _dispatcherTimer.Start();

            RemainingTime = INITIAL_TIME;
        }
        public BackToBasementViewModel(Order order)
        {
            _svc  = new DriverService();
            Order = order;

            Driver = _svc.GetCurrent();

            Status = "Wraca do bazy";

            _arrived = new Command(ArrivedAction);

            _dispatcherTimer          = new DispatcherTimer();
            _dispatcherTimer.Tick    += TakeOrders;
            _dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
            _dispatcherTimer.Start();
        }
        public DriverViewModel()
        {
            _svc      = new DriverService();
            _orderSvc = new OrderService();

            var orders = _orderSvc.GetRecent();

            RecentOrders = orders != null?orders.ToList().Take(2).ToList() : new List <AbbreviatedOrder>();

            var driver = _svc.GetCurrent();

            _active = driver.StatusId != (int)DriverStatusEnum.Inactive &&
                      driver.StatusId != (int)DriverStatusEnum.NotApplicable;

            Status = driver.Status;

            _dispatcherTimer          = new DispatcherTimer();
            _dispatcherTimer.Tick    += TakeOrders;
            _dispatcherTimer.Interval = new TimeSpan(0, 0, 5);
            _dispatcherTimer.Start();
        }