c# script support
python server support
This commit is contained in:
@@ -1,22 +1,31 @@
|
||||
using MaterialSkin.Controls;
|
||||
using OpenCvSharp.XImgProc;
|
||||
using System.Text.RegularExpressions;
|
||||
using MaterialSkin.Core.Controls;
|
||||
using OpenCvSharp.Extensions;
|
||||
using VisionBuilder.UI.Common.ViewModel;
|
||||
using VisionBuilder.UI.Common.ViewModel.Classes;
|
||||
using VisionBuilder.UI.Common.ViewModel.Interfaces.UI;
|
||||
|
||||
namespace VisionBuilder.UI.Windows.Dialogs
|
||||
{
|
||||
public partial class RecipeSelectionDialog : MaterialForm
|
||||
{
|
||||
private readonly RecipeSelectionVM _recipeSelectionVm;
|
||||
|
||||
public RecipeSelectionDialog(RecipeSelectionVM recipeSelectionVm)
|
||||
private readonly IRecipeCreationTool _recipeCreationTool;
|
||||
|
||||
public RecipeSelectionDialog(RecipeSelectionVM recipeSelectionVm, IRecipeCreationTool recipeCreationTool)
|
||||
{
|
||||
_recipeSelectionVm = recipeSelectionVm;
|
||||
|
||||
_recipeCreationTool = recipeCreationTool;
|
||||
|
||||
InitializeComponent();
|
||||
ReloadRecipes();
|
||||
|
||||
if (!_recipeCreationTool.Enabled)
|
||||
{
|
||||
btnCreateNewRecipe.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void ReloadRecipes()
|
||||
@@ -38,11 +47,11 @@ namespace VisionBuilder.UI.Windows.Dialogs
|
||||
listView1.LargeImageList.Images.Add("plug", plug);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
recipes.ForEach(x =>
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
if (x.Image != null)
|
||||
@@ -53,7 +62,7 @@ namespace VisionBuilder.UI.Windows.Dialogs
|
||||
}
|
||||
else
|
||||
{
|
||||
listView1.Items.Add(x.RecipeName, x.RecipeName, "plug").Tag=x;
|
||||
listView1.Items.Add(x.RecipeName, x.RecipeName, "plug").Tag = x;
|
||||
}
|
||||
|
||||
});
|
||||
@@ -63,15 +72,23 @@ namespace VisionBuilder.UI.Windows.Dialogs
|
||||
{
|
||||
if (listView1.SelectedIndices.Count > 0)
|
||||
{
|
||||
_recipeSelectionVm.SelectedRecipe = (RecipeData)listView1.SelectedItems[0].Tag!;
|
||||
_recipeSelectionVm.SelectedRecipe = (RecipeData)listView1.SelectedItems[0].Tag!;
|
||||
}
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
}
|
||||
|
||||
private void btnCreateNewRecipe_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MaterialInputBox.Prompt("Create new recipe", "Recipe name", out var recipeName)==DialogResult.OK)
|
||||
{
|
||||
_recipeCreationTool.CreateRecipe(recipeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user