Exemple #1
0
        private void timer_check_Tick(object state, EventArgs sender)
        {
            if (vlc.IsPlaying())
            {
                this.LB_ServerState.Text      = "正常";
                this.LB_ServerState.ForeColor = Color.White;
            }
            else
            {
                this.LB_ServerState.Text = "异常";
                vlc.release();
                string str = string.Format("SELECT Url FROM tb_param WHERE CamID={0};", this.CBO_CamID.Text);
                try
                {
                    string url = mysql.ExecuteDataTable(str).Rows[0]["Url"].ToString();
                    vlc.playUrl(url, this.Pic_Monitor.Handle);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }

                this.LB_ServerState.ForeColor = Color.Red;
            }
        }
Exemple #2
0
        /// <summary>
        /// 读取日数据
        /// </summary>
        public void ReadDayData(int CamID, HistoryData HD, DateTime date)
        {
            string str = string.Format("select * from pflow_tb_data_hor where CamID={0} and Detecttime like '{1}%';", CamID, date.ToString("yyyy-MM-dd"));

            try
            {
                DataTable dt = mysql.ExecuteDataTable(str);
                if (dt.Rows.Count > 0)
                {
                    ChangeType(dt, HD);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        /// <summary>
        /// 读取摄像头参数
        /// </summary>
        public void ReadCameraParam(DataGridView dgv)
        {
            IsCamFlag = true;
            dgv.AllowUserToAddRows = false;
            addFlag    = false;
            deleteFlag = false;
            index_list.Clear();
            string str = string.Format("SELECT * FROM TB_PARAM");

            try
            {
                dt = mysql.ExecuteDataTable(str);

                dgv.DataSource = dt;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            dgv.Columns[0].Visible = false;
        }
Exemple #4
0
 private void CBO_CamID_Click(object sender, EventArgs e)
 {
     CBO_CamID.Items.Clear();
     try
     {
         DataTable dt = mysql.ExecuteDataTable("SELECT CamID FROM tb_param");
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             CBO_CamID.Items.Add(dt.Rows[i]["CamID"]);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Exemple #5
0
        public void readThresholdFromDB(int camid, Threshold threshold)
        {
            Client.MySqlHelper mysql     = new Client.MySqlHelper();
            string             sqlString = string.Format("SELECT DensityThreshold, SpeedThresshold FROM tb_param WHERE CamID={0};", camid);

            try
            {
                DataTable dt = mysql.ExecuteDataTable(sqlString);
                double.TryParse(dt.Rows[0]["DensityThreshold"].ToString(), out threshold.DensityThreshold);
                double.TryParse(dt.Rows[0]["SpeedThresshold"].ToString(), out threshold.SpeedThresshold);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Exemple #6
0
        public static void readWeatherDetail()
        {
            string        sqlString = string.Format("SELECT * FROM tb_weather WHERE uuid=(SELECT MAX(uuid) FROM tb_weather);");
            WeatherDetail detail    = new WeatherDetail();

            detail.weather = new Weather();
            detail.wind    = new Wind();
            try
            {
                DataTable dt = mysql.ExecuteDataTable(sqlString);
                detail.publish_time        = dt.Rows[0]["time"].ToString();
                detail.weather.info        = dt.Rows[0]["weather"].ToString();
                detail.wind.power          = dt.Rows[0]["wind"].ToString();
                detail.weather.temperature = float.Parse(dt.Rows[0]["temperature"].ToString());
                update(detail);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Exemple #7
0
        private void MultiScreen_VisibleChanged(object sender, EventArgs e)
        {
            if (this.Visible == true)
            {
                this.treeView1.ImageList = this.imageList1;

                for (int i = 0; i < vlc.Count(); i++)
                {
                    if (vlc[i] == null)
                    {
                        vlc[i] = new Client.VLCPlayer();
                    }
                }
                this.treeView1.Nodes[0].Nodes.Clear();
                try
                {
                    dt = mysql.ExecuteDataTable("Select * from tb_param");
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        this.treeView1.Nodes[0].Nodes.Add(dt.Rows[i]["CamID"].ToString());
                        if (!dic.Keys.Contains(dt.Rows[i]["CamID"].ToString()))
                        {
                            dic.Add(dt.Rows[i]["CamID"].ToString(), dt.Rows[i]["url"].ToString());
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    MessageBox.Show("读取参数错误");
                }
            }
            if (this.Visible == false)
            {
                realseSource();
            }
        }