Beispiel #1
0
 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
     {
     }
 }
Beispiel #2
0
 void LoadSnapsFoldersMenu()
 {
     try
     {
         Settings.Cameras c     = new CamMonitor.Settings.Cameras(_Name);
         string           spath = c.GetSnapPath + "\\" + _Name;
         toolStripComboBox1.DropDownItems.Clear();
         toolStripComboBox1.Tag = _SnapPath;
         foreach (string var in Directory.GetDirectories(spath))
         {
             ToolStripItem x = new ToolStripMenuItem();
             x.Tag = var;
             DirectoryInfo d = new DirectoryInfo(var);
             x.Text        = d.Name;
             x.Image       = global::CamMonitor.Properties.Resources.folder;
             x.Click      += new EventHandler(x_Click);
             x.ToolTipText = "Open Snapsot Folder (" + x.Text + ")";
             toolStripComboBox1.DropDownItems.Add(x);
         }
         if (toolStripComboBox1.DropDownItems.Count < 1)
         {
             toolStripComboBox1.Visible = false;
         }
         else
         {
             toolStripComboBox1.Visible = true;
         }
     }
     catch
     {
         toolStripComboBox1.Visible = false;
     }
 }
Beispiel #3
0
        public void LoadCamInfo()
        {
            try
            {
                Settings.Cameras c = new CamMonitor.Settings.Cameras(_Name);
                toolStripStatusLabel3.Text = _Name;
                _IP                 = c.URL;
                _VideoPath          = c.GetVideoPath;
                __VideoPath         = c.GetVideoPath;
                _VideoPath         += "\\" + _Name + "\\" + DateTime.Now.ToString("MMMM") + "\\" + DateTime.Now.ToString("dd") + "\\";
                _SnapPath_root      = _SnapPath = c.GetSnapPath;
                _SnapPath          += "\\" + _Name + "\\" + DateTime.Now.ToString("MMMM") + "\\" + DateTime.Now.ToString("dd") + "\\";
                _CamType            = c.CamType;
                _UserName           = c.UserName;
                _Pass               = c.Password;
                _CamWidth           = c.CamWidth;
                _CamHeigh           = c.CamHeigh;
                _RecordType         = Settings.General.RecordType;
                intervalsToSaveSnap = Settings.General.SnapPictureEvery;

                LoadSnapsFoldersMenu(); LoadVideoFoldersMenu();
            }
            catch
            {
            }
        }
Beispiel #4
0
 void SendToMail()
 {
     Settings.Cameras x = new CamMonitor.Settings.Cameras(_Name);
     if (x.EnableAlertByEmail)
     {
         clsMail.SendMail(Settings.MailConfig.MailTo, Settings.MailConfig.MailSubject.Replace("%CameraName%", _Name), "<html><body>" + Settings.MailConfig.MailBody.Replace("%CameraName%", _Name) + "</html></body>", "", GetSnapShot());
     }
 }
Beispiel #5
0
 private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
 {
     if (!isPressed)
     {
         return;
     }
     Size += new Size(e.X - buffer.X, e.Y - buffer.Y);
     Settings.Cameras x = new CamMonitor.Settings.Cameras(_Name);
     x.CamHeigh = Size.Height;
     x.CamWidth = Size.Width;
 }
Beispiel #6
0
        private void BuildMainMenu()
        {
            try
            {
                BuilCamMenu();

                string[] cams = Settings.Cameras.GetCameras;
                TreeNode Cams = new TreeNode();
                Cams.SelectedImageIndex = 2;
                Cams.ImageIndex         = 2;
                treeView1.Nodes.Clear();
                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)
                    {
                        TreeNode Cam = new TreeNode();
                        Cam.Text             = CamName;
                        Cam.ContextMenuStrip = mnuCamera;
                        Cam.Tag                = CamName;
                        Cam.ToolTipText        = x.URL + "\n" + x.Desc;
                        Cam.SelectedImageIndex = 0;
                        Cam.ImageIndex         = 0;
                        Cams.Nodes.Add(Cam);
                    }
                }


                Cams.Text        = "All Cameras";
                Cams.Tag         = "allcams";
                Cams.ToolTipText = "View All Cameras";
                Cams.Expand();
                treeView1.Nodes.Add(Cams);
                TreeNode ViewMode = new TreeNode("View Mode", 2, 2);
                TreeNode View1    = new TreeNode("Small Size", 1, 1); View1.Tag = "small";
                TreeNode View2    = new TreeNode("Medium Size", 1, 1); View2.Tag = "medium";
                TreeNode View3    = new TreeNode("Big Size", 1, 1); View3.Tag = "Big";
                TreeNode View4    = new TreeNode("Fill Screen", 1, 1); View4.Tag = "fill";
                ViewMode.Nodes.Add(View1); ViewMode.Nodes.Add(View2); ViewMode.Nodes.Add(View3); ViewMode.Nodes.Add(View4);
                ViewMode.Expand();
                ViewMode.Tag = "Views";
                treeView1.Nodes.Add(ViewMode);
            }
            catch
            {
            }
        }
