Beispiel #1
0
        void m_viewModel_TaskDeleted(TaskInfoV3_1 obj)
        {
            if (isClosed)
            {
                return;
            }

            if (InvokeRequired)
            {
                this.Invoke(new Action <TaskInfoV3_1>(m_viewModel_TaskDeleted), obj);
            }
            else
            {
                DevComponents.AdvTree.Node node = null;
                foreach (DevComponents.AdvTree.Node item in advTree1.Nodes)
                {
                    if (item.Text == obj.TaskId.ToString())
                    {
                        node = item; break;
                    }
                }
                if (node != null)
                {
                    advTree1.Nodes.Remove(node);
                }
                PageNavigatorChanged();
            }
        }
        public void Start(SearchItemV3_1 cameraItem)
        {
            /*
             * 订阅 CrowdRealTimeEvent 事件
             * start
             */
            string cameraId = "";

            if (cameraItem != null)
            {
                cameraId = cameraItem.CameraID;
            }
            if (m_vm == null)
            {
                var info = Framework.Container.Instance.CommService.GET_RESULT_STORE_LIST(cameraId, E_VIDEO_ANALYZE_TYPE.E_ANALYZE_CROWD);
                if (info == null)
                {
                    // notify UI
                    if (RealSearchFinished != null)
                    {
                        CrowdInfo crowdInfo = new CrowdInfo();
                        crowdInfo.CameraID          = "SDKError";
                        crowdInfo.DirectionImageURL = "大客流实时-查询错误:无结果数据";
                        RealSearchFinished((object)crowdInfo, null);
                    }
                    return;
                }
                string ip   = info.StoreIP;
                uint   port = info.StortPort;
                m_vm = new SearchViewModelBase(ip, port);
                WinFormAppUtil.AppContainer.Instance.EvtAggregator.GetEvent <CrowdRealTimeEvent>().Subscribe(OnSearchResultReturned, Microsoft.Practices.Prism.Events.ThreadOption.WinFormUIThread);
            }
            curTask = Framework.Container.Instance.CommService.GET_TASK(cameraItem.TaskId);
            m_vm.StartCrowdRealtime(cameraId);
        }
 public FormEditRealtimeAnalyseParam(TaskInfoV3_1 task, E_VIDEO_ANALYZE_TYPE algthmType, string analyseParam)
 {
     InitializeComponent();
     Task         = task;
     AlgthmType   = algthmType;
     AnalyseParam = analyseParam;
 }
Beispiel #4
0
 public FormPlayBriefNew(TaskInfoV3_1 task)
 {
     InitializeComponent();
     ShowStatusBar     = true;
     ucPlayBrief1.Task = task;
     ucPlayHistory1.ShowGotoCompare = task.StatusList.Exists(xx => xx.AlgthmType == E_VIDEO_ANALYZE_TYPE.E_ANALYZE_MOVEOBJ_PLATFORM);
 }
