public static void ErrorToLog(string header, Exception occuredException) { try { LogFileWriter tempLogFileWriter = new LogFileWriter(); Task writelog = new Task(() => tempLogFileWriter.writeToLogFile(header, occuredException)); writelog.Start(); } catch { throw; } }
void webCam_ImageCaptured(object source, WebcamEventArgs e) { try { ip = ((System.Drawing.Bitmap)e.WebCamImage).GetHbitmap(); bs = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(ip, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); DeleteObject(ip); _FrameImage.Source = bs; } catch (Exception ErrorException) { LogFileWriter.ErrorToLog("webCam_ImageCaptured", ErrorException); DXMessageBox.Show(ErrorException.Message, CvVariables.SOFTWARE_NAME, MessageBoxButton.OK, MessageBoxImage.Error); } }