public void Refresh()
{
//To change the video device, a dispose is needed.
if (Capture != null)
{
Capture.Dispose();
Capture = null;
}
//Create capture object.
if (VideoDevice != null)
{
Capture = new CaptureWebcam(VideoDevice) { PreviewWindow = this, Scale = this.Scale() };
Capture.StartPreview();
//Width = Height * ((double)Capture.Width / (double)Capture.Height);
}
}