Exemplo n.º 1
0
        public MainWindow()
        {
            var config = new ConfigurationService("testsettings.json");
            var repo   = new SqliteWorkTimeEsRepository(config,
                                                        new MapperConfiguration(opt => opt.AddProfile <DbEventProfile>()).CreateMapper());

            var uow = new WorkTimeUow(repo);

            _workTimeBuildService = new WorkTimeBuildService(repo, new SqliteWorkTimeIdGeneratorService(config));
            var workTime =
                _workTimeBuildService.CreateStartedManually(new User(1, "mpekala"), DateTime.UtcNow.AddMinutes(120));


            workTime.StartManually();

            _alghorithm = new WMonitorAlghorithm(new AlghorithmFaceRecognition(new HcFaceDetection(new ConfigurationService("")), new DnFaceRecognition(), new CaptureService(), new SqliteTestImageRepository(config,
                                                                                                                                                                                                               new MapperConfiguration(opt => opt.AddProfile <DbTestImageProfile>()).CreateMapper())), new WorkTimeEventService(uow, repo, config), config, new MouseKeyboardMonitorService(), new CaptureService());

            _alghorithm.SetWorkTime(workTime);

            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Debug()
                         .WriteTo.Console()
                         .CreateLogger();

            InitializeComponent();
        }
Exemplo n.º 2
0
        public void Create()
        {
            var workTime = _service.CreateStartedManually(new User(1, "mpekala"), DateTime.UtcNow.AddMinutes(60));

            workTime.AggregateId.Should().BeGreaterThan(-1);
            workTime.PendingEvents.Count.Should().Be(0);
        }
Exemplo n.º 3
0
        public void f()
        {
            var workTime =
                _buildService.CreateStartedManually(UserTestUtils.CreateTestUser(), DateTime.UtcNow.AddMinutes(60));

            _service.SetWorkTime(workTime);
            _service.MouseEventBufferSz    = 0;
            _service.KeyboardEventBufferSz = 0;
            workTime.StartManually();

            _service.AddKeyboardEvent(new MonitorEvent()
            {
                EventStart  = DateTime.UtcNow,
                TotalTimeMs = 200,
            });

            _service.AddMouseEvent(new MonitorEvent()
            {
                EventStart  = DateTime.UtcNow,
                TotalTimeMs = 500
            });

            _service.AddKeyboardEvent(new MonitorEvent()
            {
                EventStart  = DateTime.UtcNow.AddSeconds(65),
                TotalTimeMs = 200,
            });
            workTime.PendingEvents.Count.Should().Be(0);

            _service.AddMouseEvent(new MonitorEvent()
            {
                EventStart  = DateTime.UtcNow.AddSeconds(65),
                TotalTimeMs = 500
            });
            workTime.PendingEvents.Count.Should().Be(0);

            var found = _repository.Find(workTime.User, DateTime.UtcNow);

            found.KeyboardActionEvents.Count.Should().Be(1);
            found.MouseActionEvents.Count.Should().Be(1);
        }