void LoadCams() { try { //flowLayoutPanel1.Controls.Clear(); string[] cams = Settings.Cameras.GetCameras; foreach (string CamName in cams) { Settings.Cameras x = new CamMonitor.Settings.Cameras(CamName); if (x.URL.Length > 0 && x.CamType > 0 && x.GetSnapPath.Length > 0 && x.GetVideoPath.Length > 0) { ctrCamView cc = new ctrCamView(CamName); cc.Tag = CamName; cc.Name = CamName; if (!IsCamAdded(CamName)) { flowLayoutPanel1.Controls.Add(cc); } } } //remove undefine cams for (int i = 0; i < flowLayoutPanel1.Controls.Count; i++) { if (Settings.Cameras.GetCamerasString.IndexOf("" + flowLayoutPanel1.Controls[i].Name) < 0) { ((ctrCamView)flowLayoutPanel1.Controls[i]).StopPlay(); flowLayoutPanel1.Controls.Remove(flowLayoutPanel1.Controls[i]); } } } catch { } }
public frmMain() { InitializeComponent(); if (Settings.Cameras.GetCameras == null) { frmCameraNew x = new frmCameraNew(); x.ShowDialog(); //return; } ctrCamView cc = new ctrCamView("Local"); Controls.Add(cc); }
void LoadCamWindow() { Form x = new Form(); x.MaximizeBox = false; x.MdiParent = this; //x.FormBorderStyle = FormBorderStyle.Fixed3D; ctrCamView cc = new ctrCamView(""); cc.Dock = DockStyle.Fill; x.Controls.Add(cc); x.Show(); }