Esempio n. 1
0
        public async Task <int> Translate(string toTranslate, string sourceLanguage, string targetLanguage)
        {
            Task <TranslationResult> response = Task.Run(async() => await client.TranslateTextAsync(toTranslate, targetLanguage, sourceLanguage));

            await response;
            var   args = new TranslationReceivedEventArgs {
                Translation = response.Result.TranslatedText
            };

            Console.WriteLine(args.Translation);
            OnTranslationReceived(args);

            return(0);
        }
Esempio n. 2
0
        protected virtual void OnTranslationReceived(TranslationReceivedEventArgs e)
        {
            var handler = TranslationReceived;

            handler?.Invoke(this, e);
        }