private void toolStripButtonPlayVideo_Click(object sender, EventArgs e) { if (this.bestPicListView.SelectedItems.Count != 1) { return; } string imgPath = this.bestPicListView.SelectedItems[0].Tag as string; ImageDetail imgInfo = ImageDetail.FromPath(imgPath); string[] videos = FileSystemStorage.FindVideos(imgInfo); if (videos.Length == 0) { MessageBox.Show("未找到相关视频"); return; } VideoPlayer.PlayVideosAsync(videos); }
private void playRelateVideo_Click(object sender, EventArgs e) { Cell c = this.squareListView1.SelectedCell; if (c == null || c.Path == null) { return; } ImageDetail imgInfo = ImageDetail.FromPath(c.Path); string[] videos = FileSystemStorage.FindVideos(imgInfo); if (videos.Length == 0) { MessageBox.Show(this, "没有找到相关视频", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } VideoPlayer.PlayVideosAsync(videos); }
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 } }