Example #1
0
 private bool isPlaying = false;                          //是否正在播放标志位
 private void Btn_Begin_Click(object sender, EventArgs e) //开始监控
 {
     if (Cbo_ID.Text.Equals(""))
     {
         MessageBox.Show("请选择线路");
     }
     else if (!int.TryParse(Cbo_ID.Text, out IDCam))
     {
         MessageBox.Show("请输入正确的线路编号");
     }
     else
     {
         IDCam = int.Parse(Cbo_ID.Text);
         if (isPlaying)
         {
             VLCPlayer.getInstance().release();//释放VLC资源
         }
         try
         {
             //播放网络视频,读取url
             VLCPlayer.getInstance().playUrl(ConfigClass.getInstance().getValue("url" + Cbo_ID.Text), this.PB_Monitor.Handle);
             // //播放本地视频
             //VLCPlayer.getInstance().playLocalVideo(@"C:\Users\Tony\Desktop\CAM220140529142103.avi", this.PB_Monitor.Handle);
             // //
             isPlaying = true;
             timer.Start();
         }
         catch (Exception ex)
         {
             MessageBox.Show("配置文件未找到线路信息,请检查后重试");
         }
     }
 }
Example #2
0
 /// <summary>
 /// 从配置文件读取连接信息
 /// 连接数据库
 /// </summary>
 private bool connectDB()
 {
     connectionString = ConfigClass.getInstance().getValue("connectionString");
     conn             = new MySqlConnection(connectionString);
     try
     {
         conn.Open();
     }
     catch (MySqlException ex)
     {
         return(false);
     }
     if (conn.State == ConnectionState.Open)
     {
         isConnected = true;
     }
     return(true);
 }