コード例 #1
0
        //////////////////////////////////////////////////////////////////////////**********20151102
        //初始化数据库
        private int InitialDatabase()
        {
            string strConnName = null;

            try
            {
                strConnName = ParseConfigFile.GetAppConfig("db_which");
                m_strConn   = ConfigurationManager.ConnectionStrings[strConnName].ConnectionString;
                m_Conn      = new MySqlConnection(m_strConn);
            }
            catch (System.Exception)
            {
                return(-1);
            }
            try
            {
                string strQuery = "SELECT roadName FROM roadinfotb";
                DatabaseUtil.QueryData2ComboBox(strQuery, m_Conn, "roadName", this.comboBox_RoadNames);
            }
            catch (System.Exception)
            {
                return(-2);
            }
            return(0);
        }
コード例 #2
0
        private string m_strSavedPhotoName = null;                  //存储需要保存的照片的名称


        //////////////////////////////////////////////////////////////////////////**********20151102
        //初始化摄像头
        private int InitialCamera()
        {
            int camIndex = 0;

            try
            {
                camIndex = Convert.ToInt32(ParseConfigFile.GetAppConfig("camera_index"));
            }
            catch (System.Exception)
            {
                return(-1);
            }
            try
            {
                m_Capture = new Capture(camIndex);
                m_Capture.ImageGrabbed += ProcessSingleFrame;
            }
            catch (System.Exception)
            {
                m_Capture = null;
                return(-2);
            }
            return(0);
        }