private static async Task <string> HiraganaConvertAsync(string docomoApiKey) { var text = "あらゆる現実を全て自分の方へねじ曲げたのだ"; var client = new Hiragana(docomoApiKey); var mode = Hiragana.OutputType.HIRAGANA; var result = await client.ExecAsync(text, mode); return(result); }
private async void HiraganaConvert(object sender, RoutedEventArgs e) { try { HiraganaConvertButton.IsEnabled = true; HiraganaResult.Text = "変換中"; var c = new Hiragana(APIKey); var mode = (Hiragana.OutputType)HiraganaMode.SelectedItem; var text = HiraganaSentence.Text; var result = await Task.Run( async() => await c.ExecAsync(text, mode) ); HiraganaResult.Text = result; } catch (Exception ex) { HiraganaResult.Text = "エラー:" + ex.Message; } finally { HiraganaConvertButton.IsEnabled = true; } }