예제 #1
0
        private void UpdateTaskStatus(TaskProgressStatusInfo task)
        {
            DataRow row = m_DTTasks.Rows.Find(task.TaskId);

            if (row != null)
            {
                string text = GetTaskStatusText(task);
                row["Status"] = text;
                //row["Task"] = task;
                row["PicCount"] = task.CommitCount;
                //row["RecognizedCount"] = task.PictureSource.RecognizedCount;
                //row["ImageErrorCount"] = task.PictureSource.ImageErrorCount;
                //row["NoPlateCount"] = task.PictureSource.NoPlateCount;
                //row["NotRecognizedCount"] = task.PictureSource.NotRecognizedCount;
                if (task.TaskStatus == TaskStatus.Analysing && string.IsNullOrEmpty(row["StartTime"].ToString()))
                {
                    row["StartTime"] = DateTime.Now.ToString(Constant.DATETIME_FORMAT);
                }
                if (task.TaskStatus == TaskStatus.Finished && string.IsNullOrEmpty(row["FinishedTime"].ToString()))
                {
                    row["FinishedTime"] = DateTime.Now.ToString(Constant.DATETIME_FORMAT);
                }

                DateTime StartAnalyseTime = string.IsNullOrEmpty(row["StartTime"].ToString())? new DateTime(): DateTime.Parse(row["StartTime"].ToString());
                DateTime FinishedTime     = string.IsNullOrEmpty(row["FinishedTime"].ToString()) ? new DateTime() : DateTime.Parse(row["FinishedTime"].ToString());

                string duration = GetTaskAnalyseDuration(new AnalyseTask()
                {
                    StartAnalyseTime = StartAnalyseTime, FinishedTime = FinishedTime
                });
                row["TimeSpan"] = duration;
            }
            UpdateTaskStatistic();
        }
예제 #2
0
        void OnTaskStatusChanged(TaskProgressStatusInfo task)
        {
            //if (Framework.Container.Instance.MainControl.InvokeRequired)
            //{
            //    Framework.Container.Instance.MainControl.BeginInvoke(new EventHandler(OnTaskStatusChanged), new object[] { sender, e });
            //    return;
            //}

            UpdateTaskStatus(task);
        }
예제 #3
0
        private string GetTaskStatusText(TaskProgressStatusInfo task)
        {
            string text   = string.Empty;
            string status = Constant.TaskStatusInfos.FirstOrDefault(item => item.Type == task.TaskStatus).Name;

            if (task.TaskStatus != TaskStatus.Analysing)
            {
                text = status;
            }
            else
            {
                int countProcessed = (int)task.Progress;
                text = string.Format("{0} ({1}%)", status, countProcessed);
            }
            return(text);
        }