private void initialize() { //Initalize services this.AutomatedAttendanceSystem = new AutomatedAttendanceSystemProxy(); this.FaceRecognitionService = new FaceRecognitionServiceProxy(); this.QRService = new QRServiceProxy(); //Register for messages Messenger.Default.Register <WorkSchedule>(this, (workScheduleMessage) => { if (workScheduleMessage != WorkSchedule.MinValue) { WorkSchedule = workScheduleMessage; } }); Messenger.Default.Register <Messages>(this, (msg) => { if (msg == Messages.ToggleEditMode) { toggleEditMode(); } if (msg == Messages.EnableEditMode) { toggleEditMode(true); } if (msg == Messages.DisableEditMode) { toggleEditMode(false); } }); // if (HasRecord) Messenger.Default.Send <Employee, EmployeeAttendanceTimesViewModel>(CurrentEmployee); }
/// <summary> /// متذ سازنده /// </summary> public MainViewModel() { if (IsInDesignMode) { //Logs = new ObservableCollection<Log>() //{ // new Log() // { // Employee=new Employee(){FirstName="Abbas",LastName="Allahyari"}, // EventTime=DateTime.Now, // AttendanceMethod=AttendanceMethod.FaceDetection, // AttendanceMethodResult=AttendanceMethodResult.Failure // }, //}; } else { AutomatedAttendanceSystem = new AutomatedAttendanceSystemProxy(); FaceRecognitionService = new FaceRecognitionServiceProxy(); QRService = new QRServiceProxy(); this.FRSSettings = FaceRecognitionService.GetSettings(false); retrieveLogs(); } System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("fa-IR"); System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("fa-IR"); }
public void SetUp() { //this.AutomatedAttendanceSystem = new AutomatedAttendanceSystemProxy(); AutomatedAttendanceSystem = MockRepository.GenerateDynamicMockWithRemoting <IAutomatedAttendanceSystem>(); AutomatedAttendanceSystem.Initialize(); AutomatedAttendanceSystem.CreateEmployee(CommonTestCaseSourceProvider.newEmployeeSample()); // AutomatedAttendanceSystem.CreateEmployee(CommonTestCaseSourceProvider.newEmployeeSample()); }
/// <summary> /// متد سازنده /// </summary> public MainViewModel() { if (!IsInDesignMode) { try { //Proxies are created QrService = new QRServiceProxy(); AutomatedAttendanceSystem = new AAS.Proxy.AutomatedAttendanceSystemProxy(); FaceRecognition = new FaceRecognitionServiceProxy(); intitalizeAttendanceMethods(); EmguCVHelper.StartCapture(); EmguCVHelper.CaptureImageIsRefreshed += RefreshImage; m_restTimer = new Timer(3000); m_restTimer.Elapsed += restTimer_Elapsed; } catch (Exception ex) { Exception exep = ex; { MessageBox.Show(exep.Message); } while ((exep = exep.InnerException) != null) { ; } } m_logs = new List <Log>(); } else { Employee employee = new Employee() { FirstName = "احمد", LastName = "رحیمی", Gender = Gender.Male, DateOfBirth = new DateTime(1980, 01, 01), DateOfEmployement = new DateTime(2000, 04, 12), IdentityNumber = "13654", NationalID = new IRNationalID("000-000004-3"), EmployeeID = new EmployeeID(0, 4, 1), ProfilePicture = new Bitmap(@"G:\_DATA\dummy.png"), }; DetectedEmployee = employee; //DetectedEmployee = null; ErrorMessage = (string)Application.Current.FindResource("FRSCouldNotDetect"); AlternativeMethodMessage = (string)Application.Current.FindResource("FRSCouldNotDetectAlternativeMethod"); EntryOrExit = string.Format((string)Application.Current.FindResource("Entry")); EntryOrExitHour = DateTime.Now; } }
/// <summary> /// متد سازنده /// </summary> public ManualMethod() { AutomatedAttendanceSystem = new AutomatedAttendanceSystemProxy(); }
/// <summary> /// متن سازنده /// </summary> public MainViewModel() { if (IsInDesignMode) { FilteredEmployees = new ObservableCollection <Employee>() { #region Abbas Allahyari new Employee() { FirstName = "عباس", LastName = "اللهیاری", DateOfBirth = new DateTime(1991, 02, 09), DateOfEmployement = new DateTime(2014, 01, 01), EmployeeID = new EmployeeID(14, 01, 01), NationalID = new IRNationalID("000-000004-3"), IdentityNumber = "13654", ProfilePicture = new Bitmap(@"G:\_DATA\dummy.png") }, #endregion #region Behnam Sajadi new Employee() { FirstName = "بهنام", LastName = "سجادی", DateOfBirth = new DateTime(1994, 02, 09), DateOfEmployement = new DateTime(2014, 01, 02), EmployeeID = new EmployeeID(14, 01, 01), NationalID = new IRNationalID("000-000004-3"), IdentityNumber = "13654", ProfilePicture = new Bitmap(@"G:\_DATA\dummy.png") }, #endregion #region Aryan Shams new Employee() { FirstName = "آرین", LastName = "شمس", DateOfBirth = new DateTime(1994, 02, 09), DateOfEmployement = new DateTime(2014, 01, 03), EmployeeID = new EmployeeID(14, 01, 01), NationalID = new IRNationalID("000-000004-3"), IdentityNumber = "13654", ProfilePicture = new Bitmap(@"G:\_DATA\dummy.png") }, #endregion #region Ami Sama new Employee() { FirstName = "آمی", LastName = "سَما", DateOfBirth = new DateTime(1991, 02, 09), DateOfEmployement = new DateTime(2014, 01, 04), EmployeeID = new EmployeeID(14, 01, 01), NationalID = new IRNationalID("000-000004-3"), IdentityNumber = "13654", ProfilePicture = new Bitmap(@"G:\_DATA\dummy.png") }, #endregion }; SelectedEmployeeFilter = (FilteredEmployees as ObservableCollection <Employee>)[0]; RaisePropertyChanged(() => FilteredEmployees); Notification = new Notification() { Message = "اعلان تست", Type = NotificationType.Error, }; FilterMode = true; } else { AutomatedAttendanceSystem = new AutomatedAttendanceSystemProxy(); FaceRecognitionService = new FaceRecognitionServiceProxy(); QRService = new QRServiceProxy(); RetrieveEmployees(); RetrieveAttendanceTimes(); //CurrentAttendanceStatusFitler = AttendanceStatus.All; SearchQueryFilter = string.Empty; CurrentDateFilter = DateTime.Now; FilterMode = false; filterEmployees(); Messenger.Default.Register <Notification>(this, (notification) => { //animation Notification = notification; }); fadeInStoryboard = (Storyboard)Application.Current.FindResource("fadeIn"); fadeeOutStoryboard = (Storyboard)Application.Current.FindResource("fadeOut"); Content = new ContentControl(); Content.Visibility = Visibility.Collapsed; Content.Opacity = 0; Messenger.Default.Register <Messages>(this, (message) => { switch (message) { case Messages.Update: RetrieveEmployees(); break; case Messages.HideEmployeeView: //animation hide(); break; } }); } }