private void queryBtn_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; ClearLists(); if (this.comboBox1.Text == "" || this.comboBox1.Text == null) { MessageBox.Show("请选择要查询的摄像头ID", "警告"); return; } string cameraID = int.Parse(this.comboBox1.Text).ToString("D2"); //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; } ///// DateTimeInString dtString1 = DateTimeInString.FromDateTime(dateTime1); DateTimeInString dtString2 = DateTimeInString.FromDateTime(dateTime2); Query.ImageDirSys startDir = new ImageDirSys(cameraID, dtString1); Query.ImageDirSys endDir = new ImageDirSys(cameraID, dtString2); imagesFound = ImageSearch.SearchImages(startDir, endDir, RemoteImaging.Query.ImageDirSys.SearchType.PicType); if (imagesFound.Length == 0) { MessageBox.Show(this, "未找到图片"); return; } CalcPagesCount(); currentPage = 1; UpdatePagesLabel(); if (imagesFound == null) { MessageBox.Show("没有搜索到满足条件的图片!", "警告"); return; } this.bestPicListView.Scrollable = true; this.bestPicListView.MultiSelect = false; this.bestPicListView.View = View.LargeIcon; this.bestPicListView.LargeImageList = imageList1; ShowCurrentPage(); Cursor.Current = Cursors.Default; }
private void queryBtn_Click(object sender, EventArgs e) { this.bestPicListView.Clear(); this.imageList1.Images.Clear(); this.secPicListView.Clear(); this.imageList2.Images.Clear(); this.pictureBox1.Image = null; if (this.comboBox1.Text == "" || this.comboBox1.Text == null) { MessageBox.Show("请选择要查询的摄像头ID", "警告"); return; } string cameraID = int.Parse(this.comboBox1.Text).ToString("D2"); //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 year1 = dateTime1.Year.ToString("D4"); string month1 = dateTime1.Month.ToString("D2"); string day1 = dateTime1.Day.ToString("D2"); string hour1 = dateTime1.Hour.ToString("D2"); string minute1 = dateTime1.Minute.ToString("D2"); string second1 = dateTime1.Second.ToString("D2"); string year2 = dateTime2.Year.ToString("D4"); string month2 = dateTime2.Month.ToString("D2"); string day2 = dateTime2.Day.ToString("D2"); string hour2 = dateTime2.Hour.ToString("D2"); string minute2 = dateTime2.Minute.ToString("D2"); string second2 = dateTime2.Second.ToString("D2"); Query.ImageDirSys startDir = new ImageDirSys(cameraID, year1, month1, day1, hour1, minute1, second1); Query.ImageDirSys endDir = new ImageDirSys(cameraID, year2, month2, day2, hour2, minute2, second2); Query.ImageSearch imageSearch = new ImageSearch(); string[] files = imageSearch.SearchImages(startDir, endDir, RemoteImaging.Query.ImageDirSys.SearchType.PicType); if (files == null) { MessageBox.Show("没有搜索到满足条件的图片!", "警告"); return; } this.bestPicListView.Scrollable = true; this.bestPicListView.MultiSelect = false; this.bestPicListView.View = View.LargeIcon; this.bestPicListView.LargeImageList = imageList1; for (int i = 0; i < files.Length; ++i) { this.imageList1.Images.Add(Image.FromFile(files[i])); string text = System.IO.Path.GetFileName(files[i]); ListViewItem item = new ListViewItem() { Tag = files[i], Text = text, ImageIndex = i }; this.bestPicListView.Items.Add(item); } }
private void queryBtn_Click(object sender, EventArgs e) { string cameraID = this.comboBox1.Text; string dataStr1 = this.dateTimePicker1.Text; int indexYear1 = dataStr1.IndexOf("年"); int indexMonth1 = dataStr1.IndexOf("月"); int indexDay1 = dataStr1.IndexOf("日"); string year1 = dataStr1.Substring(0, 4); string month1 = int.Parse(dataStr1.Substring(indexYear1 + 1, indexMonth1 - indexYear1 - 1)).ToString("D2"); string day1 = int.Parse(dataStr1.Substring(indexMonth1 + 1, indexDay1 - indexMonth1 - 1)).ToString("D2"); string timeStr1 = this.timeEdit1.Text; int index1 = timeStr1.IndexOf(":"); int index2 = timeStr1.LastIndexOf(":"); string hour1 = timeStr1.Substring(0, index1); string minute1 = timeStr1.Substring(index1 + 1, index2 - index1 - 1); string second1 = timeStr1.Substring(index2 + 1, timeStr1.Length - index2 - 1); string dataStr2 = this.dateTimePicker2.Text; int indexYear2 = dataStr2.IndexOf("年"); int indexMonth2 = dataStr2.IndexOf("月"); int indexDay2 = dataStr2.IndexOf("日"); string year2 = dataStr2.Substring(0, 4); string month2 = int.Parse(dataStr2.Substring(indexYear2 + 1, indexMonth2 - indexYear2 - 1)).ToString("D2"); string day2 = int.Parse(dataStr2.Substring(indexMonth2 + 1, indexDay2 - indexMonth2 - 1)).ToString("D2"); string timeStr2 = this.timeEdit2.Text; int index3 = timeStr2.IndexOf(":"); int index4 = timeStr2.LastIndexOf(":"); string hour2 = timeStr2.Substring(0, index3); string minute2 = timeStr2.Substring(index3 + 1, index4 - index3 - 1); string second2 = timeStr2.Substring(index4 + 1, timeStr2.Length - index4 - 1); //judge the input validation DateTime dateTime1 = new DateTime(int.Parse(year1), int.Parse(month1), int.Parse(day1), int.Parse(hour1), int.Parse(minute1), int.Parse(second1)); DateTime dateTime2 = new DateTime(int.Parse(year2), int.Parse(month2), int.Parse(day2), int.Parse(hour2), int.Parse(minute2), int.Parse(second2)); if (dateTime1 >= dateTime2) { MessageBox.Show("时间起点不应该大于或者等于时间终点,请重新输入!", "警告"); return; } // this.bestPicListView.Clear(); this.imageList1.Images.Clear(); Query.ImageDirSys startDir = new ImageDirSys(cameraID, year1, month1, day1, hour1, minute1, second1); Query.ImageDirSys endDir = new ImageDirSys(cameraID, year2, month2, day2, hour2, minute2, second2); Query.ImageSearch imageSearch = new ImageSearch(); string[] files = imageSearch.SearchImages(startDir, endDir, RemoteImaging.Query.ImageDirSys.BeginDir); if (files == null) { MessageBox.Show("没有搜索到满足条件的图片!", "警告"); return; } this.bestPicListView.Scrollable = true; this.bestPicListView.MultiSelect = false; this.bestPicListView.View = View.LargeIcon; this.bestPicListView.LargeImageList = imageList1; for (int i = 0; i < files.Length; i++) { this.imageList1.Images.Add(Image.FromFile(files[i])); this.bestPicListView.Items.Add(System.IO.Path.GetFileName(files[i]), i); } }
private void queryBtn_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; ClearLists(); if (this.comboBox1.Text == "" || this.comboBox1.Text == null) { MessageBox.Show("请选择要查询的摄像头ID", "警告"); return; } string cameraID = int.Parse(this.comboBox1.Text).ToString("D2"); //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 year1 = dateTime1.Year.ToString("D4"); string month1 = dateTime1.Month.ToString("D2"); string day1 = dateTime1.Day.ToString("D2"); string hour1 = dateTime1.Hour.ToString("D2"); string minute1 = dateTime1.Minute.ToString("D2"); string second1 = dateTime1.Second.ToString("D2"); string year2 = dateTime2.Year.ToString("D4"); string month2 = dateTime2.Month.ToString("D2"); string day2 = dateTime2.Day.ToString("D2"); string hour2 = dateTime2.Hour.ToString("D2"); string minute2 = dateTime2.Minute.ToString("D2"); string second2 = dateTime2.Second.ToString("D2"); Query.ImageDirSys startDir = new ImageDirSys(cameraID, year1, month1, day1, hour1, minute1, second1); Query.ImageDirSys endDir = new ImageDirSys(cameraID, year2, month2, day2, hour2, minute2, second2); Query.ImageSearch imageSearch = new ImageSearch(); imagesFound = imageSearch.SearchImages(startDir, endDir, RemoteImaging.Query.ImageDirSys.SearchType.PicType); if (imagesFound.Length == 0) { MessageBox.Show(this, "未找到图片"); return; } CalcPagesCount(); currentPage = 1; UpdatePagesLabel(); if (imagesFound == null) { MessageBox.Show("没有搜索到满足条件的图片!", "警告"); return; } this.bestPicListView.Scrollable = true; this.bestPicListView.MultiSelect = false; this.bestPicListView.View = View.LargeIcon; this.bestPicListView.LargeImageList = imageList1; ShowCurrentPage(); Cursor.Current = Cursors.Default; }
private void queryBtn_Click(object sender, EventArgs e) { string cameraID = this.comboBox1.Text; string dataStr1 = this.dateTimePicker1.Text; int indexYear1 = dataStr1.IndexOf("年"); int indexMonth1 = dataStr1.IndexOf("月"); int indexDay1 = dataStr1.IndexOf("日"); string year1 = dataStr1.Substring(0,4); string month1 = int.Parse(dataStr1.Substring(indexYear1+1, indexMonth1-indexYear1-1)).ToString("D2"); string day1 = int.Parse(dataStr1.Substring(indexMonth1+1,indexDay1-indexMonth1-1)).ToString("D2"); string timeStr1 = this.timeEdit1.Text; int index1 = timeStr1.IndexOf(":"); int index2 = timeStr1.LastIndexOf(":"); string hour1 = timeStr1.Substring(0,index1); string minute1 = timeStr1.Substring(index1+1,index2-index1-1); string second1 = timeStr1.Substring(index2+1,timeStr1.Length-index2-1); string dataStr2 = this.dateTimePicker2.Text; int indexYear2 = dataStr2.IndexOf("年"); int indexMonth2 = dataStr2.IndexOf("月"); int indexDay2 = dataStr2.IndexOf("日"); string year2 = dataStr2.Substring(0, 4); string month2 = int.Parse(dataStr2.Substring(indexYear2 + 1, indexMonth2 - indexYear2 - 1)).ToString("D2"); string day2 = int.Parse(dataStr2.Substring(indexMonth2 + 1, indexDay2 - indexMonth2 - 1)).ToString("D2"); string timeStr2 = this.timeEdit2.Text; int index3 = timeStr2.IndexOf(":"); int index4 = timeStr2.LastIndexOf(":"); string hour2 = timeStr2.Substring(0, index3); string minute2 = timeStr2.Substring(index3 + 1, index4 - index3 - 1); string second2 = timeStr2.Substring(index4 + 1, timeStr2.Length - index4 - 1); //judge the input validation DateTime dateTime1 = new DateTime(int.Parse(year1),int.Parse(month1),int.Parse(day1),int.Parse(hour1),int.Parse(minute1),int.Parse(second1)); DateTime dateTime2 = new DateTime(int.Parse(year2), int.Parse(month2), int.Parse(day2), int.Parse(hour2), int.Parse(minute2), int.Parse(second2)); if (dateTime1 >= dateTime2) { MessageBox.Show("时间起点不应该大于或者等于时间终点,请重新输入!","警告"); return; } // this.bestPicListView.Clear(); this.imageList1.Images.Clear(); Query.ImageDirSys startDir = new ImageDirSys(cameraID, year1, month1, day1, hour1, minute1, second1); Query.ImageDirSys endDir = new ImageDirSys(cameraID, year2, month2, day2, hour2, minute2, second2); Query.ImageSearch imageSearch = new ImageSearch(); string[] files = imageSearch.SearchImages(startDir, endDir, RemoteImaging.Query.ImageDirSys.BeginDir); if (files == null) { MessageBox.Show("没有搜索到满足条件的图片!","警告"); return; } this.bestPicListView.Scrollable = true; this.bestPicListView.MultiSelect = false; this.bestPicListView.View = View.LargeIcon; this.bestPicListView.LargeImageList = imageList1; for (int i = 0; i < files.Length; i++) { this.imageList1.Images.Add(Image.FromFile(files[i])); this.bestPicListView.Items.Add(System.IO.Path.GetFileName(files[i]), i); } }