Hi Body
in start button click event
create an instance of OpenFileDialoge
then showDialoge the instance.
if instance has value, the instance has "File" property which u must open and read it.
If you OpenRead the file, the result is a FileStream
I suggest you to store picture in Database as varbinary (byte[])
Now to convert FileStream to byte array
Please create an instance of BinaryReader and Read Bytes.
following i wrote a piece of code
private void uxStartButton_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog imageDialog = new OpenFileDialog();
imageDialog.Filter = "Sample Pictures (.png)|*.png";
bool? dialogResult = imageDialog.ShowDialog();
if (dialogResult.HasValue && dialogResult.Value)
{
BinaryReader binary = new BinaryReader(imageDialog.File.OpenRead());
byte[] _resultBytes = binary.ReadBytes((int)imageDialog.File.OpenRead().Length);
}
}
To get Picture from Web Cam, create an instance of CaptureSource, then u need to detect exist device. so in static class capture device config, use get available device method.
make completion handler of capture source.
Result of this event is an image,
now the same as up-mentioned , store image to Database