public Bitmap SnapShot() { if (m_streamControl.IsPlaying) { return(m_streamControl.GetCurrentFrame()); } return(null); }
void timer_tick(object sender, EventArgs eventArgs) { if (!isBusy()) { try { Image image = Util.DeepCopy(streamPlayerControler.GetCurrentFrame()); ActionExecutor ae = new ActionExecutor(Util.DeepCopy(image), threshold, viewer, this); ae.ExecuteLazy(); } catch (Exception ex) { //pass frame not ready yet. } } }
public static Bitmap CapturarImagen(StreamPlayerControl visorCamara) { try { if (visorCamara.IsPlaying) { return(visorCamara.GetCurrentFrame()); } else { MessageBox.Show("No se puede capturar la fotografía.\nActualmente no se está recibiendo video", "No fue posible capturar la fotografía", MessageBoxButtons.OK, MessageBoxIcon.Error); return(null); } } catch (ThreadInterruptedException) { throw; } }
public void InsertAttendance(SqlDataReader sqlData, AttendanceDTO dto, StreamPlayerControl streamPlayerControl) { var today = DateTime.Now; SqlDataReader sqlData2 = new AttendanceQuery().SelectWithIdnumberAndToday(dto.ATTENDANCE_IDNUMBER, today.ToString("yyyy-MM-dd")); // 오늘 이미 출근 기록이 있을 경우 if (sqlData2.HasRows) { SharedPreference.Instance.DBM.SqlConn.Close(); MessageBox.Show("오늘은 이미 출근 처리가 되어있습니다."); } else { try { if (streamPlayerControl.IsPlaying) { var picture = streamPlayerControl.GetCurrentFrame(); var image = new BitmapToBitmapImageConverter().Convert(picture, null, null, null); var popup = new CapturePopup(); //(popup.DataContext as CapturePopupViewModel).Message = "정상적으로 출근처리 되었습니다.\n즐거운 하루 되세요!"; //(popup.DataContext as CapturePopupViewModel).Image = image as BitmapImage; if (WindowHelper.CreatePopup(popup, "출근", true) == true) { try { sqlData2.Close(); SharedPreference.Instance.DBM.SqlConn.Close(); new AttendanceQuery().Insert(dto); TodayAttendanceList.Insert(0, new AttendanceModel(dto)); Defines.STAFF_PATH = Defines.CAPTURE_PATH + @"\Staff\" + SharedPreference.Instance.SelectedStaff.STAFF_NameAndIdnumber + @"\"; if (!Directory.Exists(Defines.STAFF_PATH)) { Directory.CreateDirectory(Defines.STAFF_PATH); } picture.Save(Defines.STAFF_PATH + today.ToString("yyyyMMdd") + "_Attendance_" + dto.ATTENDANCE_IDNUMBER + ".bmp"); try { AttendanceLogDTO logDto = new AttendanceLogDTO() { ATTENDANCE_LOG_ADMIN = "출근", ATTENDANCE_LOG_IDNUMBER = SharedPreference.Instance.SelectedStaff.STAFF_IDNUMBER, ATTENDANCE_LOG_BUSINESSDAY = DateTime.Now.ToString("yyyy-MM-dd"), ATTENDANCE_LOG_WHAT = "출근", ATTENDANCE_LOG_LOG = "출근 시간: " + DateTime.Now.ToString("HH:mm:ss"), ATTENDANCE_LOG_REASON = "당일 출근 기록", ATTENDANCE_LOG_UPDATE_DATE = DateTime.Now.ToString("yyyy-MM-dd") }; new AttendanceLogQuery().Insert(logDto); } catch (Exception e) { SharedPreference.Instance.DBM.SqlConn.Close(); MessageBox.Show("기록을 남기는데 실패하셨습니다. 관리자에게 문의하세요.\n에러내용 : " + e.Message); } } catch (Exception e) { sqlData2.Close(); SharedPreference.Instance.DBM.SqlConn.Close(); MessageBox.Show("출근 실패하셨습니다. 관리자에게 문의하세요.\n에러내용 : " + e.Message); } } } else { sqlData2.Close(); SharedPreference.Instance.DBM.SqlConn.Close(); MessageBox.Show("캠이 정상 작동중이지 않습니다. 관리자에게 문의하세요."); } } catch (Exception e) { MessageBox.Show("출근 실패하셨습니다. 관리자에게 문의하세요.\n에러내용 : " + e.Message); } } }