| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 | 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 RecipeTable CopyTable = null;        public static bool ShowDialog(RecipeDataBase recipeData,string recipeType)        {            var windowManager = IoC.Get<IWindowManager>();            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<IWindowManager>();            RecipeTableSelectDialogViewModel recipeTableSelectDialogView = new RecipeTableSelectDialogViewModel();            recipeTableSelectDialogView.Recipe = recipeData;            recipeTableSelectDialogView.CopyTable = CopyTable;            recipeTableSelectDialogView.IsAlarmRecipe = recipeType.ToLower() == "alarm";            if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeTableSelectDialogView, null, "Select Table"))            {                CopyTable = recipeTableSelectDialogView.CopyTable;                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<IWindowManager>();            RecipeTableSelectDialogViewModel recipeTableSelectDialogView = new RecipeTableSelectDialogViewModel();            recipeTableSelectDialogView.Recipe = recipeData;            recipeTableSelectDialogView.IsEditEnable = isEditEnable;            recipeTableSelectDialogView.CopyTable = CopyTable;            if ((bool)(windowManager as WindowManager)?.ShowDialogWithTitle(recipeTableSelectDialogView, null, "Select Table"))            {                CopyTable = recipeTableSelectDialogView.CopyTable;                return $"{recipeData.TableIndex}:{recipeData.TableName}";            }            return null;        }    }}
 |