private bool isPlaying = false;//是否正在播放标志位 private void CBO_CamID_SelectedIndexChanged(object sender, EventArgs e) { if (this.CBO_CamID.Text.Equals("")) { MessageBox.Show("请选择线路"); } else if (!int.TryParse(this.CBO_CamID.Text, out CamID)) { MessageBox.Show("请输入正确的线路编号"); } else { CamID = int.Parse(this.CBO_CamID.Text); operation.readThresholdFromDB(CamID, threshold);//读取报警阈值 this.chart_volumn.Series[0].Points.Clear(); if (isPlaying) { vlc.release();//释放VLC资源 } try { //获取摄像头URL string str = string.Format("SELECT * FROM tb_param WHERE CamID={0};", this.CBO_CamID.Text); DataTable dt = mysql.ExecuteDataTable(str); string url = dt.Rows[0]["Url"].ToString(); this.lb_position.Text = "--" + dt.Rows[0]["Position"].ToString() + "--" + dt.Rows[0]["CamID"].ToString(); //播放网络视频,读取url vlc.playUrl(url, this.Pic_Monitor.Handle); // //播放本地视频 /// vlc.playLocalVideo(@"C:\Users\Tony\Desktop\CAM220140529142103.avi", this.Pic_Monitor.Handle); // // isPlaying = true; } catch (Exception ex) { Console.WriteLine(ex.Message); MessageBox.Show("请输入正确编号"); } CBO_CamID.Hide(); Pic_Change.Show(); timer.Start(); timer_Tick(sender, e); timer_check.Start(); HistoryData HD = new HistoryData(); HO.ReadDayData(CamID, HD, DateTime.Now.AddDays(-1)); operation.showAsPieChart(chart_Yes, HD.UpVolume, HD.DownVolume); //昨日饼状图 HO.ReadWeekData(CamID, HD, DateTime.Now.AddDays(-7)); HO.ShowAsBarChart_week_int(chart_lastWeek, HD.TotalVolumeList); //上周柱状图 HO.ReadWeekData(CamID, HD, DateTime.Now); HO.ShowAsBarChart_week_int(chart_week, HD.TotalVolumeList); //本周柱状图 //operation.showAsPieChart(chart_Yes, 123134, 123122); //operation.showAsBarGraph(chart_lastWeek, new List<int>() { 23451, 23453, 52234, 21345, 66774, 77425, 23435 });//上周柱状图 //operation.showAsBarGraph(chart_week, new List<int>() { 53755, 83547, 14356, 45367, 98765, 34213, 47653 });//本周柱状图 } }
private void Pic_Change_Click(object sender, EventArgs e) { Pic_Change.Hide(); CBO_CamID.Show(); }