diff --git a/KeyManager.Library.UI/KeyActionButtonsControl.xaml b/KeyManager.Library.UI/KeyActionButtonsControl.xaml index e14e075..27b945b 100644 --- a/KeyManager.Library.UI/KeyActionButtonsControl.xaml +++ b/KeyManager.Library.UI/KeyActionButtonsControl.xaml @@ -47,6 +47,9 @@ + diff --git a/KeyManager.Library.UI/KeyActionButtonsControl.xaml.cs b/KeyManager.Library.UI/KeyActionButtonsControl.xaml.cs index ac65c7f..fa78e36 100644 --- a/KeyManager.Library.UI/KeyActionButtonsControl.xaml.cs +++ b/KeyManager.Library.UI/KeyActionButtonsControl.xaml.cs @@ -1,6 +1,7 @@ using Leosac.KeyManager.Library.KeyStore; using Leosac.KeyManager.Library.UI.Domain; using Microsoft.Win32; +using System.Speech.Synthesis; using System.Windows; using System.Windows.Controls; @@ -125,5 +126,26 @@ private void BtnPrint_Click(object sender, RoutedEventArgs e) printDialog.PrintVisual(control, "Leosac Key Manager - Key Printing"); } } + + private void BtnSpeech_Click(object sender, RoutedEventArgs e) + { + var key = Key.GetAggregatedValueAsString(); + Task.Run(() => + { + var promptBuilder = new PromptBuilder(); + var promptStyle = new PromptStyle + { + Volume = PromptVolume.Default, + Rate = PromptRate.ExtraSlow + }; + promptBuilder.StartStyle(promptStyle); + promptBuilder.AppendTextWithHint(key, SayAs.SpellOut); + promptBuilder.EndStyle(); + + using var synthesizer = new SpeechSynthesizer(); + synthesizer.SetOutputToDefaultAudioDevice(); + synthesizer.Speak(promptBuilder); + }); + } } } diff --git a/KeyManager.Library.UI/KeyManager.Library.UI.csproj b/KeyManager.Library.UI/KeyManager.Library.UI.csproj index b22b15f..4c0e061 100644 --- a/KeyManager.Library.UI/KeyManager.Library.UI.csproj +++ b/KeyManager.Library.UI/KeyManager.Library.UI.csproj @@ -36,6 +36,7 @@ + diff --git a/KeyManager.Library.UI/Properties/Resources.Designer.cs b/KeyManager.Library.UI/Properties/Resources.Designer.cs index 76c3a1f..9d45ac0 100644 --- a/KeyManager.Library.UI/Properties/Resources.Designer.cs +++ b/KeyManager.Library.UI/Properties/Resources.Designer.cs @@ -834,6 +834,15 @@ public static string KeyExportPrint { } } + /// + /// Looks up a localized string similar to Speech. + /// + public static string KeyExportSpeech { + get { + return ResourceManager.GetString("KeyExportSpeech", resourceCulture); + } + } + /// /// Looks up a localized string similar to Local Key Generation. /// diff --git a/KeyManager.Library.UI/Properties/Resources.fr.resx b/KeyManager.Library.UI/Properties/Resources.fr.resx index 0618a57..4dc40b4 100644 --- a/KeyManager.Library.UI/Properties/Resources.fr.resx +++ b/KeyManager.Library.UI/Properties/Resources.fr.resx @@ -375,6 +375,9 @@ Export / Impression d'une clé + + Dicter oralement + Génération locale d'une clé diff --git a/KeyManager.Library.UI/Properties/Resources.resx b/KeyManager.Library.UI/Properties/Resources.resx index 4fbd625..65bea91 100644 --- a/KeyManager.Library.UI/Properties/Resources.resx +++ b/KeyManager.Library.UI/Properties/Resources.resx @@ -375,6 +375,9 @@ Key Export / Print + + Speech + Local Key Generation diff --git a/KeyManager.Setup/Product.wxs b/KeyManager.Setup/Product.wxs index 5cf9fa1..85c4a7f 100644 --- a/KeyManager.Setup/Product.wxs +++ b/KeyManager.Setup/Product.wxs @@ -324,6 +324,9 @@ + + +