This commit is contained in:
@@ -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