This commit is contained in:
1 parent
7ef0c95a73
commit
fedfceb81d
10 files changed
+435
-14
No files matched your search
@@ -0,0 +1,35 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using LehrerApp.Desktop.ViewModels.Groups;
|
||||
|
||||
namespace LehrerApp.Desktop.Views.Groups;
|
||||
|
||||
public partial class AiResponseRescueDialog : Window
|
||||
{
|
||||
public AiResponseRescueDialog() => InitializeComponent();
|
||||
|
||||
private void OnValidateSelection(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (DataContext is not AiResponseRescueDialogViewModel vm) return;
|
||||
var candidate = string.IsNullOrWhiteSpace(ResponseTextBox.SelectedText)
|
||||
? ResponseTextBox.Text ?? ""
|
||||
: ResponseTextBox.SelectedText;
|
||||
vm.ParseSelection(candidate);
|
||||
}
|
||||
|
||||
private void OnImportIntoExisting(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (DataContext is not AiResponseRescueDialogViewModel vm || !vm.CanImportIntoExisting) return;
|
||||
vm.ImportIntoExistingCommand.Execute(null);
|
||||
if (vm.Result) Close(true);
|
||||
}
|
||||
|
||||
private void OnImportAsNew(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (DataContext is not AiResponseRescueDialogViewModel vm || !vm.HasParsedLesson) return;
|
||||
vm.ImportAsNewCommand.Execute(null);
|
||||
if (vm.Result) Close(true);
|
||||
}
|
||||
|
||||
private void OnCancel(object? sender, RoutedEventArgs e) => Close(false);
|
||||
}
|
||||
Reference in new issue
Block a user