Beispiel #7
0
        void SaveCamInfo()
        {
            try
            {
                if (textBox1.Text.Length < 1)
                {
                    MessageBox.Show("you must Set The Camera Address", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign ^ MessageBoxOptions.RtlReading);
                    return;
                }
                if (txtVideoFolder.Text.Length < 1)
                {
                    MessageBox.Show("you must Set The Video Folder", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign ^ MessageBoxOptions.RtlReading);
                    return;
                }
                if (txtSnapFolder.Text.Length < 1)
                {
                    MessageBox.Show("you must Set The Snapsot Folder", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign ^ MessageBoxOptions.RtlReading);
                    return;
                }
                Settings.Cameras c = new CamMonitor.Settings.Cameras(_Name);
                c.Auth = checkBox2.Checked;
                c.EnableMotionDetect = checkBox1.Checked;
                c.EnableAlertBySMS   = checkBox4.Checked;
                c.EnableAlertByEmail = checkBox3.Checked;
                c.URL          = textBox1.Text + "";
                c.Desc         = textBox2.Text;
                c.GetVideoPath = txtVideoFolder.Text;
                c.GetSnapPath  = txtSnapFolder.Text;
                c.UserName     = textBox3.Text;
                if (textBox4.Text.Length > 0)
                {
                    c.Password = (textBox4.Text);
                }
                else
                {
                    c.Password = "";
                }



                Close();
            }
            catch (Exception er)
            {
                string x = er.Message;
            }
        }
Beispiel #8
0
        void LoadCamInfo()
        {
            try
            {
                Settings.Cameras c = new CamMonitor.Settings.Cameras(_Name);

                Text          = _Name + " Properties";
                textBox1.Text = c.URL;
                textBox2.Text = c.Desc;

                txtSnapFolder.Text  = c.GetSnapPath;
                txtVideoFolder.Text = c.GetVideoPath;
                checkBox2.Checked   = c.Auth;
                checkBox1.Checked   = c.EnableMotionDetect;
                checkBox3.Checked   = c.EnableAlertByEmail;
                checkBox4.Checked   = c.EnableAlertBySMS;
                textBox3.Text       = c.UserName;
                textBox4.Text       = c.Password;
            }
            catch
            {
            }
        }
Beispiel #9
0
        void SendMailNotify()
        {
            try
            {
                TimeSpan span = DateTime.Now.Subtract(LastTimeSnapedMail);
                if (DidMailSent)
                {
                    if (span.TotalMinutes < intervalsToSaveSnapMail)
                    {
                        return;
                    }
                }
                Settings.Cameras cam = new CamMonitor.Settings.Cameras(_Name);
                if (!Settings.General.EnableEmailNotify)
                {
                    return;
                }
                if (!cam.EnableAlertByEmail)
                {
                    return;
                }


                DateTime date     = DateTime.Now;
                String   fileName = _SnapPath + String.Format("{0}-{1}-{2} {3}-{4}-{5}.jpg",
                                                              date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second);
                camera.LastFrame.Save(fileName, System.Drawing.Imaging.ImageFormat.Jpeg);

                clsMail.SendMail(Settings.MailConfig.MailTo, Settings.MailConfig.MailSubject, Settings.MailConfig.MailBody.Replace("%CameraName%", _Name), "", fileName);

                LastTimeSnapedMail = DateTime.Now;
                DidMailSent        = true;
            }
            catch
            {
            }
        }