Inheritance: ItemClass, IConfigurable, IGlobalization, ICloneable
Exemple #1
0
        public object Clone()
        {
            CameraClass c = new CameraClass();

            this.Copy(c);
            return(c);
        }
Exemple #2
0
        public void Copy(CameraClass c)
        {
            XMLConfig x = new XMLConfig();

            this.SaveConfig(x.Settings["temp"]);
            c.LoadConfig(x.Settings["temp"]);
        }
Exemple #3
0
        public CameraEditForm(CameraClass m)
        {
            InitializeComponent();
            MotionPreference.Instance.UpdateUI(this);

            mCameraClass = m;
            this.cameraViewTest.CameraClass = m;
            this.cameraViewTest.EditMode = true;

            InitPropGrid();
            this.DialogResult = DialogResult.Cancel;
            this.Camera.PlugIns.ToolStripItemsInitialization(this.toolStripEdit.Items);
        }
Exemple #4
0
 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);
             }
         }
     }
 }
Exemple #5
0
        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);
                }
            }
        }
Exemple #6
0
 public CameraTreeNodeDeleteEventArgs(CameraClass c)
     : base(c)
 {
     this.mCancel = false;
 }
Exemple #7
0
 public CameraTreeEventArgs(CameraClass c)
 {
     this.mItem = c;
 }
Exemple #8
0
 public void SetTreeNodeAlarmCount(CameraClass c, int v)
 {
     CameraTreeNode n = this.FindCameraTreeNode(c, null);
     if (n != null)
     {
         try
         {
             n.Text = n.Item.Name + " (" + v.ToString() + ")";
         }
         catch (System.InvalidOperationException e)
         {
             MessageBox.Show(e.Message, MotionPreference.Instance.MessageBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Exemple #9
0
 public object Clone()
 {
     CameraClass c = new CameraClass();
     this.Copy(c);
     return c;
 }
Exemple #10
0
 public bool Remove(CameraClass c)
 {
     foreach (Control t in this.CameraPanel.Controls)
     {
         IView v = t as IView;
         if (v != null)
         {
             if (false == v.Owner.ID.Equals(c.ID))
             {
                 continue;
             }
             if (v is IVideoView)
             {
                 IVideoView x = (IVideoView)v;
                 x.Stop();
             }
             this.CameraPanel.Controls.Remove(v.Me);
             this.ShortcutRemove(v);
             break;
         }
     }
     return true;
 }
Exemple #11
0
 public IVideoView Find(CameraClass c)
 {
     foreach (Control t in this.CameraPanel.Controls)
     {
         IVideoView v = t as IVideoView;
         if (v != null && v.CameraClass.ID == c.ID)
         {
             return v;
         }
     }
     return null;
 }
Exemple #12
0
        public IVideoView Add(CameraClass c)
        {
            IVideoView v;

            if (c == null)
            {
                return null;
            }
            v = this.Find(c);
            if (v == null)
            {
                if (this.AtTheEdge() == true)
                {
                    return null;
                }
                CameraView x = new CameraView();
                x.CameraClass = c;
                this.CameraPanel.Controls.Add(x);
                x.ViewRatio = this.ViewRatio;
                x.VisibleChanged += new EventHandler(this.IView_VisibleChanged);

                CameraBoardAddNewEventArgs e = new CameraBoardAddNewEventArgs(x);
                this.OnCameraBoardAddNewEvent(e);
                e = null;
                v = x;
                this.ShortcutAdd(v);
            }
            else
            {
                v.ViewRatio = this.ViewRatio;
                v.Me.Visible = true;
            }
            this.ScrollToView(v.CameraClass.ID);
            return v;
        }
Exemple #13
0
        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();
        }
Exemple #14
0
        private void toolStripButtonNew_Click(object sender, EventArgs e)
        {
            CameraEditForm fmEdit;
            CameraClass m = new CameraClass();

            fmEdit = new CameraEditForm(m);
            fmEdit.ShowDialog(this);
            if (fmEdit.DialogResult == DialogResult.OK)
            {
                this.NodeAdd(fmEdit.Camera);
                RootClass.Instance.SaveConfig();
                MotionConfiguration.Instance.Save();
            }
        }
Exemple #15
0
 public void SetTreeNodeStatus(CameraClass c, int status)
 {
     CameraTreeNode n = this.FindCameraTreeNode(c, null);
     if (n != null)
     {
         CameraStatus s = new CameraStatus(status);
         if (s.IsStatusSet(CameraStatus.PAUSED))
         {
             n.ImageIndex = 3;
         }
         else if (s.IsStatusSet(CameraStatus.STARTED))
         {
             n.ImageIndex = 2;
         }
         else
         {
             n.ImageIndex = 1;
         }
         n.SelectedImageIndex = n.ImageIndex;
         this.treeViewCamera.SelectedNode = n;
     }
 }
Exemple #16
0
 public PICClass(string fileName, CameraClass owner)
 {
     this.FileName = fileName;
     mOwner        = owner;
 }
Exemple #17
0
 public PICClass(string fileName, CameraClass owner)
 {
     this.FileName = fileName;
     mOwner = owner;
 }
Exemple #18
0
 public void Copy(CameraClass c)
 {
     XMLConfig x = new XMLConfig();
     this.SaveConfig(x.Settings["temp"]);
     c.LoadConfig(x.Settings["temp"]);
 }
Exemple #19
0
 public AVIClass(string file, CameraClass o)
     : base()
 {
     this.FileName = file;
     this.mOwner   = o;
 }
Exemple #20
0
 private void FillGrid(CameraClass c)
 {
     switch (this.Style)
     {
         case CameraBoardStyle.AVI:
             foreach (AVIClass v in c.AVIs)
             {
                 this.FillGrid(v);
                 this.backgroundWorker.ReportProgress(1);
             }
             break;
         case CameraBoardStyle.PIC:
             foreach (PICClass v in c.PICs)
             {
                 this.FillGrid(v);
                 this.backgroundWorker.ReportProgress(1);
             }
             break;
     }
     this.gridList.AutoSizeCells();
 }
Exemple #21
0
 public AVIClass(string file, CameraClass o)
     : base()
 {
     this.FileName = file;
     this.mOwner = o;
 }