using Caliburn.Micro; using Caliburn.Micro.Core; using FurnaceUI.Views.Recipes; using MECF.Framework.UI.Client.CenterViews.Editors.Recipe; namespace FurnaceUI.Common { public static class RecipeTableSelect { public static bool ShowDialog(RecipeDataBase recipeData,string recipeType) { var windowManager = IoC.Get(); RecipeTableSelectDialogViewModel recipeTableSelectDialogView = new RecipeTableSelectDialogViewModel(); recipeTableSelectDialogView.Recipe = recipeData; recipeTableSelectDialogView.IsAlarmRecipe = recipeType.ToLower()=="alarm"; return (bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeTableSelectDialogView, null, "Select Table"); } public static int ShowDialogGetTableIndex(RecipeDataBase recipeData, string recipeType) { var windowManager = IoC.Get(); RecipeTableSelectDialogViewModel recipeTableSelectDialogView = new RecipeTableSelectDialogViewModel(); recipeTableSelectDialogView.Recipe = recipeData; recipeTableSelectDialogView.IsAlarmRecipe = recipeType.ToLower() == "alarm"; if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeTableSelectDialogView, null, "Select Table")) { return recipeTableSelectDialogView.SelectedIndex; } return -1; } public static string ShowDialog(string PrefixPath ,string Name, bool isEditEnable) { RecipeProvider provider = new RecipeProvider(); var recipeContent = provider.LoadRecipe(PrefixPath, Name); RecipeDataBase recipeData = new RecipeDataBase(); if (string.IsNullOrEmpty(recipeContent)) return null; //recipeData.RecipeChamberType = "OriginChamber"; recipeData.InitData(PrefixPath, Name, recipeContent, "PM1"); var windowManager = IoC.Get(); RecipeTableSelectDialogViewModel recipeTableSelectDialogView = new RecipeTableSelectDialogViewModel(); recipeTableSelectDialogView.Recipe = recipeData; recipeTableSelectDialogView.IsEditEnable = isEditEnable; if((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeTableSelectDialogView, null, "Select Table")) { return $"{recipeData.TableIndex}:{recipeData.TableName}"; } return null; } } }