void bindPiclist()
        {
            this.picList.Clear();
            this.imageList1.Images.Clear();

            DateTime time   = ImageSearch.getDateTimeStr(videoList.FocusedItem.Tag as string);
            int      cameID = int.Parse(this.comboBox1.Text);

            string[] fileArr = ImageSearch.FacesCapturedAt(time, cameID, true);//得到图片路径
            if (fileArr.Length == 0)
            {
                return;
            }

            for (int i = 0; i < fileArr.Length; ++i)
            {
                this.imageList1.Images.Add(Image.FromFile(fileArr[i]));
                string       text = System.IO.Path.GetFileName(fileArr[i]);
                ListViewItem item = new ListViewItem()
                {
                    Tag        = fileArr[i].ToString(),
                    Text       = text,
                    ImageIndex = i
                };
                this.picList.Items.Add(item);
            }
            this.picList.Scrollable     = true;
            this.picList.MultiSelect    = false;
            this.picList.View           = View.LargeIcon;
            this.picList.LargeImageList = imageList1;
        }
Esempio n. 2
0
        void view_SelectVideoFile(object sender, EventArgs e)
        {
            this.view.ClearFacesList();

            DateTime time = ImageSearch.getDateTimeStr(this.view.SelectedVideoFile);

            this.SearchFacesCapturedAt(this.view.SelectedIP, 2, time);
        }
        void bindPiclist()
        {
            this.picList.Clear();
            this.imageList1.Images.Clear();

            DateTime time = ImageSearch.getDateTimeStr(videoList.FocusedItem.Tag as string);

            Camera selectedCamera = this.comboBox1.SelectedItem as Camera;

            ImagePair[] faces = null;

            try
            {
                faces = SearchProxy.FacesCapturedAt(2, time);
            }
            catch (System.ServiceModel.CommunicationException)
            {
                MessageBox.Show("通讯错误, 请重试");
                IChannel ch = SearchProxy as IChannel;
                if (ch.State == CommunicationState.Faulted)
                {
                    this.CreateProxy();
                }

                return;
            }


            if (faces.Length == 0)
            {
                return;
            }

            foreach (var aFace in faces)
            {
                this.imageList1.Images.Add(aFace.Face);
                string       text = System.IO.Path.GetFileName(aFace.FacePath);
                ListViewItem item = new ListViewItem
                {
                    Tag        = aFace,
                    Text       = text,
                    ImageIndex = this.imageList1.Images.Count - 1,
                };
                this.picList.Items.Add(item);
            }

            this.picList.Scrollable     = true;
            this.picList.MultiSelect    = false;
            this.picList.View           = View.LargeIcon;
            this.picList.LargeImageList = imageList1;
        }
        private void queryBtn_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            this.picList.Clear();

            if (this.comboBox1.Text == "" || this.comboBox1.Text == null)
            {
                MessageBox.Show("请选择要查询的摄像头ID", "警告");
                return;
            }

            Camera selectedCamera = this.comboBox1.SelectedItem as Camera;


            //judge the input validation
            DateTime date1 = this.dateTimePicker1.Value;
            DateTime date2 = this.dateTimePicker2.Value;
            DateTime time1 = this.timeEdit1.Time;
            DateTime time2 = this.timeEdit2.Time;

            DateTime dateTime1 = new DateTime(date1.Year, date1.Month, date1.Day, time1.Hour, time1.Minute, time1.Second);
            DateTime dateTime2 = new DateTime(date2.Year, date2.Month, date2.Day, time2.Hour, time2.Minute, time2.Second);

            if (dateTime1 >= dateTime2)
            {
                MessageBox.Show("时间起点不应该大于或者等于时间终点,请重新输入!", "警告");
                return;
            }

            if (StreamServerProxy != null && IsPlaying)
            {
                try
                {
                    StreamServerProxy.Stop();
                    IsPlaying = false;
                }
                catch (System.ServiceModel.EndpointNotFoundException)
                {
                }
            }

            CreateProxy();
            Video[] videos = null;



            try
            {
                videos = SearchProxy.SearchVideos(2, dateTime1, dateTime2);
            }
            catch (System.ServiceModel.CommunicationException)
            {
                MessageBox.Show("通讯错误, 请重试");
                IChannel ch = SearchProxy as IChannel;
                if (ch.State == CommunicationState.Faulted)
                {
                    this.CreateProxy();
                }

                return;
            }


            if (videos.Length == 0)
            {
                MessageBox.Show("没有搜索到满足条件的视频!", "警告");
                return;
            }

            this.videoList.Items.Clear();

            foreach (Video v in videos)
            {
                string       videoPath = v.Path;
                DateTime     dTime     = ImageSearch.getDateTimeStr(videoPath);//"2009-6-29 14:00:00"
                ListViewItem lvl       = new ListViewItem();
                lvl.Text = dTime.ToString();
                lvl.SubItems.Add(videoPath);
                lvl.Tag = videoPath;

                if (this.faceCapturedRadioButton.Checked)
                {
                    if (v.HasFaceCaptured)
                    {
                        lvl.ImageIndex = 0;
                        videoList.Items.Add(lvl);
                    }
                }

                if (this.allVideoRadioButton.Checked)
                {
                    if (v.HasFaceCaptured)
                    {
                        lvl.ImageIndex = 0;
                    }
                    else
                    {
                        lvl.ImageIndex = 1;
                    }
                    videoList.Items.Add(lvl);
                }
            }

            Cursor.Current = Cursors.Default;
        }
        private void queryBtn_Click(object sender, EventArgs e)
        {
            this.axVLCPlugin21.Toolbar = true;

            this.picList.Clear();

            if (this.comboBox1.Text == "" || this.comboBox1.Text == null)
            {
                MessageBox.Show("请选择要查询的摄像头ID", "警告");
                return;
            }


            int cameraID = int.Parse(this.comboBox1.Text);

            //judge the input validation
            DateTime date1 = this.dateTimePicker1.Value;
            DateTime date2 = this.dateTimePicker2.Value;
            DateTime time1 = this.timeEdit1.Time;
            DateTime time2 = this.timeEdit2.Time;

            DateTime dateTime1 = new DateTime(date1.Year, date1.Month, date1.Day, time1.Hour, time1.Minute, time1.Second);
            DateTime dateTime2 = new DateTime(date2.Year, date2.Month, date2.Day, time2.Hour, time2.Minute, time2.Second);

            if (dateTime1 >= dateTime2)
            {
                MessageBox.Show("时间起点不应该大于或者等于时间终点,请重新输入!", "警告");
                return;
            }

            Video[] videos = FileSystemStorage.VideoFilesBetween(cameraID, dateTime1, dateTime2);

            if (videos.Length == 0)
            {
                MessageBox.Show("没有搜索到满足条件的视频!", "警告");
                return;
            }

            this.videoList.Items.Clear();

            foreach (Video v in videos)
            {
                string       videoPath = v.Path;
                DateTime     dTime     = ImageSearch.getDateTimeStr(videoPath);//"2009-6-29 14:00:00"
                ListViewItem lvl       = new ListViewItem();
                lvl.Text = dTime.ToString();
                lvl.SubItems.Add(videoPath);
                lvl.Tag = videoPath;

                if (faceCapturedVideoRadioButton.Checked == true)
                {
                    if (v.HasFaceCaptured)
                    {
                        lvl.ImageIndex = 0;
                        videoList.Items.Add(lvl);
                    }
                }

                if (AllVideoTypeRadioButton.Checked == true)
                {
                    if (v.HasFaceCaptured)
                    {
                        lvl.ImageIndex = 0;
                    }
                    else
                    {
                        lvl.ImageIndex = 1;
                    }
                    videoList.Items.Add(lvl);
                }
            }
        }
        private void queryBtn_Click(object sender, EventArgs e)
        {
            this.picList.Clear();

            if (this.comboBox1.Text == "" || this.comboBox1.Text == null)
            {
                MessageBox.Show("请选择要查询的摄像头ID", "警告");
                return;
            }


            int cameraID = int.Parse(this.comboBox1.Text);

            //judge the input validation
            DateTime date1 = this.dateTimePicker1.Value;
            DateTime date2 = this.dateTimePicker2.Value;
            DateTime time1 = this.timeEdit1.Time;
            DateTime time2 = this.timeEdit2.Time;

            DateTime dateTime1 = new DateTime(date1.Year, date1.Month, date1.Day, time1.Hour, time1.Minute, time1.Second);
            DateTime dateTime2 = new DateTime(date2.Year, date2.Month, date2.Day, time2.Hour, time2.Minute, time2.Second);

            if (dateTime1 >= dateTime2)
            {
                MessageBox.Show("时间起点不应该大于或者等于时间终点,请重新输入!", "警告");
                return;
            }

            string[] files = FileSystemStorage.FindVideos(cameraID, dateTime1, dateTime2);

            if (files == null)
            {
                MessageBox.Show("没有搜索到满足条件的视频!", "警告");
                return;
            }

            this.videoList.Items.Clear();

            foreach (string file in files)
            {
                DateTime     dTime = imgSearch.getDateTimeStr(file);//"2009-6-29 14:00:00"
                ListViewItem lvl   = new ListViewItem();

                #region
                if (radioButton1.Checked == true)
                {
                    if (imgSearch.getPicFiles(file, this.comboBox1.Text, true).Length > 0)
                    {
                        lvl.Text = file;
                        lvl.SubItems.Add(dTime.ToString());
                        videoList.Items.Add(lvl);
                        lvl.ImageIndex = 0;
                    }
                }

                if (radioButton2.Checked == true)
                {
                    lvl.Text = file;
                    lvl.SubItems.Add(dTime.ToString());
                    videoList.Items.Add(lvl);
                    if (imgSearch.getPicFiles(file, this.comboBox1.Text, true).Length > 0)
                    {
                        lvl.ImageIndex = 0;
                    }
                    else
                    {
                        lvl.ImageIndex = 1;
                    }
                }
                #endregion
            }
        }