Dispose() protected method

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool true if managed resources should be disposed; otherwise, false.
return void
Esempio n. 1
0
        private void Wizard()
        {
            var fc = new FindCameras();
            if (fc.ShowDialog(this) == DialogResult.OK)
            {
                SetSourceIndex(fc.VideoSourceType);

                switch (fc.VideoSourceType)
                {
                    case 0:
                        cmbJPEGURL.Text = fc.FinalUrl;
                        txtLogin.Text = fc.Username;
                        txtPassword.Text = fc.Password;
                        CameraControl.Camobject.settings.cookies = fc.Cookies;
                        break;
                    case 1:
                        cmbMJPEGURL.Text = fc.FinalUrl;
                        txtLogin2.Text = fc.Username;
                        txtPassword2.Text = fc.Password;
                        CameraControl.Camobject.settings.cookies = fc.Cookies;
                        break;
                    case 2:
                        cmbFile.Text = fc.FinalUrl;
                        break;
                    case 5:
                        cmbVLCURL.Text = fc.FinalUrl;
                        break;
                }

                if (!String.IsNullOrEmpty(fc.Flags))
                {
                    string[] flags = fc.Flags.Split(',');
                    foreach(string f in flags)
                    {
                        if (string.IsNullOrEmpty(f)) continue;
                        switch(f.ToUpper())
                        {
                            case "FBA":
                                CameraControl.Camobject.settings.forcebasic = true;
                                break;
                        }
                    }
                }
                if (fc.Ptzid>-1)
                {
                    CameraControl.Camobject.ptz = fc.Ptzid;
                    CameraControl.Camobject.ptzentryindex = fc.Ptzentryid;
                    CameraControl.Camobject.settings.ptzchannel = fc.Channel;

                    CameraControl.Camobject.settings.ptzusername = fc.Username;
                    CameraControl.Camobject.settings.ptzpassword = fc.Password;
                    CameraControl.Camobject.settings.ptzurlbase = MainForm.PTZs.Single(p => p.id == fc.Ptzid).CommandURL;
                }

                if (!String.IsNullOrEmpty(fc.AudioModel))
                {
                    var uri = new Uri(fc.FinalUrl);
                    if (!String.IsNullOrEmpty(uri.DnsSafeHost))
                    {
                        CameraControl.Camobject.settings.audioip = uri.DnsSafeHost;
                    }
                    CameraControl.Camobject.settings.audiomodel = fc.AudioModel;
                    CameraControl.Camobject.settings.audioport = uri.Port;
                    CameraControl.Camobject.settings.audiousername = fc.Username;
                    CameraControl.Camobject.settings.audiopassword = fc.Password;
                }
                SetupVideoSource();

                CameraControl.Camobject.name = FriendlyName;

                if (fc.AudioSourceType>-1)
                {
                    var vc = CameraControl.VolumeControl;
                    if (vc == null)
                    {
                        vc = MainForm.InstanceReference.AddCameraMicrophone(CameraControl.Camobject.id, CameraControl.Camobject.name + " mic");
                        CameraControl.Camobject.settings.micpair = vc.Micobject.id;
                        vc.Micobject.alerts.active = false;
                        vc.Micobject.detector.recordonalert = false;
                        vc.Micobject.detector.recordondetect = false;
                        CameraControl.SetVolumeLevel(vc.Micobject.id);
                    }
                    vc.Disable();
                    vc.Micobject.settings.typeindex = fc.AudioSourceType;
                    vc.Micobject.settings.sourcename = fc.AudioUrl;
                    vc.Micobject.settings.needsupdate = true;
                }
                FriendlyName = CameraControl.Camobject.name;
            }
            fc.Dispose();
        }
Esempio n. 2
0
        private void Wizard()
        {
            var fc = new FindCameras();
            if (fc.ShowDialog(this) == DialogResult.OK)
            {
                SetSourceIndex(fc.VideoSourceType);

                switch (fc.VideoSourceType)
                {
                    case 0:
                        cmbJPEGURL.Text = fc.FinalUrl;
                        txtLogin.Text = fc.Username;
                        txtPassword.Text = fc.Password;
                        CameraControl.Camobject.settings.cookies = fc.Cookies;
                        break;
                    case 1:
                        cmbMJPEGURL.Text = fc.FinalUrl;
                        txtLogin2.Text = fc.Username;
                        txtPassword2.Text = fc.Password;
                        CameraControl.Camobject.settings.cookies = fc.Cookies;
                        break;
                    case 2:
                        cmbFile.Text = fc.FinalUrl;
                        break;
                    case 5:
                        cmbVLCURL.Text = fc.FinalUrl;
                        break;
                }

                if (!String.IsNullOrEmpty(fc.Flags))
                {
                    string[] flags = fc.Flags.Split(',');
                    foreach(string f in flags)
                    {
                        if (!string.IsNullOrEmpty(f))
                        {
                            switch(f.ToUpper())
                            {
                                case "FBA":
                                    CameraControl.Camobject.settings.forcebasic = true;
                                    break;
                            }
                        }
                    }
                }
                if (fc.Ptzid>-1)
                {
                    CameraControl.Camobject.ptz = fc.Ptzid;
                    CameraControl.Camobject.ptzentryindex = fc.Ptzentryid;
                    CameraControl.Camobject.settings.ptzchannel = fc.Channel;

                    CameraControl.Camobject.settings.ptzusername = fc.Username;
                    CameraControl.Camobject.settings.ptzpassword = fc.Password;
                    CameraControl.Camobject.settings.ptzurlbase = MainForm.PTZs.Single(p => p.id == fc.Ptzid).CommandURL;
                }

                if (!String.IsNullOrEmpty(fc.AudioModel))
                {
                    var uri = new Uri(fc.FinalUrl);
                    if (!String.IsNullOrEmpty(uri.DnsSafeHost))
                    {
                        CameraControl.Camobject.settings.audioip = uri.DnsSafeHost;
                    }
                    CameraControl.Camobject.settings.audiomodel = fc.AudioModel;
                    CameraControl.Camobject.settings.audioport = uri.Port;
                    CameraControl.Camobject.settings.audiousername = fc.Username;
                    CameraControl.Camobject.settings.audiopassword = fc.Password;
                }
                SetupVideoSource();

            }
            fc.Dispose();
        }