diff --git a/BeWo/AI/Controls/Icon_KI_Chat_Weiss_TEMP.png b/BeWo/AI/Controls/Icon_KI_Chat_Weiss_TEMP.png new file mode 100644 index 000000000..5bdf51d2f Binary files /dev/null and b/BeWo/AI/Controls/Icon_KI_Chat_Weiss_TEMP.png differ diff --git a/BeWo/AI/Controls/VoiceToTextButtonControl.xaml b/BeWo/AI/Controls/VoiceToTextButtonControl.xaml new file mode 100644 index 000000000..f27da309c --- /dev/null +++ b/BeWo/AI/Controls/VoiceToTextButtonControl.xaml @@ -0,0 +1,21 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/BeWo/AI/Controls/VoiceToTextButtonControl.xaml.cs b/BeWo/AI/Controls/VoiceToTextButtonControl.xaml.cs new file mode 100644 index 000000000..2d3968ee3 --- /dev/null +++ b/BeWo/AI/Controls/VoiceToTextButtonControl.xaml.cs @@ -0,0 +1,102 @@ +using BeWo.AI.View; +using BeWo.Services; +using BS.Shared.Translation; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BeWo.AI.Controls +{ + /// + /// Interaktionslogik für VoiceToTextButtonControl.xaml + /// + public partial class VoiceToTextButtonControl : UserControl + { + public static readonly DependencyProperty TargetTextBoxProperty = + DependencyProperty.Register( + nameof(TargetTextBox), + typeof(TextBox), + typeof(VoiceToTextButtonControl)); + + public VoiceToTextButtonControl() + { + InitializeComponent(); + } + + public TextBox TargetTextBox + { + get => (TextBox)GetValue(TargetTextBoxProperty); + set => SetValue(TargetTextBoxProperty, value); + } + + private void ButtonOpenTranskriptionView_Click(object sender, RoutedEventArgs e) + { + OpenTranskriptionView(); + } + + public void OpenTranskriptionView() + { + + var view = new AiTranskriptionView(); + + view.InitView(); + + var factory = new BeWoWindowFactory(); + var beWoWindow = factory.GetAnimatedBeWoWindow(Translator.Translate("BeWoPlaner"), view, 500, 600); + + view.ApplyClicked += (s, e) => + { + if (TargetTextBox != null) + { + InsertTextAtSelection(view.GetText()); + } + + beWoWindow.Close(); + }; + + view.CancelClicked += (s, e) => + { + if (!String.IsNullOrEmpty(view.GetText())) + { + if (MessageBox.Show("Sind Sie sicher, dass Sie abbrechnen und den Text verwerfen möchten?", "Abbrechen", MessageBoxButton.OKCancel) == MessageBoxResult.OK) + { + beWoWindow.Close(); + } + } + else + { + beWoWindow.Close(); + } + + }; + + + + beWoWindow.ShowDialog(); + } + + private void InsertTextAtSelection(string neuerText) + { + int start = TargetTextBox.SelectionStart; + int length = TargetTextBox.SelectionLength; + + TargetTextBox.Text = + TargetTextBox.Text.Remove(start, length) + .Insert(start, neuerText); + + TargetTextBox.CaretIndex = start + neuerText.Length; + } + + } +} diff --git a/BeWo/AI/View/AiTranskriptionView.xaml b/BeWo/AI/View/AiTranskriptionView.xaml new file mode 100644 index 000000000..c78684b1f --- /dev/null +++ b/BeWo/AI/View/AiTranskriptionView.xaml @@ -0,0 +1,222 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +