Exemplo n.º 1
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            m_viewModel.SearchItems = new DataModel.SearchItemGroup()
            {
                SearchItems = new List <DataModel.SearchItemV3_1>(),
                SearchType  = this.SearchType,
            };
            List <DataModel.SearchItemV3_1> list = buttonSelectSearchItem.Tag as List <DataModel.SearchItemV3_1>;

            if (list != null && list.Count > 0)
            {
                m_viewModel.SearchItems.SearchItems.AddRange(list);
            }


            //m_viewModel.SearchItems.SearchItems.Add(new DataModel.SearchItemV3_1() { CameraID = "1", TaskId = 1, TaskName = "task1", CameraName = "cam1", SearchHandle = 0 });
            //m_viewModel.SearchItems.SearchItems.Add(new DataModel.SearchItemV3_1() { CameraID = "2", TaskId = 1, TaskName = "task2", CameraName = "cam2", SearchHandle = 0 });
            //m_viewModel.SearchItems.SearchItems.Add(new DataModel.SearchItemV3_1() { CameraID = IVX.DataModel.Common.VIRTUAL_CAMERA_ID+"2",TaskId = 1, TaskName = "task3", CameraName = "cam3", SearchHandle = 0 });
            m_viewModel.StartTime = dateTimeStart.Value;
            m_viewModel.StopTime  = dateTimeEnd.Value;
            string msg = "";

            if (m_viewModel.Commit(out msg))
            {
                if (OnOk != null)
                {
                    OnOk(this, e);
                }
            }
            else
            {
                DevComponents.DotNetBar.MessageBoxEx.Show(msg, Framework.Environment.PROGRAM_NAME, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
        private void StartGetTimeline()
        {
            if (!NeedShowTimeLine)
            {
                return;
            }

            DataModel.TaskInfoV3_1 task = timeTrackControl1.Tag as DataModel.TaskInfoV3_1;
            m_viewModel.SearchItems = new DataModel.SearchItemGroup()
            {
                SearchItems = new List <DataModel.SearchItemV3_1>(),
                SearchType  = this.SearchType,
            };
            m_viewModel.SearchItems.SearchItems.Add(task.ToSearchItem());

            m_viewModel.PassLineSet   = new List <PassLine>();
            m_viewModel.RegionSet     = new List <BreakRegion>();
            m_viewModel.PictureData   = new System.Drawing.Bitmap(1, 1);
            m_viewModel.StartTime     = DataModel.Common.ZEROTIME;
            m_viewModel.StopTime      = DataModel.Common.MAXTIME;
            timeTrackControl1.Enabled = false;
            string msg = "";

            if (m_viewModel.Commit(out msg))
            {
            }
            else
            {
                timeTrackControl1.Enabled = false;
                labelMsg.Text             = msg;
            }
        }
        private void buttonOk_Click(object sender, EventArgs e)
        {
            CheckTime ret = DataModel.Common.CheckDataTime(checkBoxST.Checked ? dateTimeStart.Value : new DateTime(2050), checkBoxET.Checked ? dateTimeEnd.Value : new DateTime(2050));

            if ((ret == CheckTime.START_INVALID) && checkBoxST.Checked)
            {
                MessageBox.Show("开始时间不正常!");
                return;
            }
            else if ((ret == CheckTime.END_INVALID) && checkBoxET.Checked)
            {
                MessageBox.Show("结束时间不正常!");
                return;
            }

            //添加资源树
            List <DataModel.SearchItemV3_1> list = null;           //带选择的资源树列表 //= buttonSelectSearchItem.Tag as List<DataModel.SearchItemV3_1>;

            if (m_treeList.IsHasChecked)
            {
                list = m_treeList.GetCheckTSearchList();
            }
            m_viewModel.SearchItems = new DataModel.SearchItemGroup()
            {
                SearchItems = new List <DataModel.SearchItemV3_1>(),
                SearchType  = this.SearchType,
            };
            if (list != null && list.Count > 0)
            {
                m_viewModel.SearchItems.SearchItems.AddRange(list);
            }
            if (pictureBox1.Tag != null && pictureBox1.Tag is SelectedPictureParam)
            {
                SelectedPictureParam param = pictureBox1.Tag as SelectedPictureParam;
                if (param.GlobalRegion.Count >= 4)
                {
                    int x    = Math.Min(Math.Min(param.GlobalRegion[0].X, param.GlobalRegion[1].X), Math.Min(param.GlobalRegion[2].X, param.GlobalRegion[3].X));
                    int y    = Math.Min(Math.Min(param.GlobalRegion[0].Y, param.GlobalRegion[1].Y), Math.Min(param.GlobalRegion[2].Y, param.GlobalRegion[3].Y));
                    int maxx = Math.Max(Math.Max(param.GlobalRegion[0].X, param.GlobalRegion[1].X), Math.Max(param.GlobalRegion[2].X, param.GlobalRegion[3].X));
                    int maxy = Math.Max(Math.Max(param.GlobalRegion[0].Y, param.GlobalRegion[1].Y), Math.Max(param.GlobalRegion[2].Y, param.GlobalRegion[3].Y));
                    int w    = maxx - x;
                    int h    = maxy - y;
                    m_viewModel.ObjRect = new Rectangle(x, y, w, h);
                }
                else
                {
                    m_viewModel.ObjRect = new Rectangle();
                }

                if (param.ParticalRegion.Count >= 4)
                {
                    int x    = Math.Min(Math.Min(param.ParticalRegion[0].X, param.ParticalRegion[1].X), Math.Min(param.ParticalRegion[2].X, param.ParticalRegion[3].X));
                    int y    = Math.Min(Math.Min(param.ParticalRegion[0].Y, param.ParticalRegion[1].Y), Math.Min(param.ParticalRegion[2].Y, param.ParticalRegion[3].Y));
                    int maxx = Math.Max(Math.Max(param.ParticalRegion[0].X, param.ParticalRegion[1].X), Math.Max(param.ParticalRegion[2].X, param.ParticalRegion[3].X));
                    int maxy = Math.Max(Math.Max(param.ParticalRegion[0].Y, param.ParticalRegion[1].Y), Math.Max(param.ParticalRegion[2].Y, param.ParticalRegion[3].Y));
                    int w    = maxx - x;
                    int h    = maxy - y;
                    m_viewModel.ObjDetailRect = new Rectangle(x, y, w, h);
                }
                else
                {
                    m_viewModel.ObjDetailRect = new Rectangle();
                }


                m_viewModel.PassLineSet = param.PassLineList;
                m_viewModel.RegionSet   = param.BreakRegionList;
                m_viewModel.PictureData = param.BasePicture;
            }
            else
            {
                m_viewModel.PassLineSet = new List <PassLine>();
                m_viewModel.RegionSet   = new List <BreakRegion>();
                m_viewModel.PictureData = new System.Drawing.Bitmap(1, 1);
            }
            //m_viewModel.SearchItems.SearchItems.Add(new DataModel.SearchItemV3_1() { CameraID = "1", TaskId = 1, TaskName = "task1", CameraName = "cam1", SearchHandle = 0 });
            //m_viewModel.SearchItems.SearchItems.Add(new DataModel.SearchItemV3_1() { CameraID = "2", TaskId = 1, TaskName = "task2", CameraName = "cam2", SearchHandle = 0 });
            //m_viewModel.SearchItems.SearchItems.Add(new DataModel.SearchItemV3_1() { CameraID = IVX.DataModel.Common.VIRTUAL_CAMERA_ID+"2",TaskId = 1, TaskName = "task3", CameraName = "cam3", SearchHandle = 0 });
            m_viewModel.StartTime = dateTimeStart.Value;
            m_viewModel.StopTime  = dateTimeEnd.Value;
            buttonOk.Enabled      = false;
            string msg = "";

            if (m_viewModel.Commit(out msg))
            {
                if (OnOk != null)
                {
                    OnOk(this, e);
                }
            }
            else
            {
                buttonOk.Enabled = true;
                DevComponents.DotNetBar.MessageBoxEx.Show(msg, Framework.Environment.PROGRAM_NAME, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }