Files
HawkeyeVision/Plugins/LindtLeerformPlugin/LeerformRecipeCreationTool.cs
2026-03-31 13:26:26 +02:00

27 lines
764 B
C#

using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using LindtLeerformPlugin.Views;
using VisionBuilder.UI.Common.ViewModel.Interfaces.UI;
namespace LindtLeerformPlugin;
public class LeerformRecipeCreationTool : IRecipeCreationTool
{
public bool Enabled { get; set; } = true;
public async Task<string?> CreateRecipeAsync()
{
if (Application.Current?.ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop)
return null;
var parent = desktop.MainWindow;
if (parent == null)
return null;
var dialog = new RecipeNameDialog();
var result = await dialog.ShowDialog<string?>(parent);
return string.IsNullOrWhiteSpace(result) ? null : result;
}
}