예제 #1
0
        public override void UpdateBeforeSimulation()
        {
            try
            {
                if (!MonitorTask.IsComplete)
                {
                    MonitorTask.Wait();
                }

                if (MonitorTask.IsComplete && MonitorTask.valid && MonitorTask.Exceptions != null)
                {
                    TaskHasErrors(ref MonitorTask, "PTask");
                }

                Timings();

                LogicUpdates();
                SplitMonitor();

                if (!ThreadEvents.IsEmpty)
                {
                    IThreadEvent tEvent;
                    while (ThreadEvents.TryDequeue(out tEvent))
                    {
                        tEvent.Execute();
                    }
                }
            }
            catch (Exception ex) { Log.Line($"Exception in SessionBeforeSim: {ex}"); }
        }
        public async Task EndMonitoringMPG()
        {
            await _tripService.AddOrUpdateTripHistory(new TripHistory { Vin = VehicleVin, GallonsUsed = GallonsUsed, MilesTravelled = MilesTravelled }).ConfigureAwait(false);

            MonitorFlag = false;

            MonitorTask?.Wait();
        }
예제 #3
0
        private void DeleteBtn_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            MonitorTask task = _listBoxCtrl.SelectedItem as MonitorTask;

            DataSource.Remove(task);
            _listBoxCtrl.ItemsSource = null;
            _listBoxCtrl.ItemsSource = DataSource;
        }
예제 #4
0
        public void AddTaskItem(MonitorTask p_task)
        {
            MonitorTask newTask = GetNewMonitorTask(p_task);

            DataSource.Add(newTask);
            _listBoxCtrl.ItemsSource   = null;
            _listBoxCtrl.ItemsSource   = DataSource;
            _listBoxCtrl.SelectedIndex = DataSource.Count - 1;
        }
예제 #5
0
        public MonitorTask GetNewMonitorTask(MonitorTask p_oldTask)
        {
            MonitorTask newTask = new MonitorTask();

            newTask.ProtectFreqPoints.AddRange(p_oldTask.ProtectFreqPoints);
            newTask.ProtectFreqRanges.AddRange(p_oldTask.ProtectFreqRanges);
            newTask.TaskID       = p_oldTask.TaskID;
            newTask.TaskType     = p_oldTask.TaskType;
            newTask.TimeLength   = p_oldTask.TimeLength;
            newTask.WorkAddress  = p_oldTask.WorkAddress;
            newTask.WorkDate     = p_oldTask.WorkDate;
            newTask.WorkDescribe = p_oldTask.WorkDescribe;
            newTask.WorkerGroup.AddRange(p_oldTask.WorkerGroup);
            return(newTask);
        }
예제 #6
0
        private void runMonitor()
        {
            DeviceEventTrayApp app = this;

            monitorTask = new MonitorTask(monitorFile, false);
            try
            {
                monitorTask.Start();
            }
            catch (Exception e)
            {
                MessageBox.Show("Error launching device monitoring. Check with the console app that the JSON file is valid.\nException message: " + e.Message, "DeviceEvent", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Close();
            }
        }
예제 #7
0
        public override void UpdateBeforeSimulation()
        {
            try
            {
                if (!MonitorTask.IsComplete)
                {
                    MonitorTask.Wait();
                }

                if (MonitorTask.IsComplete && MonitorTask.valid && MonitorTask.Exceptions != null)
                {
                    TaskHasErrors(ref MonitorTask, "PTask");
                }

                Timings();

                if (!ThreadEvents.IsEmpty)
                {
                    IThreadEvent tEvent;
                    while (ThreadEvents.TryDequeue(out tEvent))
                    {
                        tEvent.Execute();
                    }
                }

                LogicUpdates();

                if (EmpStore.Count != 0 && !EmpDispatched)
                {
                    EmpDispatched = true;
                    PrepEmpBlast();
                    if (EmpWork.EventRunning)
                    {
                        MyAPIGateway.Parallel.Start(ComputeEmpBlast, EmpCallBack);
                    }
                    else
                    {
                        EmpDispatched = false;
                    }
                }

                if (_warEffect && Tick20)
                {
                    WarEffect();
                }
            }
            catch (Exception ex) { Log.Line($"Exception in SessionBeforeSim: {ex}"); }
        }
예제 #8
0
 /// <summary>
 /// 打开任务详细信息
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OpenTaskDetailDialog(MonitorTask p_task)
 {
     //var dialog = new TaskDetailDialog(p_task);
     //dialog.AfterOkButtonClick += Dialog_AfterOkButtonClick;
     //dialog.Show();
 }
예제 #9
0
        private void TextBlock_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            MonitorTask task = _listBoxCtrl.SelectedItem as MonitorTask;

            OpenTaskDetailDialog(task);
        }
예제 #10
0
        private void CopyBtn_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            MonitorTask task = _listBoxCtrl.SelectedItem as MonitorTask;

            AddTaskItem(task);
        }
예제 #11
0
 void Dialog_AfterOkButtonClick(MonitorTask obj)
 {
     _listBoxCtrl.ItemsSource = null;
     _listBoxCtrl.ItemsSource = DataSource;
 }