示例#1
0
        private void AddCamera(int videoSourceIndex)
        {
            var oc = new objectsCamera
                         {
                             alerts = new objectsCameraAlerts(),
                             detector = new objectsCameraDetector
                                            {
                                                motionzones =
                                                    new objectsCameraDetectorZone
                                                    [0]
                                            }
                         };
            oc.notifications = new objectsCameraNotifications();
            oc.recorder = new objectsCameraRecorder();
            oc.schedule = new objectsCameraSchedule {entries = new objectsCameraScheduleEntry[0]};
            oc.settings = new objectsCameraSettings();
            oc.ftp = new objectsCameraFtp();

            oc.id = -1;
            oc.directory = RandomString(5);
            oc.ptz = -1;
            oc.x = 0;
            oc.y = 0;
            oc.flipx = oc.flipy = false;
            oc.width = 320;
            oc.height = 240;
            oc.name = "";
            oc.description = "";
            oc.resolution = "320x240";
            oc.newrecordingcount = 0;

            oc.alerts.active = false;
            oc.alerts.mode = "movement";
            oc.alerts.alertoptions = "false,false";
            oc.alerts.objectcountalert = 1;
            oc.alerts.minimuminterval = 180;

            oc.notifications.sendemail = false;
            oc.notifications.sendsms = false;
            oc.notifications.sendmms = false;
            oc.notifications.emailgrabinterval = 0;

            oc.ftp.enabled = false;
            oc.ftp.port = 21;
            oc.ftp.server = "ftp://";
            oc.ftp.interval = 10;
            oc.ftp.filename = "mylivecamerafeed.jpg";
            oc.ftp.ready = true;
            oc.ftp.text = "www.ispyconnect.com";

            oc.schedule.active = false;

            oc.settings.active = false;
            oc.settings.deleteavi = true;
            oc.settings.ffmpeg = iSpyServer.Default.FFMPEG_Camera;
            oc.settings.emailaddress = EmailAddress;
            oc.settings.smsnumber = MobileNumber;
            oc.settings.suppressnoise = true;
            oc.settings.login = "";
            oc.settings.password = "";
            oc.settings.useragent = "Mozilla/5.0";
            oc.settings.frameinterval = 10;
            oc.settings.sourceindex = videoSourceIndex;
            oc.settings.micpair = -1;
            oc.settings.frameinterval = 200;
            oc.settings.framerate = 10;
            oc.settings.timestamplocation = 0;
            oc.settings.timestampformatter = "FPS: {FPS} {0:G} ";
            oc.settings.notifyondisconnect = false;

            oc.settings.youtube = new objectsCameraSettingsYoutube();
            oc.settings.youtube.autoupload = false;
            oc.settings.youtube.category = iSpyServer.Default.YouTubeDefaultCategory;
            oc.settings.youtube.tags = "iSpy, Motion Detection, Surveillance";
            oc.settings.youtube.@public = true;
            oc.settings.desktopresizeheight = 480;
            oc.settings.desktopresizewidth = 640;

            oc.detector.recordondetect = true;
            oc.detector.keepobjectedges = false;
            oc.detector.processeveryframe = 1;
            oc.detector.nomovementinterval = 30;
            oc.detector.movementinterval = 0;
            oc.detector.calibrationdelay = 15;
            oc.detector.color = ColorTranslator.ToHtml(iSpyServer.Default.TrackingColor);
            oc.detector.type = "None";
            oc.detector.postprocessor = "None";
            oc.detector.sensitivity = 80;

            oc.recorder.bufferframes = 30;
            oc.recorder.inactiverecord = 5;
            oc.recorder.timelapse = 0;
            oc.recorder.timelapseframes = 0;
            oc.recorder.maxrecordtime = 900;

            var cameraControl = new CameraWindow(oc) {BackColor = iSpyServer.Default.BackColor};
            _pnlCameras.Controls.Add(cameraControl);

            cameraControl.Location = new Point(oc.x, oc.y);
            cameraControl.Size = new Size(320, 240);
            cameraControl.AutoSize = true;
            cameraControl.BringToFront();
            SetCameraEvents(cameraControl);

            var ac = new AddCamera {CameraControl = cameraControl};
            ac.ShowDialog(this);
            if (ac.DialogResult == DialogResult.OK)
            {
                ac.CameraControl.Camobject.id = iSpyServer.Default.NextCameraID;
                Cameras.Add(oc);
                iSpyServer.Default.NextCameraID++;

                SetNewStartPosition();
                NeedsSync = true;
            }
            else
            {
                cameraControl.Disable();
                _pnlCameras.Controls.Remove(cameraControl);
                cameraControl.Dispose();
            }
            ac.Dispose();
        }
示例#2
0
        internal void EditCamera(objectsCamera cr)
        {
            int cameraId = Convert.ToInt32(cr.id);
            CameraWindow cw = null;

            foreach (Control c in _pnlCameras.Controls)
            {
                if (c.GetType() == typeof (CameraWindow))
                {
                    var cameraControl = (CameraWindow) c;
                    if (cameraControl.Camobject.id == cameraId)
                    {
                        cw = cameraControl;
                        break;
                    }
                }
            }

            if (cw != null)
            {
                var ac = new AddCamera {CameraControl = cw};
                ac.ShowDialog(this);
                ac.Dispose();
            }
        }