leerform recipe subsystem created
This commit is contained in:
26
Plugins/LindtLeerformPlugin/LeerformRecipeCreationTool.cs
Normal file
26
Plugins/LindtLeerformPlugin/LeerformRecipeCreationTool.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user