Exemplo n.º 1
0
        private async void GetDefinition(string inputWord)
        {
            FindDefinitionQuery query          = new FindDefinitionQuery(inputWord);
            WordDefinition      wordDefinition = await dispatcher.Execute(query);

            Definition[] definitions = wordDefinition.Definitions;
            btnGetDefinition.IsEnabled = true;
            timer.Stop();
            timer.Enabled        = false;
            pbLoading.Visibility = Visibility.Collapsed;
            txtDefinition.Text   = GetFormatedDefinition(definitions);
        }
        public async Task <WordDefinition> Execute(FindDefinitionQuery query)
        {
            if (query == null)
            {
                throw new ArgumentNullException("query");
            }

            var construtorArgument = new Ninject.Parameters.ConstructorArgument("endpointConfigurationName", EndpointConfigurationName);
            var handler            = _kernel.Get <IWordDefQueryHandler <FindDefinitionQuery, Task <WordDefinition> > >(construtorArgument);

            if (handler == null)
            {
                throw new WordDefQueryHandlerNotFoundException(typeof(FindDefinitionQueryHandler));
            }

            var result = await handler.Execute(query);

            return(result);
        }
 public async Task <WordDefinition> Execute(FindDefinitionQuery query)
 {
     return(await dictServiceClient.DefineAsync(query.SearchWord));
 }