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(); } }
private void OnWebcam() { _Snapshot = null; CWebcam.Start(); CWebcam.GetFrame(ref _WebcamTexture); Buttons[htButtons(ButtonSaveSnapshot)].Visible = false; Buttons[htButtons(ButtonDiscardSnapshot)].Visible = false; Buttons[htButtons(ButtonTakeSnapshot)].Visible = true; Buttons[htButtons(ButtonWebcam)].Visible = false; }
private void _OnWebcam() { if (!CWebcam.IsDeviceAvailable()) { _Buttons[_ButtonWebcam].Visible = false; return; } _Snapshot = null; CWebcam.Start(); _Buttons[_ButtonSaveSnapshot].Visible = false; _Buttons[_ButtonDiscardSnapshot].Visible = false; _Buttons[_ButtonTakeSnapshot].Visible = true; _Buttons[_ButtonWebcam].Visible = false; _SelectElement(_Buttons[_ButtonTakeSnapshot]); }
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(); } }
private void _OnCapabilitiesEvent() { if (_SelectSlides[_SelectSlideWebcamCapabilities].Selection != _CapabilityNr) { _CapabilityNr = _SelectSlides[_SelectSlideWebcamCapabilities].Selection; SWebcamDevice d = CWebcam.GetDevices()[_DeviceNr]; _Config.MonikerString = d.MonikerString; _Config.Width = d.Capabilities[_CapabilityNr].Width; _Config.Height = d.Capabilities[_CapabilityNr].Height; _Config.Framerate = d.Capabilities[_CapabilityNr].Framerate; if (CWebcam.Select(_Config)) { CWebcam.Start(); } } }
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); }