private void btnSalvar_Click(object sender, EventArgs e)
        {
            // var fileContent = string.Empty;
            // var filePath = string.Empty;
            //
            // using (OpenFileDialog openFileDialog = new OpenFileDialog())
            // {
            //     openFileDialog.InitialDirectory = "c:\\";
            //     openFileDialog.Filter = "jpg files (*.jpg)|*.jpg|All files (*.*)|*.*";
            //     openFileDialog.FilterIndex = 2;
            //     openFileDialog.RestoreDirectory = true;
            //     openFileDialog.ShowDialog();
            //     filePath = openFileDialog.FileName;
            //
            //     //if ( == DialogResult.OK)
            //     //{
            //     //Get the path of specified file
            //     //filePath = openFileDialog.FileName;
            //     //Read the contents of the file into a stream
            //     //var fileStream = openFileDialog.OpenFile();
            //     //using (StreamReader reader = new StreamReader(fileStream))
            //     //{
            //     //    fileContent = reader.ReadToEnd();
            //     //}
            //     //}
            // }

            //MessageBox.Show(fileContent, "File Content at path: " + filePath, MessageBoxButtons.OK);

            string nome = "";

            nome = Membro.nm;

            if (nome == "")
            {
                MessageBox.Show("Você precisa digitar primeiro um nome");
                Dispose();
            }
            try
            {
                caminhoImagemSalva = @"C:\Program IBNFU\Fotos\" + nome + ".jpg";
                picImagem.Image.Save(caminhoImagemSalva, ImageFormat.Jpeg);
                MessageBox.Show("Imagem salva com sucesso");
                CaptureInfo.DisposeCapture();
            }
            catch
            {
                // caminhoImagemSalva = @"C:\Program IBNFU\Fotos\Sem Foto.jpg";
                // picImagem.Image.Save(caminhoImagemSalva, ImageFormat.Jpeg);
                MessageBox.Show("Foto não carregada.");
                CaptureInfo.DisposeCapture();
            }

            Dispose();
        }
        private void FormSetup_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (bckGrdWorkerConfigCell.IsBusy)
            {
                bckGrdWorkerConfigCell.CancelAsync();
            }

            if (CameraCaptureInfo1 != null)
            {
                CameraCaptureInfo1.Stop();
                CameraCaptureInfo1.DisposeCapture();
                CameraCaptureInfo1.PreviewWindow = null;
                CameraCaptureInfo1.Dispose();
            }

            if (CameraCaptureInfo2 != null)
            {
                CameraCaptureInfo2.Stop();
                CameraCaptureInfo2.DisposeCapture();
                CameraCaptureInfo2.PreviewWindow = null;
                CameraCaptureInfo2.Dispose();
            }
        }
Beispiel #3
0
 private void frmWebCam_FormClosed(object sender, FormClosedEventArgs e)
 {
     CaptureInfo.DisposeCapture();
 }