public void stopScanner() { scannerHandler.Stop(); if (mc.onGoingMeeting != null) { scannerHandler.InitializeDevice(); scannerHandler.StartCaptureThread(scannerHandler.DoCaptureForMeeting); } }
public UpdateFingerprint(int uid, MeetingController mc) { InitializeComponent(); this.uid = uid; this.mc = mc; scannerHandler = mc.scannerHandler; userModel = new Model <User>(); user = userModel.Get(uid); RegisterCount = 0; if (mc.onGoingMeeting != null) { scannerHandler.Stop(); } scannerHandler.InitializeDevice(); scannerHandler.StartCaptureThread(scannerHandler.DoCaptureForMember); InfoLabel.Content = "Та хуруугаа 3 удаа уншуулна уу."; }
public void CheckMeeting() { DateTime now = DateTime.Now; Console.WriteLine("Status = " + status.ToString()); if (status == IDLE) { Console.WriteLine(now.TimeOfDay); List <Meeting> meetings = FindByDate(now); if (meetings.Count == 0) { return; } bool catchedClosest = false; closestMeeting = null; foreach (Meeting meeting in meetings) { if (meeting.duration > 0) { int regbefminute = meeting is ModifiedMeeting?meetingModel.Get(((ModifiedMeeting)meeting).meeting_id).regMinBefMeeting : meeting.regMinBefMeeting; Console.WriteLine((DateTime.Today + meeting.startDatetime.TimeOfDay).Add(new TimeSpan(0, -regbefminute, 0))); Console.WriteLine(now.TimeOfDay); Console.WriteLine((DateTime.Today + meeting.startDatetime.TimeOfDay).AddMinutes(meeting.duration).TimeOfDay); if (((DateTime.Today + meeting.startDatetime.TimeOfDay).Add(new TimeSpan(0, -regbefminute, 0)) - now).TotalMinutes == 0) { Console.WriteLine("Meeting time occured. Start meeting registration."); status = MEETING_STARTING; StartMeeting(meeting); status = MEETING_STARTED; Console.WriteLine("Setted Status = " + status.ToString()); return; } if (((DateTime.Today + meeting.startDatetime.TimeOfDay).Add(new TimeSpan(0, -regbefminute, 0)) - now).TotalMinutes < 0 && ((DateTime.Today + meeting.startDatetime.TimeOfDay).Add(new TimeSpan(0, meeting.duration, 0)) - now).TotalMinutes > 0) { Console.WriteLine("Detected ongoing meeting. Fast forwarding meeting."); status = MEETING_STARTING; StartMeeting(meeting); status = MEETING_STARTED; Console.WriteLine("Setted Status = " + status.ToString()); return; } if (meeting.startDatetime.TimeOfDay > now.TimeOfDay && catchedClosest == false) { catchedClosest = true; closestMeeting = meeting; } } } if (closestMeeting != null) { Console.WriteLine(now - closestMeeting.startDatetime); } else { Console.WriteLine("No meeting today."); } } else if (status == MEETING_STARTED) { if (scannerHandler.captureThread == null || !scannerHandler.captureThread.IsAlive) { scannerHandler.Stop(); scannerHandler.InitializeDevice(); scannerHandler.StartCaptureThread(scannerHandler.DoCaptureForMeeting); } DateTime date = onGoingArchivedMeeting.meetingDatetime.AddMinutes(onGoingArchivedMeeting.duration); if (date < now) { StopMeeting(); Console.WriteLine("Meeting ended."); } } }