private async void View_Zobraz(object sender, EventArgs e)
        {
            DateTime pocatek = View.Pocatek;
            DateTime konec   = View.Konec;

            try
            {
                if (Form.ActiveForm != null)
                {
                    Form.ActiveForm.Cursor = Cursors.AppStarting;
                }
                await zobrazHandler.HandleAsync(new ZobrazDataCommand(pocatek, konec));
            }
            catch (ArgumentException ex)
            {
                errorDisplayService.Show(ex.Message);
                return;
            }
            catch (InvalidOperationException ex) when(ex.Message.Contains("nejsou k dispozici žádná data"))
            {
                errorDisplayService.Show(ex.Message);
                return;
            }
            catch (MissmatchedTemplateException ex)
            {
                errorDisplayService.Show(ex.Message);
                return;
            }
            finally
            {
                Form.ActiveForm.Cursor = Cursors.Arrow;
            }
        }
Esempio n. 2
0
 private async void ToASCII_Selected(object s, string cesta)
 {
     await command.HandleAsync(new DataToASCIICommand()
     {
         CestaUlozeni   = cesta,
         SloupceToASCII = View.YValues.Where(i => i.Value).Select(i => i.Key),
         Pocatek        = aktualniPocatekZobrazenychDat,
         Konec          = aktualniKonecZobrazenychDat
     });
 }
Esempio n. 3
0
 public Task <Result <Unit, Exception> > InitializeAsync(CancellationToken cancellationToken = default)
 {
     // if database has not already been initialized with seed data, do so
     return(_getSchoolInitializationStatusQueryHandler.HandleAsync(new GetSchoolInitializationStatusQuery(), cancellationToken)
            .BindIfFalseAsync(async() =>
     {
         return await _saveStudentDataCommandHandler.HandleAsync(new SaveStudentDataCommand(CreateStudentSeedData()), cancellationToken)
         .BindAsync(_ => _saveCourseDataCommandHandler.HandleAsync(new SaveCourseDataCommand(CreateCourseSeedData()), cancellationToken))
         .BindAsync(_ => _saveEnrollmentDataCommandHandler.HandleAsync(new SaveEnrollmentDataCommand(CreateEnrollmentSeedData()), cancellationToken));
     }));
 }
Esempio n. 4
0
        public async Task HandleAsync(TCommand command)
        {
            var stopwatch = Stopwatch.StartNew();

            stopwatch.Start();

            await _innerHandler.HandleAsync(command);

            stopwatch.Stop();

            _logger.Info($"{typeof (TCommand).Name}: {stopwatch.ElapsedMilliseconds} ms");
        }
Esempio n. 5
0
        public async Task <IActionResult> AddWord([FromBody] AddWordPostModel postData)
        {
            if (!ModelState.IsValid)
            {
                return(new BadRequestObjectResult(ModelState));
            }

            var command = new AddWordCommand(postData.Word, postData.Answers);
            await _addWordCommandHandler.HandleAsync(command);

            var query       = FindItemsQuery.ByWord(postData.Word);
            var queryResult = await _findItemsQueryHandler.QueryAsync(query);

            var createdItem = queryResult.Single();

            string currentUri = Request?.Path ?? "/Words";

            return(new CreatedResult(currentUri.JoinPaths(createdItem.Id.ToString()), createdItem));
        }
        public async Task HandleAsync(TCommand command)
        {
            await _innerHandler.HandleAsync(command);

            _logger.Info($"Handled {typeof (TCommand).Name} command: {command.ToJson()}");

            _logger.Info($">> {nameof(OutboxMessage)} table:");
            foreach (var message in _dbContext.Set <OutboxMessage>())
            {
                _logger.Info($"   > {message.ToJson()}");
            }

            _logger.Info($">> {nameof(OngoingMessage)} table:");
            foreach (var message in _dbContext.Set <OngoingMessage>())
            {
                _logger.Info($"   > {message.ToJson()}");
            }

            _logger.Info($">> {nameof(FaultMessage)} table:");
            foreach (var message in _dbContext.Set <FaultMessage>())
            {
                _logger.Info($"   > {message.ToJson()}");
            }

            _logger.Info($">> {nameof(SentMessage)} table:");
            foreach (var message in _dbContext.Set <SentMessage>())
            {
                _logger.Info($"   > {message.ToJson()}");
            }

            _logger.Info($">> {nameof(SuspiciousMessage)} table:");
            foreach (var message in _dbContext.Set <SuspiciousMessage>())
            {
                _logger.Info($"   > {message.ToJson()}");
            }
        }
Esempio n. 7
0
 public virtual Task <R> HandleAsync <T, R>(IMessageEnvelope <T> message)
 {
     return(_asyncCommandHandler.HandleAsync <T, R>(message));
 }
        public async Task HandleAsync(TCommand command)
        {
            _logger.Info($"{command.GetType().Name}  ====>  {_innerHandler.GetType().Name}: {command.ToJson()}");

            await _innerHandler.HandleAsync(command);
        }