Beispiel #5
0
        private void wnd_DragDrop(object sender, DragEventArgs e)
        {
            ucSinglePlayWnd p = sender as ucSinglePlayWnd;


            Type dataType = typeof(DevComponents.AdvTree.Node);

            if (e.Data.GetDataPresent(dataType))
            {
                DevComponents.AdvTree.Node node = (DevComponents.AdvTree.Node)e.Data.GetData(dataType);
                TaskInfoV3_1 task = node.Tag as TaskInfoV3_1;
                if (task != null)
                {
                    TaskMSSInfoV3_1 mssinfo = m_viewModel.GetMssTaskInfo(task.TaskId);
                    if (mssinfo != null)
                    {
                        p.VideoName = task.TaskName;
                        p.StartPlayBack(mssinfo.MssHostIp, mssinfo.MssHostPort, mssinfo.VideoPath, 0, 0);
                    }
                    else
                    {
                        DevComponents.DotNetBar.MessageBoxEx.Show("无此视频文件", Framework.Environment.PROGRAM_NAME, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                }
            }
        }
 private void ViewModel_TaskMdf(TaskInfoV3_1 obj)
 {
     //当前 算法类型一致
     if (IsMySelfAnalyzeType(obj))
     {
         // &&含有该 任务
         Node mdfNode = null;
         if (HasTask(obj, out mdfNode))
         {
             NodeMdf(obj.ToSearchItem(), mdfNode);
         }
         // 不含有该 任务
         else
         {
             //添加该任务
             NodeAdd(obj.ToSearchItem());
         }
     }
     //当前 算法类型 不一致 ----删除的情况
     else
     {
         Node delNode = null;
         if (HasTask(obj, out delNode))
         {
             NodeDelete(delNode);
         }
     }
 }
Beispiel #7
0
 void CommService_TaskMonified(TaskInfoV3_1 obj)
 {
     System.Diagnostics.Trace.WriteLine("CommService_TaskMonified " + obj.ToString());
     if (obj.StatusList.Count > 0)
     {
         E_VDA_TASK_STATUS s = obj.StatusList[0].Status;
         uint p     = obj.StatusList[0].Progress;
         int  index = m_lastTaskidList.IndexOf(obj.TaskId);
         if (index >= 0)
         {
             if (s != TaskShowStatus)
             {
                 if (TaskModified != null)
                 {
                     TaskModified(obj);
                 }
             }
             else
             {
                 if (UpdateTaskProgress != null)
                 {
                     UpdateTaskProgress(index, obj.TaskId, s, p);
                 }
             }
         }
         if (s == TaskShowStatus && TaskModified != null)
         {
             TaskModified(obj);
         }
     }
 }
        void CommService_TaskMonified(TaskInfoV3_1 obj)
        {
            System.Diagnostics.Trace.WriteLine("CommService_TaskMonified " + obj.ToString());
            int index = m_lastTaskidList.IndexOf(obj.TaskId);

            if (index >= 0)
            {
                if (obj.Status != TaskShowStatus)
                {
                    if (TaskModified != null)
                    {
                        TaskModified(obj);
                    }
                }
                else
                {
                    if (UpdateTaskProgress != null)
                    {
                        UpdateTaskProgress(index, obj.TaskId, obj.Status, obj.Progress);
                    }
                }
            }
            if (obj.Status == TaskShowStatus && TaskModified != null)
            {
                TaskModified(obj);
            }

            if (TaskMdfNotify != null)
            {
                TaskMdfNotify(obj);
            }
        }
Beispiel #9
0
 public void ReImport(uint userhandel, TaskInfoV3_1 task)
 {
     Framework.Container.Instance.CommService.ADD_TASK(userhandel, new List <TaskInfoV3_1>()
     {
         task
     });
     DeleteTask(userhandel, task.TaskId);
 }
Beispiel #10
0
 public void ReImport(TaskInfoV3_1 task)
 {
     Framework.Container.Instance.CommService.ADD_TASK(new List <TaskInfoV3_1>()
     {
         task
     });
     DeleteTask(task.TaskId);
 }
Beispiel #11
0
 void CommService_TaskAdded(TaskInfoV3_1 obj)
 {
     System.Diagnostics.Trace.WriteLine("CommService_TaskAdded " + obj.ToString());
     if (TaskAdded != null)
     {
         TaskAdded(obj);
     }
 }
Beispiel #12
0
        void CommService_TaskDeleted(TaskInfoV3_1 obj)
        {
            System.Diagnostics.Trace.WriteLine("CommService_TaskDeleted " + obj.ToString());

            if (m_lastTaskidList.Contains(obj.TaskId) && TaskDeleted != null)
            {
                TaskDeleted(obj);
            }
        }
        private void ViewModel_TaskAdd(TaskInfoV3_1 obj)
        {
            Node item = null;

            if (!IsMySelfAnalyzeType(obj) || HasTask(obj, out item))
            {
                return;
            }
            NodeAdd(obj.ToSearchItem());
        }
Beispiel #14
0
        void m_viewModel_TaskDeleted(TaskInfoV3_1 obj)
        {
            var node = advTree1.FindNodeByText(obj.TaskId.ToString());

            if (node != null)
            {
                advTree1.Nodes.Remove(node);
            }
            PageNavigatorChanged();
        }
        public bool Submit(string param)
        {
            if (!Validate())
            {
                return(false);
            }
            string AnalyseTypename       = DataModel.Constant.VideoAnalyzeTypeInfo.Single(item => item.Type == AnalyseType).Name;
            List <TaskInfoV3_1> tasklist = new List <TaskInfoV3_1>();

            if (string.IsNullOrEmpty(param))
            {
                param = GetDefaultAnalyseParam(AnalyseType);
            }

            var task = new TaskInfoV3_1()
            {
                TaskId       = 0,
                TaskType     = TaskType.Realtime,
                TaskName     = "实时_" + AnalyseTypename + "_" + CameraName,
                StorePort    = 0,
                StoreIP      = "",
                ProtocolType = Protocol,
                OriFilePath  = "",
                LoginUser    = User,
                CameraID     = CameraID,
                ChannelID    = Channel,
                DeviceIP     = IP,
                DeviceName   = IP + "_" + Port,
                DevicePort   = Port,
                DeviceType   = Protocol,
                EndTime      = new DateTime(),
                FileSize     = 0,
                FileType     = TaskFileType.None,
                LoginPwd     = Pass,
                StartTime    = new DateTime(),
                StatusList   = new List <StatusInfoV3_1>(),
                Order        = 0,
                Priority     = 0,
                UserHandle   = 0,
            };

            task.StatusList.Add(new StatusInfoV3_1()
            {
                AlgthmType   = AnalyseType,
                AnalyseParam = param,
                Status       = 0,
                Progress     = 0,
                LeftTime     = 0,
            });
            tasklist.Add(task);

            Framework.Container.Instance.CommService.ADD_TASK(tasklist);

            return(true);
        }
Beispiel #16
0
 void CommService_TaskMonified(TaskInfoV3_1 obj)
 {
     if (obj.TaskType == TaskType.History)
     {
         System.Diagnostics.Trace.WriteLine("CommService_TaskMonified " + obj.TaskId + " " + obj.ToString());
         if (TaskModified != null)
         {
             TaskModified(obj);
         }
     }
 }
Beispiel #17
0
 void CommService_TaskAdded(TaskInfoV3_1 obj)
 {
     if (obj.TaskType == TaskType.Realtime)
     {
         System.Diagnostics.Trace.WriteLine("CommService_TaskAdded " + obj.ToString());
         TotalCount++;
         if (TaskAdded != null)
         {
             TaskAdded(obj);
         }
     }
 }
        private void ViewModel_TaskDel(TaskInfoV3_1 obj)
        {
            if (!IsMySelfAnalyzeType(obj))
            {
                return;
            }
            Node delNode = null;

            if (HasTask(obj, out delNode))
            {
                NodeDelete(delNode);
            }
        }
        private void InitEventList()
        {
            var list = Framework.Container.Instance.CommService.GET_TRANS_EVENT_LIST();

            foreach (var item in list)
            {
                if (item.ReceiveIp == m_serverIp && item.ReceivePort == m_serverPort)
                {
                    m_transEventList.Add(new Tuple <uint, E_VIDEO_ANALYZE_TYPE>(item.TaskID, item.AnalyseType), item.EventID);
                    InitTask = Framework.Container.Instance.CommService.GET_TASK(item.TaskID);
                }
            }
        }
Beispiel #20
0
        public void UpdateTask(TaskInfoV3_1 info)
        {
            m_viewModel.CurrentTask = info;
            //textBoxTaskStatus.Text = DataModel.Constant.TaskStatusInfos.Single(item => item.Status == stat).Name;
            //progressBarTaskProgress.Value = m_viewModel.CalcProgress(stat, progress);

            //if (progressBarTaskProgress.Value < progressBarTaskProgress.Maximum)
            //    progressBarTaskProgress.Text = (order > 0) ? string.Format("等待排序号:{0}", order) : string.Format("剩余时间:{0}", TimeSpan.FromSeconds(lefttime));
            //else
            //    progressBarTaskProgress.Text = "";

            //buttonReAnalyse.Enabled = (stat != E_VDA_TASK_STATUS.E_TASK_STATUS_ANALYSE_EXECUTING && stat != E_VDA_TASK_STATUS.E_TASK_STATUS_ANALYSE_WAIT);
            Init();
        }
        public void Start(UInt32 startTime, UInt32 endTime, SearchItemV3_1 item, UInt32 timeInterVel)
        {
            /*
             * 订阅 CrowdReportEvent 事件
             *
             * start
             */
            string cameraId = item.CameraID;
            var    info     = Framework.Container.Instance.CommService.GET_RESULT_STORE_LIST(cameraId, E_VIDEO_ANALYZE_TYPE.E_ANALYZE_CROWD);

            if (info == null)
            {
                List <CrowdStatistic> crowdInfoList = new List <CrowdStatistic> {
                };
                //notify UI
                if (ReportSearchFinished != null)
                {
                    ReportSearchFinished((object)crowdInfoList, null);
                }
                return;
            }
            string ip   = info.StoreIP;
            uint   port = info.StortPort;

            m_vm    = new SearchViewModelBase(ip, port);
            curTask = Framework.Container.Instance.CommService.GET_TASK(item.TaskId);
            if (curTask.TaskType == TaskType.History)
            {
                uint beginTime = DataModel.Common.ConvertLinuxTime(curTask.StartTime);
                if (startTime <= beginTime)
                {
                    startTime = 0;
                }
                else
                {
                    startTime -= beginTime;
                }

                if (endTime <= beginTime)
                {
                    endTime = 0;
                }
                else
                {
                    endTime -= beginTime;
                }
            }
            WinFormAppUtil.AppContainer.Instance.EvtAggregator.GetEvent <CrowdReportEvent>().Subscribe(OnSearchResultReturned, Microsoft.Practices.Prism.Events.ThreadOption.WinFormUIThread);
            m_vm.StartCrowdReport(startTime, endTime, cameraId, timeInterVel);
        }
Beispiel #22
0
        private void ShowSingleTask()
        {
            TaskInfoV3_1 task = null;// m_viewModel.GetTaskInfo(m_currentTask.TaskId);

            if (task != null)
            {
                m_currentShownTask               = new FormSingleTask(task, m_currentTask.Progress);
                m_currentShownTask.WindowState   = FormWindowState.Normal;
                m_currentShownTask.StartPosition = FormStartPosition.CenterParent;
                if (m_currentShownTask.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                }
                m_currentShownTask = null;
            }
        }
        // 是否已经在包含该任务
        public bool HasTask(TaskInfoV3_1 obj, out Node item)
        {
            bool ret = false;

            item = null;
            NodeCollection nodeCollect = GetTreeNodeCollect();

            foreach (Node node in nodeCollect)
            {
                if (((SearchItemV3_1)node.Tag).TaskId == obj.TaskId)
                {
                    item = node;
                    return(true);
                }
            }
            return(ret);
        }
Beispiel #24
0
        void m_viewModel_TaskAdded(TaskInfoV3_1 obj)
        {
            if (isClosed)
            {
                return;
            }

            if (InvokeRequired)
            {
                this.Invoke(new Action <TaskInfoV3_1>(m_viewModel_TaskAdded), obj);
            }
            else
            {
                DevComponents.AdvTree.Node n = AddTaskTreeNode(obj);
                advTree1.Nodes.Add(n);
                PageNavigatorChanged();
            }
        }
        void m_viewModel_TaskChanged(TaskInfoV3_1 obj)
        {
            var list = m_viewModel.FrashPage();

            if (list != null)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    m_viewModel_UpdateTaskProgress(i, list[i].TaskId, list[i].Status, list[i].Progress);
                }
                //m_viewModel.FrashProgress();
                for (int i = list.Count; i < m_maxTaskCountPerPage; i++)
                {
                    m_viewModel_UpdateTaskProgress(i, 0, E_VDA_TASK_STATUS.E_TASK_STATUS_NOUSE, 0);
                }
                PageNavigatorChanged();
            }
        }
