private void OnDeviceEvent()
        {
            if (SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection != _DeviceNr)
            {
                SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Clear();
                _DeviceNr     = SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection;
                _CapabilityNr = 0;

                SWebcamDevice[] d = CWebcam.GetDevices();
                for (int i = 0; i < d[SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection].Capabilities.Count; i++)
                {
                    SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].AddValue(d[_DeviceNr].Capabilities[i].Width.ToString() + " x " + d[_DeviceNr].Capabilities[i].Height.ToString() + " @ " + d[_DeviceNr].Capabilities[i].Framerate.ToString() + "FPS");
                }
                SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Selection = 0;

                _Config.MonikerString = d[SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection].MonikerString;
                _Config.Width         = d[SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection].Capabilities[SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Selection].Width;
                _Config.Height        = d[SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection].Capabilities[SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Selection].Height;
                _Config.Framerate     = d[SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection].Capabilities[SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Selection].Framerate;

                CWebcam.Close();
                CWebcam.Select(_Config);
                CWebcam.Start();
            }
        }
Exemple #2
0
 private static void _CloseProgram()
 {
     // Unloading in reverse order
     try
     {
         CController.Close();
         CVocaluxeServer.Close();
         CGraphics.Close();
         CThemes.Close();
         CCover.Close();
         CFonts.Close();
         CBackgroundMusic.Close();
         CWebcam.Close();
         CDataBase.Close();
         CVideo.Close();
         CRecord.Close();
         CSound.Close();
         CDraw.Close();
     }
     catch (Exception e)
     {
         CLog.LogError("Error during shutdown!", false, false, e);
     }
     GC.Collect(); // Do a GC run here before we close logs to have finalizers run
     try
     {
         CLog.Close(); // Do this last, so we get all log entries!
     }
     catch (Exception) {}
     Environment.Exit(Environment.ExitCode);
 }
        private void OnCapabilitiesEvent()
        {
            if (SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Selection != _CapabilityNr)
            {
                _CapabilityNr = SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Selection;

                SWebcamDevice[] d = CWebcam.GetDevices();
                _Config.MonikerString = d[SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection].MonikerString;
                _Config.Width         = d[SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection].Capabilities[SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Selection].Width;
                _Config.Height        = d[SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection].Capabilities[SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Selection].Height;
                _Config.Framerate     = d[SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection].Capabilities[SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Selection].Framerate;

                CWebcam.Close();
                CWebcam.Select(_Config);
                CWebcam.Start();
            }
        }
Exemple #4
0
 static void CloseProgram()
 {
     // Unloading
     try
     {
         CInput.Close();
         CSound.RecordCloseAll();
         CSound.CloseAllStreams();
         CVideo.VdCloseAll();
         CDraw.Unload();
         CLog.CloseAll();
         CDataBase.CloseConnections();
         CWebcam.Close();
     }
     catch (Exception)
     {
     }
 }
        public override void OnShow()
        {
            base.OnShow();
            SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Clear();
            SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Clear();

            _DeviceNr     = -1;
            _CapabilityNr = -1;

            SWebcamDevice[] devices = CWebcam.GetDevices();

            if (devices != null)
            {
                if (devices.Length > 0)
                {
                    _DeviceNr     = 0;
                    _CapabilityNr = 0;
                    GetFirstConfiguredWebcamDevice(ref _DeviceNr, ref _CapabilityNr);

                    foreach (SWebcamDevice d in devices)
                    {
                        SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].AddValue(d.Name);
                    }
                    SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection = _DeviceNr;

                    foreach (SCapabilities c in devices[_DeviceNr].Capabilities)
                    {
                        SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].AddValue(c.Width.ToString() + " x " + c.Height.ToString() + " @ " + c.Framerate.ToString() + " FPS ");
                    }
                    _Config.MonikerString = devices[SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection].MonikerString;
                    _Config.Width         = devices[SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection].Capabilities[SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Selection].Width;
                    _Config.Height        = devices[SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection].Capabilities[SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Selection].Height;
                    _Config.Framerate     = devices[SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Selection].Capabilities[SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Selection].Framerate;
                    CWebcam.Close();
                    CWebcam.Select(CConfig.WebcamConfig);
                    CWebcam.Start();
                }
            }
            SelectSlides[htSelectSlides(SelectSlideWebcamDevices)].Visible      = (devices != null && devices.Length > 0);
            SelectSlides[htSelectSlides(SelectSlideWebcamCapabilities)].Visible = (devices != null && devices.Length > 0);
            Statics[htStatics(StaticWebcamOutput)].Visible = (devices != null && devices.Length > 0);
        }
 public override void OnClose()
 {
     base.OnClose();
     CWebcam.Close();
 }