public void init() { camera = new SanyoNetCamera(); camera.UserName = "******"; camera.Password = "******"; camera.IPAddress = "192.168.1.202"; camera.Connect(); }
private void StartCamera(Camera cam) { ICamera Icam = null; if (string.IsNullOrEmpty(Program.directory)) { SanyoNetCamera camera = new SanyoNetCamera(); camera.IPAddress = cam.IpAddress; camera.UserName = "******"; camera.Password = "******"; try { camera.Connect(); } catch (System.Net.Sockets.SocketException) { MessageBox.Show("无法连接摄像头,请检查摄像头后重新连接"); return; } catch (System.Net.WebException) { MessageBox.Show("无法连接摄像头,请检查摄像头后重新连接"); return; } Icam = camera; StartRecord(cam); Properties.Settings.Default.LastSelCamID = cam.ID; } else { MockCamera mc = new MockCamera(Program.directory); mc.Repeat = true; Icam = mc; } presenter = new Presenter(this, Icam); presenter.Start(); }