Beispiel #26
0
        private void ShowSingleTask()
        {
            TaskInfoV3_1 t = null;

            if (advTree1.SelectedNode.Tag is TaskInfoV3_1)
            {
                t = advTree1.SelectedNode.Tag as TaskInfoV3_1;
            }
            if (t != null)
            {
                m_currentShownTask               = new FormSingleRealtimeTask(t);
                m_currentShownTask.WindowState   = FormWindowState.Normal;
                m_currentShownTask.StartPosition = FormStartPosition.CenterParent;
                if (m_currentShownTask.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                }
                m_currentShownTask = null;
            }
        }
        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 = "";
                    }
                }
            }
        }
Beispiel #28
0
        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;
                }
            }
        }
Beispiel #30
0
        void m_viewModel_TaskModified(TaskInfoV3_1 obj)
        {
            if (isClosed)
            {
                return;
            }

            if (InvokeRequired)
            {
                this.Invoke(new Action <TaskInfoV3_1>(m_viewModel_TaskModified), obj);
            }
            else
            {
                try
                {
                    var node = advTree1.FindNodeByText(obj.TaskId.ToString());
                    if (node != null)
                    {
                        int index   = node.Index;
                        var newnode = AddTaskTreeNode(obj);
                        newnode.Expanded = node.Expanded;
                        advTree1.Nodes.RemoveAt(index);
                        advTree1.Nodes.Insert(index, newnode);

                        if (m_currentShownTask != null && m_currentShownTask.Created && m_currentShownTask.TaskId == obj.TaskId)
                        {
                            m_currentShownTask.UpdateTask(obj);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MyLog4Net.Container.Instance.Log.Error("m_viewModel_UpdateTaskProgress" + ex);

                    return;
                }
            }
        }