public void Init(ItemClass i) { this.item = i; this.Text = this.Item.Name; this.ImageIndex = this.IsGroup() ? 0 : 1; this.SelectedImageIndex = this.ImageIndex; if (this.Item is GroupClass) { return; } CameraClass c = this.Item as CameraClass; if (c != null) { Motion.PlugIns.IPlugInVideoSource s = c.PlugInVideoSource; if (s != null) { this.ToolTipText = s.LabelText; } } }
private void toolStripButtonTest_Click(object sender, EventArgs e) { string[] j = new string[] { "http://61.220.38.10/axis-cgi/jpg/image.cgi?camera=1", "http://212.98.46.120/axis-cgi/jpg/image.cgi?resolution=352x240", "http://webcam.mmhk.cz/axis-cgi/jpg/image.cgi?resolution=320x240", "http://195.243.185.195/axis-cgi/jpg/image.cgi?camera=1" }; string[] m = new string[] { "http://129.186.47.239/axis-cgi/mjpg/video.cgi?resolution=352x240", "http://195.243.185.195/axis-cgi/mjpg/video.cgi?camera=3", "http://195.243.185.195/axis-cgi/mjpg/video.cgi?camera=4", "http://chipmunk.uvm.edu/cgi-bin/webcam/nph-update.cgi?dummy=garb" }; int n; GroupClass gc = new GroupClass(); gc.Name = Translator.Instance.T("测试摄像头"); CameraTreeNode g = this.NodeAdd(gc, null); for (n = 0; n < m.Length; n++) { CameraClass c = new CameraClass(); c.Name = "MJPEG " + (n + 1); c.Stream = "p1f25f05340a17e6e6acdf656d3360ea0"; Motion.PlugIns.IPlugInVideoSource s = c.PlugInVideoSource; if (s != null) { Motion.PlugIns.IPlugInIPCam p = s as Motion.PlugIns.IPlugInIPCam; if (p != null) { p.Stream = Motion.PlugIns.IPCAM.MJPEG; p.URL = m[n]; if (null == this.NodeAdd(c, g)) { break; } } } } if (n == m.Length) { for (n = 0; n < j.Length; n++) { CameraClass c = new CameraClass(); c.Name = "JPEG " + (n + 1); c.Stream = "p1f25f05340a17e6e6acdf656d3360ea0"; Motion.PlugIns.IPlugInVideoSource s = c.PlugInVideoSource; if (s != null) { Motion.PlugIns.IPlugInIPCam p = s as Motion.PlugIns.IPlugInIPCam; if (p != null) { p.Stream = Motion.PlugIns.IPCAM.JPEG; p.URL = j[n]; if (null == this.NodeAdd(c, g)) { break; } } } } } RootClass.Instance.SaveConfig(); MotionConfiguration.Instance.Save(); }