public WorkerViewModel() { _workOrderRepository = new WorkOrderSQLServer(); Worker1StartButton = new DelegateCommand(Worker1StartButtonExecute); Worker2StartButton = new DelegateCommand(Worker2StartButtonExecute); Worker3StartButton = new DelegateCommand(Worker3StartButtonExecute); _timeManagementRepository = new TimeManagementSQLServer(); observableTimer = Observable.Timer(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(2)) .Subscribe(_ => { LabelContent.Value += 1; WorkerWorkings.Value = new ObservableCollection <WorkingEntity>(WorkingData.GetWorkings(WorkId.Value, WorkerId.Value)); }); NextCommand = CanNext.Select(x => x == false).ToReactiveCommand(); NextCommand.Subscribe(_ => { _workOrderRepository.ToNext(WorkId.Value, WorkerId.Value); }); WorkerId.Subscribe(x => { }); }
public ConductorViewModel() { _workOrderRepository = new WorkOrderSQLServer(); observableTimer = Observable.Timer(TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(1)) .Subscribe(_ => { LabelContent.Value += 1; Workings.Value = new ObservableCollection <WorkingEntity>(WorkingData.GetWorkings(WorkId.Value)); Worker1Workings.Value = new ObservableCollection <WorkingEntity>(WorkingData.GetWorkings(WorkId.Value, 1)); Worker2Workings.Value = new ObservableCollection <WorkingEntity>(WorkingData.GetWorkings(WorkId.Value, 2)); Worker3Workings.Value = new ObservableCollection <WorkingEntity>(WorkingData.GetWorkings(WorkId.Value, 3)); CurrentWorker1Workings.Value = Worker1Workings.Value.ToList().Where(x => x.IsDone == false).OrderBy(x => x.WorkTitleId).FirstOrDefault(); CurrentWorker2Workings.Value = Worker2Workings.Value.ToList().Where(x => x.IsDone == false).OrderBy(x => x.WorkTitleId).FirstOrDefault(); CurrentWorker3Workings.Value = Worker3Workings.Value.ToList().Where(x => x.IsDone == false).OrderBy(x => x.WorkTitleId).FirstOrDefault(); WorkerIsWaitUpdate(); CurrentUpdate(); }); Worker1UpdateCommand = Worker1IsWait.Select(x => x == false).ToReactiveCommand(); Worker2UpdateCommand = Worker2IsWait.Select(x => x == false).ToReactiveCommand(); Worker3UpdateCommand = Worker3IsWait.Select(x => x == false).ToReactiveCommand(); Worker1UpdateCommand.Subscribe(_ => Worker1UpdateExecute()); Worker2UpdateCommand.Subscribe(_ => Worker2UpdateExecute()); Worker3UpdateCommand.Subscribe(_ => Worker3UpdateExecute()); }