private void MonitorForm_Load(object sender, EventArgs e) { // 初始化数据库连接并打开 pgsql = new PgsqlDB(ConfigurationManager.AppSettings.Get("dbHost"), ConfigurationManager.AppSettings.Get("dbName"), ConfigurationManager.AppSettings.Get("dbUser"), ConfigurationManager.AppSettings.Get("dbPassword")); pgsql.open(); sqlite = new SqliteDB(ConfigurationManager.AppSettings.Get("dbPath")); sqlite.open(); sqlite.initCameraDatabase(); _log.Info("Pgsql DB & SQLite connected!"); // 初始化视频流显示 videoStream = new MJPEGStream(); videoStream.NewFrame += new NewFrameEventHandler(videoStream_NewFrame); _log.Info("Video Stream inited!"); // 保存视频 if (!Directory.Exists("_video_saved")) { Directory.CreateDirectory("_video_saved"); } videoWriter = new AVIWriter(); videoWriter.FrameRate = 2; // 初始化摄像头列表 cameras = sqlite.getCameras(); cameras.ForEach(camera => lbCameras.Items.Add(camera)); }