public void SetGroup(GroupClass parent) { foreach (ItemClass i in this.Values) { i.Group = parent; } }
public void Add(ItemClass c, GroupClass parent) { if (false == this.ContainsKey(c.ID)) { c.Group = parent; this.Add(c.ID, c); } }
public void MoveTo(GroupClass dst) { if (dst == null) { dst = RootClass.Instance as GroupClass; } if (this.Group == dst) { return; } this.Remove(); dst.Children.Add(this, dst); }
public ItemClass Find(string id) { foreach (ItemClass i in this.Children.Values) { if (i.ID == id) { return(i); } if (i is GroupClass) { GroupClass g = i as GroupClass; ItemClass r = g.Find(id); if (r != null) { return(r); } } } return(null); }
public void SaveConfig(IConfigSetting s) { s.RemoveChildren(); foreach (ItemClass i in this.Values) { GroupClass g = i as GroupClass; if (g != null) { IConfigSetting gs = s["group##"]; g.SaveConfig(gs); } else { CameraClass c = i as CameraClass; if (c != null) { IConfigSetting cs = s["camera##"]; c.SaveConfig(cs); } } } }
public void LoadConfig(IConfigSetting s) { XMLConfigSetting section = s as XMLConfigSetting; IList <XMLConfigSetting> list = section.GetNamedChildren("group"); foreach (XMLConfigSetting x in list) { GroupClass g = new GroupClass(x); if (this.ContainsKey(g.ID) == false) { this.Add(g.ID, g); } } list = section.GetNamedChildren("camera"); foreach (XMLConfigSetting x in list) { CameraClass c = new CameraClass(x); if (this.ContainsKey(c.ID) == false) { this.Add(c.ID, c); } } }
public ItemClassCollection(IConfigSetting s, GroupClass parent) { this.LoadConfig(s); this.SetGroup(parent); }
public GroupClass(IConfigSetting i, GroupClass parent) { this.LoadConfig(i); this.Group = parent; }
public CameraClass(IConfigSetting section, GroupClass parent) { this.LoadConfig(section); this.Group = parent; }
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(); }
private void toolStripButtonNewGroup_Click(object sender, EventArgs e) { GroupClass c = new GroupClass(); CameraTreeNode n = this.GetSelectedGroupNode(); if (n != null) { c.Group = n.Item as GroupClass; } c.Name = Translator.Instance.T("新建组"); this.NodeAdd(c); RootClass.Instance.SaveConfig(); MotionConfiguration.Instance.Save(); }