feat: Add support for thumbnail inclusion in AI processing and enhance UI bindings
This commit is contained in:
parent
cb41c42bb5
commit
7e105e3738
9 changed files with 235 additions and 27 deletions
|
|
@ -1,5 +1,7 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Platform.Storage;
|
||||
using Avalonia.Styling;
|
||||
using Avalonia.Threading;
|
||||
|
|
@ -135,6 +137,11 @@ public partial class AvaloniaMainWindow : Window
|
|||
{
|
||||
// Color is set by typing hex directly in the TextBox.
|
||||
};
|
||||
|
||||
_model.ShowMessageRequested += async (_, args) =>
|
||||
{
|
||||
await ShowMessageDialogAsync(args.Item1, args.Item2);
|
||||
};
|
||||
}
|
||||
|
||||
private bool _isStoppingFaceEncoderForClose;
|
||||
|
|
@ -182,4 +189,48 @@ public partial class AvaloniaMainWindow : Window
|
|||
{
|
||||
_ = this.FindControl<Avalonia.Controls.Button>("ThemeToggleButton");
|
||||
}
|
||||
|
||||
private async Task ShowMessageDialogAsync(string title, string message)
|
||||
{
|
||||
var dialog = new Window
|
||||
{
|
||||
Title = title,
|
||||
Width = 480,
|
||||
CanResize = false,
|
||||
WindowStartupLocation = WindowStartupLocation.CenterOwner,
|
||||
SizeToContent = SizeToContent.Height
|
||||
};
|
||||
|
||||
dialog.Content = BuildMessageDialogContent(message, () => dialog.Close());
|
||||
|
||||
await dialog.ShowDialog(this);
|
||||
}
|
||||
|
||||
private static Control BuildMessageDialogContent(string message, Action closeDialog)
|
||||
{
|
||||
var layout = new StackPanel
|
||||
{
|
||||
Margin = new Thickness(16),
|
||||
Spacing = 12
|
||||
};
|
||||
|
||||
layout.Children.Add(new TextBlock
|
||||
{
|
||||
Text = message,
|
||||
TextWrapping = Avalonia.Media.TextWrapping.Wrap,
|
||||
MaxWidth = 420
|
||||
});
|
||||
|
||||
var closeButton = new Button
|
||||
{
|
||||
Content = "OK",
|
||||
MinWidth = 88,
|
||||
HorizontalAlignment = HorizontalAlignment.Right
|
||||
};
|
||||
|
||||
closeButton.Click += (_, _) => closeDialog();
|
||||
|
||||
layout.Children.Add(closeButton);
|
||||
return layout;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue