public int CalcProgress(IVX.DataModel.E_VDA_TASK_STATUS stat, int progress) { int totalprogress = 0; switch (stat) { case E_VDA_TASK_STATUS.E_TASK_STATUS_NOUSE: break; case E_VDA_TASK_STATUS.E_TASK_STATUS_WAITING: break; case E_VDA_TASK_STATUS.E_TASK_STATUS_IMPORT_WAIT: totalprogress = 100; break; case E_VDA_TASK_STATUS.E_TASK_STATUS_IMPORT_EXECUTING: totalprogress = 200 + (int)(progress / 5); break; case E_VDA_TASK_STATUS.E_TASK_STATUS_IMPORT_FAILED: totalprogress = 0; break; case E_VDA_TASK_STATUS.E_TASK_STATUS_ANALYSE_WAIT: totalprogress = 400; break; case E_VDA_TASK_STATUS.E_TASK_STATUS_ANALYSE_EXECUTING: totalprogress = 500 + (int)(progress * 2 / 5); break; case E_VDA_TASK_STATUS.E_TASK_STATUS_ANALYSE_FINISH: totalprogress = 1000; break; case E_VDA_TASK_STATUS.E_TASK_STATUS_ANALYSE_FAILED: totalprogress = 500; break; case E_VDA_TASK_STATUS.E_TASK_STATUS_ANALYSE_SUSPEND: totalprogress = 0; break; case E_VDA_TASK_STATUS.E_TASK_STATUS_BEEN_DELETE: totalprogress = 0; break; default: break; } return(totalprogress); }
void m_viewModel_UpdateTaskProgress(int index, uint arg1, IVX.DataModel.E_VDA_TASK_STATUS arg2, uint arg3) { if (isClosed) { return; } if (InvokeRequired) { this.Invoke(new Action <int, uint, IVX.DataModel.E_VDA_TASK_STATUS, uint>(m_viewModel_UpdateTaskProgress), index, arg1, arg2, arg3); } else { ucSingleRealtimeTask taskinfo = null; try { if (flowLayoutPanel1.Controls.ContainsKey("ucSingleRealtimeTask_" + index)) { taskinfo = flowLayoutPanel1.Controls["ucSingleRealtimeTask_" + index] as ucSingleRealtimeTask; } if (taskinfo != null) { if (arg1 == 0) { taskinfo.Init(null, arg2, (int)arg3); } else { taskinfo.Init(m_viewModel.GetTaskInfo(arg1), arg2, (int)arg3); } if (m_currentShownTask != null && m_currentShownTask.Created && m_currentShownTask.TaskId == arg1) { m_currentShownTask.UpdateProgress(arg2, (int)arg3); } } } catch (Exception) { return; } } }
public void Init(DataModel.TaskInfoV3_1 task, IVX.DataModel.E_VDA_TASK_STATUS stat, int progress) { if (InvokeRequired) { this.Invoke(new Action <DataModel.TaskInfoV3_1, IVX.DataModel.E_VDA_TASK_STATUS, int>(Init), task, stat, progress); } else { this.Visible = (task != null); if (task != null) { Task = task; labelTaskId.Text = task.TaskId.ToString(); labelAnalyseType.Text = "DataModel.Constant.VideoAnalyzeTypeInfo.Single(item => item.Type == task.AlgthmType).Name"; labelName.Text = task.TaskName; labelStartTime.Text = task.StartTime.ToString("yyyy-MM-dd HH:mm:ss"); BuildTooltipBody(); } labelStatus.Text = DataModel.Constant.TaskStatusInfos.Single(item => item.Status == stat).Name; if (m_viewModel != null) { progressBar.Value = m_viewModel.CalcProgress(stat, progress); } else { progressBar.Value = 0; } if (task != null) { if (progressBar.Value < progressBar.Maximum) { progressBar.Text = (task.Order > 0) ? string.Format("等待排序号:{0}", task.Order) : string.Format("剩余时间:{0}", TimeSpan.FromSeconds(0 /*task.LeftTime*/)); } else { progressBar.Text = ""; } } } }
void m_viewModel_UpdateTaskProgress(uint arg1, IVX.DataModel.E_VDA_TASK_STATUS arg2, uint arg3) { if (!m_isInited) { return; } if (InvokeRequired) { this.Invoke(new Action <uint, IVX.DataModel.E_VDA_TASK_STATUS, uint>(m_viewModel_UpdateTaskProgress), arg1, arg2, arg3); } else { ucTaskInfo taskinfo = null; try { taskinfo = ShownTaskList.Single(item => item.Name == "buttonItemTask_" + arg1); } catch (Exception) { //BuildTaskList(); return; } if (taskinfo != null) { taskinfo.Progress = (int)arg3; taskinfo.TaskStat = arg2; if (m_currentShownTask != null && m_currentShownTask.Created && m_currentShownTask.TaskId == arg1) { m_currentShownTask.UpdateProgress(arg2, (int)arg3); } } //if (taskinfo.TaskStat >= (uint)IVX.DataModel.E_VDA_TASK_STATUS.E_TASK_STATUS_IMPORT_FAILED) //{ // if (m_localUploadProgress.ContainsKey(arg1)) // m_localUploadProgress.Remove(arg1); //} //if (m_localUploadProgress.ContainsKey(arg1)) // m_localUploadProgress[arg1] =Math.Max(m_localUploadProgress[arg1] , arg3); } }
public void Init(DataModel.TaskInfoV3_1 task, IVX.DataModel.E_VDA_TASK_STATUS stat, int progress) { if (InvokeRequired) { this.Invoke(new Action <DataModel.TaskInfoV3_1, IVX.DataModel.E_VDA_TASK_STATUS, int>(Init), task, stat, progress); } else { this.Visible = (task != null); if (task != null) { Task = task; labelTaskId.Text = task.TaskId.ToString(); labelAnalyseType.Text = "DataModel.Constant.VideoAnalyzeTypeInfo.Single(item => item.Type == task.AlgthmType).Name"; labelName.Text = task.ToString(); labelCameraId.Text = ""; BuildTooltipBody(); } labelStatus.Text = DataModel.Constant.TaskStatusInfos.Single(item => item.Status == stat).Name; if (stat == E_VDA_TASK_STATUS.E_TASK_STATUS_ANALYSE_SUSPEND) { reflectionImage1.Image = Properties.Resources.播放1; reflectionImage1.Enabled = true; this.toolTip1.SetToolTip(this.reflectionImage1, "继续分析"); } else if (stat == E_VDA_TASK_STATUS.E_TASK_STATUS_ANALYSE_EXECUTING) { reflectionImage1.Image = Properties.Resources.暂停1; reflectionImage1.Enabled = true; this.toolTip1.SetToolTip(this.reflectionImage1, "暂停分析"); } else { reflectionImage1.Image = null; reflectionImage1.Enabled = false; } } }
void m_viewModel_UpdateTaskProgress(int index, uint arg1, IVX.DataModel.E_VDA_TASK_STATUS arg2, uint arg3) { if (isClosed) { return; } if (InvokeRequired) { this.Invoke(new Action <int, uint, IVX.DataModel.E_VDA_TASK_STATUS, uint>(m_viewModel_UpdateTaskProgress), index, arg1, arg2, arg3); } else { ucSingleHistoryTask taskinfo = null; try { if (flowLayoutPanel1.Controls.ContainsKey("ucSingleHistoryTask_" + index)) { taskinfo = flowLayoutPanel1.Controls["ucSingleHistoryTask_" + index] as ucSingleHistoryTask; } if (taskinfo != null) { TaskInfoV3_1 ti = (arg1 == 0)?null:m_viewModel.GetTaskInfo(arg1); taskinfo.Init(ti, arg2, (int)arg3); if (m_currentShownTask != null && m_currentShownTask.Created && m_currentShownTask.TaskId == arg1) { m_currentShownTask.UpdateProgress(arg2, (int)arg3, ti.Order, ti.LeftTime); } } } catch (Exception ex) { MyLog4Net.Container.Instance.Log.Error("m_viewModel_UpdateTaskProgress" + ex); return; } } }