3242344232

using Aitex.Core.RT.Log;
using OpenSEMI.Ctrlib.Controls;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Media;
using TUI.CustomControls;
using TUI.Dialog;
using TUI.Models.Recipe;
using TUI.Models.Sys;
using EGC = ExtendedGrid.Microsoft.Windows.Controls;

namespace TUI.Models.PM.Recipe
{
    public partial class RecipeView : UserControl
    {
        public RecipeView()
        {
            InitializeComponent();
            LastSelectItem = null;
            this.AddHandler(PreviewKeyDownEvent, new RoutedEventHandler(Page_PreviewKeyDown));
        }
        private void Page_PreviewKeyDown(object sender, RoutedEventArgs e)
        {
            if (e.OriginalSource.GetType().Name == "Button")
            {
                e.Handled = true;
            }
        }
        private void dgCustom_CurrentCellChanged(object sender, EventArgs e)
        {
            int i = 0;
            foreach (var item in dgCustom.ItemsSource)
            {
                if (i == dgCustom.SelectedIndex)
                {
                    try
                    {
                        EGC.DataGridRow myListBoxItem = (EGC.DataGridRow)dgCustom.ItemContainerGenerator.ContainerFromItem(item);
                        List<TextBoxEx> btnList = FindVisualChild<TextBoxEx>(myListBoxItem);
                        foreach (var item1 in btnList)
                            item1.SelectAll();

                    }
                    catch (Exception ex)
                    {
                        LOG.Error(ex.StackTrace);
                        return;
                    }
                }
                i++;
            }
        }
        List<T> FindVisualChild<T>(DependencyObject obj) where T : DependencyObject
        {
            try
            {
                List<T> list = new List<T>();
                for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
                {
                    DependencyObject child = VisualTreeHelper.GetChild(obj, i);
                    if (child is T)
                    {
                        list.Add((T)child);
                        List<T> childOfChildren = FindVisualChild<T>(child);
                        if (childOfChildren != null)
                        {
                            list.AddRange(childOfChildren);
                        }
                    }
                    else
                    {
                        List<T> childOfChildren = FindVisualChild<T>(child);
                        if (childOfChildren != null)
                        {
                            list.AddRange(childOfChildren);
                        }
                    }
                }

                return list;
            }
            catch (Exception e)
            {
                MMessageBox.Show(e.Message);
                return null;
            }
        }
        TreeViewItem LastSelectItem;
        private void TREE_Selected(object sender, RoutedEventArgs e)
        {
            if (LastSelectItem != null)
            {
                LastSelectItem.IsSelected = false;
            }
            LastSelectItem = (e.OriginalSource as TreeViewItem);
        }
    }
    public class NormalDateTimeToTextConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var dateTime = (DateTime)value;
            if (dateTime == DateTime.MinValue)
            {
                return "";
            }
            return value.DateObjectFormat();
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
    public class VisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if ((int)value == 1)
                return Visibility.Visible;
            else
                return Visibility.Collapsed;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

    public class TreeViewSelectConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

    public class TreeVisibleConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null || parameter == null)
                return Visibility.Hidden;
            if (string.IsNullOrEmpty(value.ToString()) || string.IsNullOrEmpty(parameter.ToString()))
                return Visibility.Hidden;
            return value.ToString() == parameter.ToString() ? Visibility.Visible : Visibility.Collapsed;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

    public class ObjectisNull2VisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null || value.ToString().Trim() == "")
                return Visibility.Hidden;
            else
                return Visibility.Visible;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}

using Aitex.Core.Util;
using Caliburn.Micro;
using Caliburn.Micro.Core;
using TUI.Dialog;
using TUI.Models.Recipe;
using TUI.Models.Sys;
using TUI.ToppanelEvent;
using MECF.Framework.Common.DataCenter;
using OpenSEMI.ClientBase;
using OpenSEMI.ClientBase.Command;
using RecipeEditorLib.DGExtension.CustomColumn;
using RecipeEditorLib.RecipeModel.Params;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Xml;
using OpenSEMI.Ctrlib.Controls;
using OpenSEMI.Ctrlib.ThemeSwitch;
using MECF.Framework.Common.RecipeCenter;
using SciChart.Core.Extensions;
using TUI.CustomControls.Common;

namespace TUI.Models.PM.Recipe
{
    public class RecipeViewModel : UiViewModelBase, IHandle<JobStateMessage>
    {
        private readonly IEventAggregator _event;
        public RecipeViewModel()
        {
            _event = IoC.Get<IEventAggregator>();
            _event.Subscribe(this);
        }
        public bool IsPermission
        {
            get => this.Permission > 2;
        }

        public bool IsReadOnly
        {
            get => this.Permission <= 2;
        }
        public bool IsEnableRecipe
        {
            get
            {
                if (!IsPermission)
                    return false;
                else
                {
                    if (SearchedRcpFiles.Count == 0)
                        return false;
                }
                return true;
            }
        }

        [Subscription("System.RecipeUsing")]
        public List<string> RecipeUsing { get; set; }

        private string Flagname { get; set; }
        public bool IsEnableEdit
        {
            get
            {
                if (!IsPermission)
                    return false;
                else
                {
                    if (!IsSequenceRunRecipe && RecipeUsing.Count != 0)
                        return false;
                }
                return true;
            }
        }

        public bool IsDescReadOnly
        {
            get { return !IsPermission && !IsEnableEdit; }
        }
        public bool IsSequenceRunRecipe
        {
            get
            {
                if (!EnableStep)
                    return false;
                if (EnableStep && RecipeUsing.Count != 0)
                {
                    foreach (var item in RecipeUsing)
                    {
                        if (item == Flagname)
                        {
                            return false;
                        }
                    }
                }
                return true;
            }
        }

        public List<Visibility> PyrometerListVisibility { get; set; }

        private bool isDeacitvated;
        public int Emissivity1MinValue { get; set; }
        public int Emissivity2MinValue { get; set; }
        public int Emissivity3MinValue { get; set; }
        public int Emissivity4MinValue { get; set; }
        public int Emissivity5MinValue { get; set; }
        public int ZoneSum { get; set; }
        public string TemperatureInfrared1Name { get; set; }
        public string TemperatureInfrared2Name { get; set; }
        public string TemperatureInfrared3Name { get; set; }
        public string TemperatureInfrared4Name { get; set; }
        public string TemperatureInfrared5Name { get; set; }
        public string HeaterDeviceType { get; set; }
        protected override void OnInitialize()
        {
            base.OnInitialize();

            this.Recipe = new RecipeData();
            this.Columns = this.columnBuilder.Build();

            this.editMode = EditMode.None;
            RecipeTrue();
            this.Files = new ObservableCollection<FileNode>(RecipeSequenceTreeBuilder.GetFiles(this.recipeProvider.GetRecipes()));
            this.CurrentFileNode = this.Files[0];
            this.SelectDefault(this.CurrentFileNode);

            ZoneSum = (int)QueryDataClient.Instance.Service.GetConfig("PM.Heater.ZoneSum");
            PyrometerListVisibility = new List<Visibility>();
            for (int i = 0; i <= 5; i++)
            {
                PyrometerListVisibility.Add(Visibility.Collapsed);
            }
            for (int i = 1; i <= ZoneSum; i++)
            {
                if ((bool)QueryDataClient.Instance.Service.GetConfig($"PM.TemperatureInfrared.TemperatureInfrared{i}.Online"))
                {
                    PyrometerListVisibility[i] = Visibility.Visible;
                }
            }

            TemperatureInfrared1Name = QueryDataClient.Instance.Service.GetConfig("PM.TemperatureInfrared.TemperatureInfrared1.Name").ToString();
            TemperatureInfrared2Name = QueryDataClient.Instance.Service.GetConfig("PM.TemperatureInfrared.TemperatureInfrared2.Name").ToString();
            TemperatureInfrared3Name = QueryDataClient.Instance.Service.GetConfig("PM.TemperatureInfrared.TemperatureInfrared3.Name").ToString();
            TemperatureInfrared4Name = QueryDataClient.Instance.Service.GetConfig("PM.TemperatureInfrared.TemperatureInfrared4.Name").ToString();
            TemperatureInfrared5Name = QueryDataClient.Instance.Service.GetConfig("PM.TemperatureInfrared.TemperatureInfrared5.Name").ToString();

            HeaterDeviceType = QueryDataClient.Instance.Service.GetConfig("PM.Heater.DeviceType").ToString();

        }
        public Visibility HeaterDeviceTypeVisibility
        {
            get
            {
                if (HeaterDeviceType == "GFXTERMO4" || HeaterDeviceType == "YUDIAN")
                    return Visibility.Collapsed;
                return Visibility.Visible;
            }
        }
        public Visibility HeadDeviceTypeVisibility
        {
            get
            {
                if (HeaterDeviceType == "GFXTERMO4" || HeaterDeviceType == "YUDIAN")
                    return Visibility.Visible;
                return Visibility.Collapsed;
            }
        }

        protected override void OnActivate()
        {
            base.OnActivate();
            Emissivity1MinValue = (int)QueryDataClient.Instance.Service.GetConfig("PM.TemperatureInfrared.TemperatureInfrared1.Emissivity Range");
            Emissivity2MinValue = (int)QueryDataClient.Instance.Service.GetConfig("PM.TemperatureInfrared.TemperatureInfrared2.Emissivity Range");
            Emissivity3MinValue = (int)QueryDataClient.Instance.Service.GetConfig("PM.TemperatureInfrared.TemperatureInfrared3.Emissivity Range");
            Emissivity4MinValue = (int)QueryDataClient.Instance.Service.GetConfig("PM.TemperatureInfrared.TemperatureInfrared4.Emissivity Range");
            Emissivity5MinValue = (int)QueryDataClient.Instance.Service.GetConfig("PM.TemperatureInfrared.TemperatureInfrared5.Emissivity Range");
            isDeacitvated = false;
            UpdateView();
        }

        protected override void OnDeactivate(bool close)
        {
            base.OnDeactivate(close);

            if (this.IsChanged)
            {
                if (MMessageBox.ShowYesNo(ThemeSwitchCommon.GetResourceString("Recipe_ModifyRemind_Msg"), "") == MessageBoxResult.Yes)
                    this.SaveRecipe();
            }
            isDeacitvated = true;
        }

        private void SelectDefault(FileNode node)
        {
            if (!node.IsFile)
            {
                if (node.Files.Count > 0)
                {
                    foreach (FileNode file in node.Files)
                    {
                        if (file.IsFile)
                        {
                            this.TreeSelectChanged(file);
                            file.IsSelected = true;
                            break;
                        }
                    }
                }
            }
        }

        protected override void OnViewLoaded(object view)
        {
            base.OnViewLoaded(view);
            try
            {
                RecipeColumnBuilder.ApplyTemplate((UserControl)view, this.Columns);
                u = (RecipeView)view;

                this.Columns.Apply((c) =>
                {
                    c.Header = c;
                    u.dgCustom.Columns.Add(c);
                });
                u.dgCustom.ItemsSource = this.Recipe.Steps;
            }
            catch (Exception ex)
            {
                IsError = true;
                UpdateView();
                MMessageBox.Show(ex.Message);
            }
        }

        public void TextBoxExValue(object obj)
        {
            TextBoxEx textBox = (TextBoxEx)obj;
            if (string.IsNullOrEmpty(textBox.Text))
            {
                textBox.Text = "0";
            }
        }
        public void TreeSelectChanged(FileNode file)
        {
            if (file == null)
            {
                this.ClearData();
                this.UpdateView();
                return;
            }
            Flagname = file.FullPath;
            if (file.IsFile)
            {
                if (this.IsChanged)
                {
                    if (MMessageBox.ShowYesNo(ThemeSwitchCommon.GetResourceString("Recipe_ModifyRemind_Msg"), "") == MessageBoxResult.Yes)
                    {
                        this.Save(this.Recipe);
                    }
                }
                this.LoadData(file.FullPath);
            }
            else
            {
                this.ClearData();
            }
            this.UpdateView();

            this.CurrentFileNode = file;
            if (!Recipe.IsIdle)
            {
                MMessageBox.Show(string.Format(ThemeSwitchCommon.GetResourceString("Recipe_IsInUse_Msg"), Recipe.Name));
            }
        }

        private ICommand _NotImplementCommand;
        public ICommand NotImplementCommand
        {
            get
            {
                if (this._NotImplementCommand == null)
                    this._NotImplementCommand = new BaseCommand(() => this.NotImplement());
                return this._NotImplementCommand;
            }
        }
        public void NotImplement()
        {
            MMessageBox.Show(ThemeSwitchCommon.GetResourceString("Recipe_NotImplement_Msg"));
        }

        private ICommand _NewFolderCommand;
        public ICommand NewFolderCommand
        {
            get
            {
                if (this._NewFolderCommand == null)
                    this._NewFolderCommand = new BaseCommand(() => this.NewFolder());
                return this._NewFolderCommand;
            }
        }
        public void NewFolder()
        {
            if (!this.CurrentFileNode.IsFile)
            {
                InputFileNameDialogViewModel dialog = new InputFileNameDialogViewModel(ThemeSwitchCommon.GetResourceString("Recipe_InputFolderName"));
                WindowManager wm = new WindowManager();
                bool? bret = wm.ShowFlatDialog(dialog, true);
                if (!(bool)bret)
                    return;
                string fullpath = (this.CurrentFileNode.FullPath == "" ? dialog.DialogResult : this.CurrentFileNode.FullPath + "\\" + dialog.DialogResult);
                if (this.recipeProvider.CreateRecipeFolder(fullpath))
                {
                    FileNode folder = new FileNode();
                    folder.Name = dialog.DialogResult;
                    folder.FullPath = fullpath;
                    folder.Parent = this.CurrentFileNode;
                    this.CurrentFileNode.Files.Add(folder);
                }
                else
                    MMessageBox.Show(ThemeSwitchCommon.GetResourceString("Recipe_CreateFolderFailed_Msg"));
            }
        }

        private ICommand _NewFolderInParentCommand;
        public ICommand NewFolderInParentCommand
        {
            get
            {
                if (this._NewFolderInParentCommand == null)
                    this._NewFolderInParentCommand = new BaseCommand(() => this.NewFolderInParent());
                return this._NewFolderInParentCommand;
            }
        }

        public void NewFolderInParent()
        {
            InputFileNameDialogViewModel dialog = new InputFileNameDialogViewModel(ThemeSwitchCommon.GetResourceString("Recipe_InputFolderName"));
            WindowManager wm = new WindowManager();
            bool? bret = wm.ShowFlatDialog(dialog, true);
            if (!(bool)bret)
                return;
            string fullpath = dialog.DialogResult;

            if (string.IsNullOrEmpty(fullpath))
            {
                MMessageBox.Show(ThemeSwitchCommon.GetResourceString("Recipe_FolderEmpty_Msg"));
                return;
            }

            if (this.CurrentFileNode.Parent != null && this.CurrentFileNode.Parent.Files.Where(x => x.FullPath == fullpath).Count() > 0)
            {
                MMessageBox.Show(ThemeSwitchCommon.GetResourceString("Recipe_FolderIsExist_Msg"));
                return;
            }

            if (this.recipeProvider.CreateRecipeFolder(fullpath))
            {
                FileNode folder = new FileNode();
                folder.Name = dialog.DialogResult;
                folder.FullPath = fullpath;
                folder.Parent = this.Files[0];
                this.Files[0].Files.Add(folder);
            }
            else
                MMessageBox.Show(ThemeSwitchCommon.GetResourceString("Recipe_FolderCreaterFail_Msg"));
        }

        private ICommand _DeleteFolderCommand;
        public ICommand DeleteFolderCommand
        {
            get
            {
                if (this._DeleteFolderCommand == null)
                    this._DeleteFolderCommand = new BaseCommand(() => this.DeleteFolder());
                return this._DeleteFolderCommand;
            }
        }
        public void DeleteFolder()
        {
            if (!this.CurrentFileNode.IsFile && this.CurrentFileNode.FullPath != "")
            {
                if (MMessageBox.ShowYesNo(ThemeSwitchCommon.GetResourceString("Recipe_DeleteFolder_Msg"), "") == MessageBoxResult.Yes)
                {
                    if (this.recipeProvider.DeleteRecipeFolder(this.CurrentFileNode.FullPath))
                    {
                        this.CurrentFileNode.Parent.Files.Remove(this.CurrentFileNode);
                    }
                    else
                        MMessageBox.Show(ThemeSwitchCommon.GetResourceString("Recipe_DeleteFolderFail_Msg"));
                }
            }
        }

        private ICommand _NewRecipeCommand;
        public ICommand NewRecipeCommand
        {
            get
            {
                if (this._NewRecipeCommand == null)
                    this._NewRecipeCommand = new BaseCommand(() => this.NewRecipe());
                return this._NewRecipeCommand;
            }
        }
        RecipeView u = null;

        public IEnumerable<T> FindVisualChildren<T>(DependencyObject depObj) where T : DependencyObject
        {
            if (depObj != null)
            {
                for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++)
                {
                    DependencyObject child = VisualTreeHelper.GetChild(depObj, i);

                    if (child != null && child is T chi)
                        yield return chi;

                    foreach (T childOfChild in FindVisualChildren<T>(child))
                        yield return childOfChild;
                }
            }
        }
        public void NewRecipe()
        {
            InputFileNameDialogViewModel dialog = new InputFileNameDialogViewModel(ThemeSwitchCommon.GetResourceString("Recipe_InputNewRecipeName"));
            WindowManager wm = new WindowManager();
            bool? bret = wm.ShowFlatDialog(dialog, true);
            if ((bool)bret)
            {
                if (this.IsChanged)
                {
                    if (MMessageBox.ShowYesNo(ThemeSwitchCommon.GetResourceString("Recipe_ModifyRemind_Msg"), "") == MessageBoxResult.Yes)
                    {
                        this.Recipe.Revisor = BaseApp.Instance.UserContext.LoginName;
                        this.Recipe.ReviseTime = DateTime.Now;
                        this.Save(this.Recipe);
                    }
                }
                else
                {
                    ScrollViewer scrollViewer = FindVisualChildren<ScrollViewer>(u.dgCustom).FirstOrDefault();
                    if (scrollViewer != null)
                    {
                        scrollViewer.ScrollToLeftEnd();
                    }
                    string fullpath = "";
                    if (this.CurrentFileNode.IsFile)
                        fullpath = (this.CurrentFileNode.Parent.FullPath == "" ? dialog.DialogResult : this.CurrentFileNode.Parent.FullPath + "\\" + dialog.DialogResult);
                    else
                        fullpath = (this.CurrentFileNode.FullPath == "" ? dialog.DialogResult : this.CurrentFileNode.FullPath + "\\" + dialog.DialogResult);

                    if (string.IsNullOrEmpty(fullpath) || string.IsNullOrWhiteSpace(fullpath))
                    {
                        MMessageBox.Show(ThemeSwitchCommon.GetResourceString("Recipe_RecipeEmpty_Msg"));
                        return;
                    }
                    if (this.IsExist(fullpath))
                    {
                        MMessageBox.Show(ThemeSwitchCommon.GetResourceString("Recipe_RecipeIsExist_Msg"));
                    }
                    else
                    {
                        RecipeData recipe = new RecipeData();
                        recipe.Name = fullpath;
                        recipe.Creator = BaseApp.Instance.UserContext.LoginName;
                        recipe.CreateTime = DateTime.Now;
                        recipe.Revisor = string.Empty;
                        recipe.ReviseTime = DateTime.MinValue;
                        recipe.Description = string.Empty;
                        recipe.StartTemp = "0";
                        recipe.HeatingRate = "0";
                        recipe.DelayTime = "0";
                        recipe.P = "0";
                        recipe.I = "0";
                        recipe.D = "0";
                        recipe.SwitchTemperature = "800";
                        recipe.MaxPower = "0";
                        recipe.MinPower = "0";
                        recipe.Offset1 = "0";
                        recipe.Offset2 = "0";
                        recipe.Offset3 = "0";
                        recipe.Offset4 = "0";
                        recipe.Offset5 = "0";
                        recipe.Emissivity1 = "10";
                        recipe.Emissivity2 = "10";
                        recipe.Emissivity3 = "10";
                        recipe.Emissivity4 = "10";
                        recipe.Emissivity5 = "10";
                        recipe.PressureMode = "ATM";
                        recipe.OxygenContentAlarm = "True";
                        recipe.TemperatureInfrared1P1 = "0";
                        recipe.TemperatureInfrared1I1 = "0";
                        recipe.TemperatureInfrared1D1 = "0";
                        recipe.TemperatureInfrared1Threshold1 = "0";
                        recipe.TemperatureInfrared1P2 = "0";
                        recipe.TemperatureInfrared1I2 = "0";
                        recipe.TemperatureInfrared1D2 = "0";
                        recipe.TemperatureInfrared1Threshold2 = "0";
                        recipe.TemperatureInfrared1P3 = "0";
                        recipe.TemperatureInfrared1I3 = "0";
                        recipe.TemperatureInfrared1D3 = "0";
                        recipe.TemperatureInfrared1Threshold3 = "0";
                        recipe.TemperatureInfrared1P4 = "0";
                        recipe.TemperatureInfrared1I4 = "0";
                        recipe.TemperatureInfrared1D4 = "0";
                        recipe.TemperatureInfrared1Threshold4 = "0";
                        recipe.TemperatureInfrared1P5 = "0";
                        recipe.TemperatureInfrared1I5 = "0";
                        recipe.TemperatureInfrared1D5 = "0";
                        recipe.TemperatureInfrared1Threshold5 = "0";
                        recipe.TemperatureInfrared1P6 = "0";
                        recipe.TemperatureInfrared1I6 = "0";
                        recipe.TemperatureInfrared1D6 = "0";
                        recipe.TemperatureInfrared1Threshold6 = "0";
                        recipe.TemperatureInfrared1P7 = "0";
                        recipe.TemperatureInfrared1I7 = "0";
                        recipe.TemperatureInfrared1D7 = "0";
                        recipe.TemperatureInfrared1Threshold7 = "0";
                        recipe.TemperatureInfrared1P8 = "0";
                        recipe.TemperatureInfrared1I8 = "0";
                        recipe.TemperatureInfrared1D8 = "0";
                        recipe.TemperatureInfrared1Threshold8 = "0";

                        recipe.TemperatureInfrared2P1 = "0";
                        recipe.TemperatureInfrared2I1 = "0";
                        recipe.TemperatureInfrared2D1 = "0";
                        recipe.TemperatureInfrared2Threshold1 = "0";
                        recipe.TemperatureInfrared2P2 = "0";
                        recipe.TemperatureInfrared2I2 = "0";
                        recipe.TemperatureInfrared2D2 = "0";
                        recipe.TemperatureInfrared2Threshold2 = "0";
                        recipe.TemperatureInfrared2P3 = "0";
                        recipe.TemperatureInfrared2I3 = "0";
                        recipe.TemperatureInfrared2D3 = "0";
                        recipe.TemperatureInfrared2Threshold3 = "0";
                        recipe.TemperatureInfrared2P4 = "0";
                        recipe.TemperatureInfrared2I4 = "0";
                        recipe.TemperatureInfrared2D4 = "0";
                        recipe.TemperatureInfrared2Threshold4 = "0";
                        recipe.TemperatureInfrared2P5 = "0";
                        recipe.TemperatureInfrared2I5 = "0";
                        recipe.TemperatureInfrared2D5 = "0";
                        recipe.TemperatureInfrared2Threshold5 = "0";
                        recipe.TemperatureInfrared2P6 = "0";
                        recipe.TemperatureInfrared2I6 = "0";
                        recipe.TemperatureInfrared2D6 = "0";
                        recipe.TemperatureInfrared2Threshold6 = "0";
                        recipe.TemperatureInfrared2P7 = "0";
                        recipe.TemperatureInfrared2I7 = "0";
                        recipe.TemperatureInfrared2D7 = "0";
                        recipe.TemperatureInfrared2Threshold7 = "0";
                        recipe.TemperatureInfrared2P8 = "0";
                        recipe.TemperatureInfrared2I8 = "0";
                        recipe.TemperatureInfrared2D8 = "0";
                        recipe.TemperatureInfrared2Threshold8 = "0";

                        recipe.TemperatureInfrared3P1 = "0";
                        recipe.TemperatureInfrared3I1 = "0";
                        recipe.TemperatureInfrared3D1 = "0";
                        recipe.TemperatureInfrared3Threshold1 = "0";
                        recipe.TemperatureInfrared3P2 = "0";
                        recipe.TemperatureInfrared3I2 = "0";
                        recipe.TemperatureInfrared3D2 = "0";
                        recipe.TemperatureInfrared3Threshold2 = "0";
                        recipe.TemperatureInfrared3P3 = "0";
                        recipe.TemperatureInfrared3I3 = "0";
                        recipe.TemperatureInfrared3D3 = "0";
                        recipe.TemperatureInfrared3Threshold3 = "0";
                        recipe.TemperatureInfrared3P4 = "0";
                        recipe.TemperatureInfrared3I4 = "0";
                        recipe.TemperatureInfrared3D4 = "0";
                        recipe.TemperatureInfrared3Threshold4 = "0";
                        recipe.TemperatureInfrared3P5 = "0";
                        recipe.TemperatureInfrared3I5 = "0";
                        recipe.TemperatureInfrared3D5 = "0";
                        recipe.TemperatureInfrared3Threshold5 = "0";
                        recipe.TemperatureInfrared3P6 = "0";
                        recipe.TemperatureInfrared3I6 = "0";
                        recipe.TemperatureInfrared3D6 = "0";
                        recipe.TemperatureInfrared3Threshold6 = "0";
                        recipe.TemperatureInfrared3P7 = "0";
                        recipe.TemperatureInfrared3I7 = "0";
                        recipe.TemperatureInfrared3D7 = "0";
                        recipe.TemperatureInfrared3Threshold7 = "0";
                        recipe.TemperatureInfrared3P8 = "0";
                        recipe.TemperatureInfrared3I8 = "0";
                        recipe.TemperatureInfrared3D8 = "0";
                        recipe.TemperatureInfrared3Threshold8 = "0";

                        recipe.TemperatureInfrared4P1 = "0";
                        recipe.TemperatureInfrared4I1 = "0";
                        recipe.TemperatureInfrared4D1 = "0";
                        recipe.TemperatureInfrared4Threshold1 = "0";
                        recipe.TemperatureInfrared4P2 = "0";
                        recipe.TemperatureInfrared4I2 = "0";
                        recipe.TemperatureInfrared4D2 = "0";
                        recipe.TemperatureInfrared4Threshold2 = "0";
                        recipe.TemperatureInfrared4P3 = "0";
                        recipe.TemperatureInfrared4I3 = "0";
                        recipe.TemperatureInfrared4D3 = "0";
                        recipe.TemperatureInfrared4Threshold3 = "0";
                        recipe.TemperatureInfrared4P4 = "0";
                        recipe.TemperatureInfrared4I4 = "0";
                        recipe.TemperatureInfrared4D4 = "0";
                        recipe.TemperatureInfrared4Threshold4 = "0";
                        recipe.TemperatureInfrared4P5 = "0";
                        recipe.TemperatureInfrared4I5 = "0";
                        recipe.TemperatureInfrared4D5 = "0";
                        recipe.TemperatureInfrared4Threshold5 = "0";
                        recipe.TemperatureInfrared4P6 = "0";
                        recipe.TemperatureInfrared4I6 = "0";
                        recipe.TemperatureInfrared4D6 = "0";
                        recipe.TemperatureInfrared4Threshold6 = "0";
                        recipe.TemperatureInfrared4P7 = "0";
                        recipe.TemperatureInfrared4I7 = "0";
                        recipe.TemperatureInfrared4D7 = "0";
                        recipe.TemperatureInfrared4Threshold7 = "0";
                        recipe.TemperatureInfrared4P8 = "0";
                        recipe.TemperatureInfrared4I8 = "0";
                        recipe.TemperatureInfrared4D8 = "0";
                        recipe.TemperatureInfrared4Threshold8 = "0";

                        recipe.TemperatureInfrared5P1 = "0";
                        recipe.TemperatureInfrared5I1 = "0";
                        recipe.TemperatureInfrared5D1 = "0";
                        recipe.TemperatureInfrared5Threshold1 = "0";
                        recipe.TemperatureInfrared5P2 = "0";
                        recipe.TemperatureInfrared5I2 = "0";
                        recipe.TemperatureInfrared5D2 = "0";
                        recipe.TemperatureInfrared5Threshold2 = "0";
                        recipe.TemperatureInfrared5P3 = "0";
                        recipe.TemperatureInfrared5I3 = "0";
                        recipe.TemperatureInfrared5D3 = "0";
                        recipe.TemperatureInfrared5Threshold3 = "0";
                        recipe.TemperatureInfrared5P4 = "0";
                        recipe.TemperatureInfrared5I4 = "0";
                        recipe.TemperatureInfrared5D4 = "0";
                        recipe.TemperatureInfrared5Threshold4 = "0";
                        recipe.TemperatureInfrared5P5 = "0";
                        recipe.TemperatureInfrared5I5 = "0";
                        recipe.TemperatureInfrared5D5 = "0";
                        recipe.TemperatureInfrared5Threshold5 = "0";
                        recipe.TemperatureInfrared5P6 = "0";
                        recipe.TemperatureInfrared5I6 = "0";
                        recipe.TemperatureInfrared5D6 = "0";
                        recipe.TemperatureInfrared5Threshold6 = "0";
                        recipe.TemperatureInfrared5P7 = "0";
                        recipe.TemperatureInfrared5I7 = "0";
                        recipe.TemperatureInfrared5D7 = "0";
                        recipe.TemperatureInfrared5Threshold7 = "0";
                        recipe.TemperatureInfrared5P8 = "0";
                        recipe.TemperatureInfrared5I8 = "0";
                        recipe.TemperatureInfrared5D8 = "0";
                        recipe.TemperatureInfrared5Threshold8 = "0";

                        if (this.Save(recipe, false))
                        {
                            this.Recipe.Name = recipe.Name;
                            this.Recipe.Creator = recipe.Creator;
                            this.Recipe.CreateTime = recipe.CreateTime;
                            this.Recipe.Revisor = recipe.Revisor;
                            this.Recipe.ReviseTime = recipe.ReviseTime;
                            this.Recipe.Description = recipe.Description;
                            this.Recipe.Steps.Clear();

                            FileNode file = new FileNode();
                            file.Name = dialog.DialogResult;
                            file.FullPath = this.Recipe.Name;
                            file.IsFile = true;
                            file.Parent = this.CurrentFileNode.IsFile ? this.CurrentFileNode.Parent : this.CurrentFileNode;
                            file.IsSelected = true;
                            SearchedRcpFiles.Add(file);
                            if (this.CurrentFileNode.IsFile)
                                this.CurrentFileNode.Parent.Files.Insert(this.findInsertPosition(this.CurrentFileNode.Parent.Files), file);
                            else
                                this.CurrentFileNode.Files.Insert(this.findInsertPosition(this.CurrentFileNode.Files), file);
                            this.editMode = EditMode.Normal;
                            this.UpdateView();
                        }
                    }
                }
            }
        }

        private ICommand _NewRecipeInParentCommand;
        public ICommand NewRecipeParentCommand
        {
            get
            {
                if (this._NewRecipeInParentCommand == null)
                    this._NewRecipeInParentCommand = new BaseCommand(() => this.NewRecipeInParent());
                return this._NewRecipeInParentCommand;
            }
        }

        public void ExpandAllParam()
        {
            for (var i = 0; i < this.Columns.Count; i++)
            {
                if (this.Columns[i] is ExpanderColumn)
                {
                    (this.Columns[i] as ExpanderColumn).IsExpanded = true;
                }
                else
                    this.Columns[i].Visibility = Visibility.Visible;
            }
        }

        public void PackupAllParam()
        {
            for (var i = 0; i < this.Columns.Count; i++)
            {
                if (this.Columns[i] is ExpanderColumn)
                {
                    (this.Columns[i] as ExpanderColumn).IsExpanded = false;
                }
                else
                    this.Columns[i].Visibility = Visibility.Collapsed;
            }
        }

        private ICommand _ExpandAllCommand;
        public ICommand ExpandAllCommand
        {
            get
            {
                if (this._ExpandAllCommand == null)
                    this._ExpandAllCommand = new BaseCommand(() => this.ExpandAllParam());
                return this._ExpandAllCommand;
            }
        }

        private ICommand _PackupAllCommand;
        public ICommand PackupAllCommand
        {
            get
            {
                if (this._PackupAllCommand == null)
                    this._PackupAllCommand = new BaseCommand(() => this.PackupAllParam());
                return this._PackupAllCommand;
            }
        }
        public void NewRecipeInParent()
        {
            InputFileNameDialogViewModel dialog = new InputFileNameDialogViewModel(ThemeSwitchCommon.GetResourceString("Recipe_InputNewRecipeName"));
            WindowManager wm = new WindowManager();
            bool? bret = wm.ShowFlatDialog(dialog, true);
            if ((bool)bret)
            {
                if (this.IsChanged)
                {
                    if (MMessageBox.Show(ThemeSwitchCommon.GetResourceString("Recipe_ModifyRemind_Msg"), "", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                    {
                        this.Recipe.Revisor = BaseApp.Instance.UserContext.LoginName;
                        this.Recipe.ReviseTime = DateTime.Now;
                        this.Save(this.Recipe);
                    }
                }
                else
                {
                    string fullpath = dialog.DialogResult;

                    if (string.IsNullOrEmpty(fullpath) || string.IsNullOrWhiteSpace(fullpath))
                    {
                        MMessageBox.Show(ThemeSwitchCommon.GetResourceString("Recipe_RecipeEmpty_Msg"));
                        return;
                    }
                    if (this.IsExist(fullpath))
                    {
                        MMessageBox.Show(ThemeSwitchCommon.GetResourceString("Recipe_RecipeIsExist_Msg"));
                    }
                    else
                    {
                        RecipeData recipe = new RecipeData();
                        recipe.Name = fullpath;
                        recipe.Creator = BaseApp.Instance.UserContext.LoginName;
                        recipe.CreateTime = DateTime.Now;
                        recipe.Revisor = BaseApp.Instance.UserContext.LoginName;
                        recipe.ReviseTime = DateTime.Now;
                        recipe.Description = string.Empty;

                        if (this.Save(recipe))
                        {
                            this.Recipe.Name = recipe.Name;
                            this.Recipe.Creator = recipe.Creator;
                            this.Recipe.CreateTime = recipe.CreateTime;
                            this.Recipe.Revisor = recipe.Revisor;
                            this.Recipe.ReviseTime = recipe.ReviseTime;
                            this.Recipe.Description = recipe.Description;
                            this.Recipe.Steps.Clear();

                            FileNode file = new FileNode();
                            file.Name = dialog.DialogResult;
                            file.FullPath = this.Recipe.Name;
                            file.IsFile = true;
                            file.Parent = this.Files[0];

                            this.Files[0].Files.Insert(this.findInsertPosition(this.CurrentFileNode.Files), file);
                            this.editMode = EditMode.Normal;
                            this.UpdateView();
                        }
                    }
                }
            }
        }
        public void RefreshRecipe()
        {
            this.Files = new ObservableCollection<FileNode>(RecipeSequenceTreeBuilder.GetFiles(this.recipeProvider.GetRecipes()));
            this.CurrentFileNode = this.Files[0];
            Keywords = "";
        }

        public int findInsertPosition(ObservableCollection<FileNode> files)
        {
            int pos = -1;
            if (files.Count == 0)
                pos = 0;
            else
            {
                bool foundfolder = false;
                for (var index = 0; index < files.Count; index++)
                {
                    if (!files[index].IsFile)
                    {
                        foundfolder = true;
                        pos = index;
                        break;
                    }
                }

                if (!foundfolder)
                    pos = files.Count;
            }
            return pos;
        }

        private ICommand _SaveAsCommand;
        public ICommand SaveAsCommand
        {
            get
            {
                if (this._SaveAsCommand == null)
                    this._SaveAsCommand = new BaseCommand(() => this.SaveAsRecipe());
                return this._SaveAsCommand;
            }
        }
        public void SaveAsRecipe()
        {
            if (this.CurrentFileNode.IsFile)
            {
                InputFileNameDialogViewModel dialog = new InputFileNameDialogViewModel(ThemeSwitchCommon.GetResourceString("Recipe_SaveAsRecipe"));
                WindowManager wm = new WindowManager();
                bool? bret = wm.ShowFlatDialog(dialog, true);
                if (!(bool)bret)
                    return;
                string fullpath = (this.CurrentFileNode.Parent.FullPath == "" ? dialog.DialogResult : this.CurrentFileNode.Parent.FullPath + "\\" + dialog.DialogResult);

                if (string.IsNullOrEmpty(fullpath) || string.IsNullOrWhiteSpace(fullpath))
                {
                    MMessageBox.Show(ThemeSwitchCommon.GetResourceString("Recipe_RecipeEmpty_Msg"));
                    return;
                }
                if (this.IsExist(fullpath))
                {
                    MMessageBox.Show(ThemeSwitchCommon.GetResourceString("Recipe_RecipeIsExist_Msg"));
                }
                else
                {
                    if (this.IsChanged)
                    {
                        if (MMessageBox.Show(ThemeSwitchCommon.GetResourceString("Recipe_ModifyRemind_Msg"), "", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                        {
                            this.Save(this.Recipe, false);
                        }
                    }

                    this.Recipe.Creator = BaseApp.Instance.UserContext.LoginName;
                    this.Recipe.CreateTime = DateTime.Now;
                    this.Recipe.Revisor = string.Empty;
                    this.Recipe.ReviseTime = DateTime.MinValue;
                    string tempname = this.Recipe.Name;
                    this.Recipe.Name = fullpath;
                    if (this.recipeProvider.SaveAsRecipe(fullpath, this.Recipe.ToXml()))
                    {
                        FileNode node = new FileNode();
                        node.Parent = this.CurrentFileNode.Parent;
                        node.Name = dialog.DialogResult;
                        node.FullPath = fullpath;
                        node.IsFile = true;
                        node.IsSelected = true;
                        this.CurrentFileNode.Parent.Files.Add(node);
                        this.SearchedRcpFiles.Add(node);
                    }
                    else
                    {
                        this.Recipe.Name = tempname;
                        MMessageBox.Show(ThemeSwitchCommon.GetResourceString("Recipe_SaveasFail_Msg"));
                    }
                }
            }
        }

        private ICommand _RenameCommand;
        public ICommand RenameCommand
        {
            get
            {
                if (this._RenameCommand == null)
                    this._RenameCommand = new BaseCommand(() => this.RenameRecipe());
                return this._RenameCommand;
            }
        }
        public void RenameRecipe()
        {
            if (this.CurrentFileNode.IsFile)
            {
                InputFileNameDialogViewModel dialog = new InputFileNameDialogViewModel(ThemeSwitchCommon.GetResourceString("Recipe_RenameRecipe"));
                WindowManager wm = new WindowManager();
                dialog.FileName = this.CurrentFileNode.Name;
                bool? bret = wm.ShowFlatDialog(dialog, true);
                if (!(bool)bret)
                    return;

                string fullpath = (this.CurrentFileNode.Parent.FullPath == "" ? dialog.DialogResult : this.CurrentFileNode.Parent.FullPath + "\\" + dialog.DialogResult);

                if (string.IsNullOrEmpty(fullpath) || string.IsNullOrWhiteSpace(fullpath))
                {
                    MMessageBox.Show(ThemeSwitchCommon.GetResourceString("Recipe_RecipeEmpty_Msg"));
                    return;
                }
                if (this.IsExist(fullpath))
                {
                    MMessageBox.Show(ThemeSwitchCommon.GetResourceString("Recipe_RecipeIsExist_Msg"));
                }
                else
                {
                    this.Recipe.Revisor = BaseApp.Instance.UserContext.LoginName;
                    this.Recipe.ReviseTime = DateTime.Now;
                    if (this.recipeProvider.RenameRecipe(this.Recipe.Name, fullpath))
                    {
                        this.CurrentFileNode.Name = dialog.DialogResult;
                        this.CurrentFileNode.FullPath = fullpath;
                        this.Recipe.Name = fullpath;
                        Flagname = fullpath;
                        this.Save(this.Recipe, false);
                    }
                    else
                        MMessageBox.Show(ThemeSwitchCommon.GetResourceString("Recipe_RenameFail_Msg"));
                }
            }
        }
        private ICommand _DeleteCommand;
        public ICommand DeleteRecipeCommand
        {
            get
            {
                if (this._DeleteCommand == null)
                    this._DeleteCommand = new BaseCommand(() => this.DeleteRecipe());
                return this._DeleteCommand;
            }
        }
        public void DeleteRecipe()
        {
            if (this.CurrentFileNode.IsFile)
            {
                if (MMessageBox.ShowYesNo(ThemeSwitchCommon.GetResourceString("Recipe_DeleteRecipe_Msg"), "") == MessageBoxResult.Yes)
                {
                    if (this.recipeProvider.DeleteRecipe(this.Recipe.Name))
                    {
                        this.CurrentFileNode.Parent.Files.Remove(this.CurrentFileNode);
                        this.SearchedRcpFiles.Remove(this.CurrentFileNode);
                        if (SearchedRcpFiles.Count > 0)
                        {
                            SearchedRcpFiles[0].IsSelected = true;
                        }
                    }
                }
            }
        }

        public void ReloadRecipe()
        {
            if (this.editMode == EditMode.Normal || this.editMode == EditMode.Edit)
            {
                this.LoadData(this.Recipe.Name);
                this.UpdateView();
            }
        }

        public void ParamsExpanded(ExpanderColumn col)
        {

            if (isDeacitvated)
                return;
            int index = this.Columns.IndexOf(col);
            for (var i = index + 1; i < this.Columns.Count; i++)
            {
                if (this.Columns[i] is ExpanderColumn)
                    break;
                this.Columns[i].Visibility = Visibility.Visible;
            }
        }

        public void ParamsCollapsed(ExpanderColumn col)
        {

            if (isDeacitvated)
                return;
            int index = this.Columns.IndexOf(col);
            for (var i = index + 1; i < this.Columns.Count; i++)
            {
                if (this.Columns[i] is ExpanderColumn)
                    break;
                this.Columns[i].Visibility = Visibility.Collapsed;
            }
        }
        public void SaveRecipe()
        {
            this.Save(this.Recipe);
        }

        public bool Save(RecipeData recipe, bool isEditMode = true)
        {
            bool result = false;
            if (string.IsNullOrEmpty(recipe.Name) || string.IsNullOrWhiteSpace(recipe.Name))
            {
                MMessageBox.Show(ThemeSwitchCommon.GetResourceString("Recipe_RecipeEmpty_Msg"));
                return false;
            }

            string ruleCheckMessage = null;
            if (!ValidateSequenceRules(recipe, ref ruleCheckMessage))
            {
                MMessageBox.Show(string.Format(ThemeSwitchCommon.GetResourceString("Recipe_SaveRuleFail_Msg"), recipe.Name, ruleCheckMessage));
                return false;
            }

            List<List<string>> mfcList = recipe.Steps.Select(step => step.Where(r => (r?.Name ?? "").Contains("Gas") && (r is IntParam && ((IntParam)r)?.Value > 0))
   .Select(r => r.Name.Split('.').ToList().GetItemByIndex(1)).ToList()).ToList();
            List<List<string>> updatedMfcList = mfcList.Select(item =>
                item.Select(mfc => mfc + "MFC").ToList()
            ).ToList();
            List<List<string>> sureResult = RecipeClient.Instance.Service.GetRecipeInterlockMFC("PM", updatedMfcList);
            if (sureResult?.Count > 0)
            {
                string mfcName = string.Join(",", sureResult.Select(innerList => string.Join("-", innerList)));
                MMessageBox.Show(string.Format(ThemeSwitchCommon.GetResourceString("Recipe_MFCVerify_Msg"), mfcName, ruleCheckMessage));
                return false;
            }

            if (isEditMode)
            {
                recipe.Revisor = BaseApp.Instance.UserContext.LoginName;
                recipe.ReviseTime = DateTime.Now;
            }

            foreach (ObservableCollection<Param> parameters in this.Recipe.Steps)
            {
                bool stepEnabled = (parameters[3] as StepParam).Checked;
                (parameters[3] as StepParam).Value = stepEnabled ? "Overall.StepEnable_Enable" : "Overall.StepEnable_DisEnable";
            }
            result = this.recipeProvider.SaveRecipe(recipe.Name, recipe.ToXml());

            if (result)
            {
                PressureModeInfo = recipe.PressureMode;
                OxygenContentAlarmInfo = recipe.OxygenContentAlarm;
                foreach (ObservableCollection<Param> parameters in recipe.Steps)
                {
                    parameters.Apply(param => param.IsSaved = true);
                }
                this.editMode = EditMode.Normal;
                RecipeTrue();
                this.UpdateView();
            }
            else
                MMessageBox.Show(ThemeSwitchCommon.GetResourceString("Recipe_SaveFail_Msg"));
            return result;
        }


        private bool ValidateSequenceRules(RecipeData recipe, ref string ruleCheckMessage)
        {
            #region Head
            if (int.Parse(recipe.StartTemp) < 0 || int.Parse(recipe.StartTemp) > 1000)
            {
                ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleOutRange_Msg"), ThemeSwitchCommon.GetResourceString("Recipe_StartTemperature"));
                return false;
            }
            if (int.Parse(recipe.HeatingRate) < 0 || int.Parse(recipe.HeatingRate) > 1000)
            {
                ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleOutRange_Msg"), ThemeSwitchCommon.GetResourceString("Recipe_HeatingRate"));
                return false;
            }
            if (int.Parse(recipe.DelayTime) < 0 || int.Parse(recipe.DelayTime) > 120)
            {
                ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleOutRange_Msg"), ThemeSwitchCommon.GetResourceString("Recipe_DelayTime"));
                return false;
            }
            if (float.Parse(recipe.P) < 0 || float.Parse(recipe.P) > 500)
            {
                ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleOutRange_Msg"), ThemeSwitchCommon.GetResourceString("Recipe_P"));
                return false;
            }
            if (float.Parse(recipe.I) < 0 || float.Parse(recipe.I) > 200)
            {
                ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleOutRange_Msg"), ThemeSwitchCommon.GetResourceString("Recipe_I"));
                return false;
            }
            if (float.Parse(recipe.D) < 0 || float.Parse(recipe.D) > 200)
            {
                ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleOutRange_Msg"), ThemeSwitchCommon.GetResourceString("Recipe_D"));
                return false;
            }
            if (float.Parse(recipe.MaxPower) < -100 || float.Parse(recipe.MaxPower) > 100)
            {
                ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleOutRange_Msg"), ThemeSwitchCommon.GetResourceString("Recipe_MaxPower"));
                return false;
            }
            if (float.Parse(recipe.MinPower) < -100 || float.Parse(recipe.MinPower) > 100)
            {
                ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleOutRange_Msg"), ThemeSwitchCommon.GetResourceString("Recipe_MinPower"));
                return false;
            }
            if (float.Parse(recipe.SwitchTemperature) < 0 || float.Parse(recipe.SwitchTemperature) > 1000)
            {
                ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleOutRange_Msg"), ThemeSwitchCommon.GetResourceString("Recipe_SwitchTemperatureRange"));
                return false;
            }
            if (PyrometerListVisibility[1] == Visibility.Visible && (float.Parse(recipe.Offset1) < -1000 || float.Parse(recipe.Offset1) > 1000))
            {
                ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleOutRange_Msg"), ThemeSwitchCommon.GetResourceString("Recipe_Offset1_Msg"));
                return false;
            }
            if (PyrometerListVisibility[1] == Visibility.Visible && (float.Parse(recipe.Emissivity1) < Emissivity1MinValue || float.Parse(recipe.Emissivity1) > 100))
            {
                ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleOutRange_Msg"), ThemeSwitchCommon.GetResourceString("Recipe_Emissivity1_Msg"));
                return false;
            }
            if (PyrometerListVisibility[2] == Visibility.Visible && (float.Parse(recipe.Offset2) < -1000 || float.Parse(recipe.Offset2) > 1000))
            {
                ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleOutRange_Msg"), ThemeSwitchCommon.GetResourceString("Recipe_Offset2_Msg"));
                return false;
            }
            if (PyrometerListVisibility[2] == Visibility.Visible && (float.Parse(recipe.Emissivity2) < Emissivity2MinValue || float.Parse(recipe.Emissivity2) > 100))
            {
                ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleOutRange_Msg"), ThemeSwitchCommon.GetResourceString("Recipe_Emissivity2_Msg"));
                return false;
            }
            if (PyrometerListVisibility[3] == Visibility.Visible && (float.Parse(recipe.Offset3) < -1000 || float.Parse(recipe.Offset3) > 1000))
            {
                ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleOutRange_Msg"), ThemeSwitchCommon.GetResourceString("Recipe_Offset3_Msg"));
                return false;
            }
            if (PyrometerListVisibility[3] == Visibility.Visible && (float.Parse(recipe.Emissivity3) < Emissivity3MinValue || float.Parse(recipe.Emissivity3) > 100))
            {
                ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleOutRange_Msg"), ThemeSwitchCommon.GetResourceString("Recipe_Emissivity3_Msg"));
                return false;
            }
            if (PyrometerListVisibility[4] == Visibility.Visible && (float.Parse(recipe.Offset4) < -1000 || float.Parse(recipe.Offset4) > 1000))
            {
                ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleOutRange_Msg"), ThemeSwitchCommon.GetResourceString("Recipe_Offset4_Msg"));
                return false;
            }
            if (PyrometerListVisibility[4] == Visibility.Visible && (float.Parse(recipe.Emissivity4) < Emissivity4MinValue || float.Parse(recipe.Emissivity4) > 100))
            {
                ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleOutRange_Msg"), ThemeSwitchCommon.GetResourceString("Recipe_Emissivity4_Msg"));
                return false;
            }
            if (PyrometerListVisibility[5] == Visibility.Visible && (float.Parse(recipe.Offset5) < -1000 || float.Parse(recipe.Offset5) > 1000))
            {
                ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleOutRange_Msg"), ThemeSwitchCommon.GetResourceString("Recipe_Offset5_Msg"));
                return false;
            }
            if (PyrometerListVisibility[5] == Visibility.Visible && (float.Parse(recipe.Emissivity5) < Emissivity5MinValue || float.Parse(recipe.Emissivity5) > 100))
            {
                ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleOutRange_Msg"), ThemeSwitchCommon.GetResourceString("Recipe_Emissivity5_Msg"));
                return false;
            }
            #endregion

            if (recipe.Steps.Count == 0)   // use for create new recipe ,delete will can't create new recipe
                return true;

            for (int i = 0; i < recipe.Steps.Count; i++)
            {
                //    rule1 : Check the value of params in range
                foreach (var param in recipe.Steps[i])
                {
                    if (param.IsEnabled && param is StringParam && param.Name == "Overall.Name" && (string.IsNullOrEmpty((param as StringParam).Value) || string.IsNullOrWhiteSpace((param as StringParam).Value)))
                    {
                        ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleStepNameEmpty_Msg"), param.Name);

                        return false;
                    }

                    if (param.IsEnabled && param is IntParam && param.Name == "Overall.Time")
                    {
                        int intvalue = (param as IntParam).Value;
                        if (intvalue >= (param as IntParam).Maximun || intvalue <= (param as IntParam).Minimun)
                        {
                            ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleStepOutRange_Msg"), i + 1, param.Name);
                            return false;
                        }
                    }

                    if (param.IsEnabled && param is DoubleParam)
                    {
                        if (double.TryParse((param as DoubleParam).Value, out double doublevalue))
                        {
                            if (doublevalue > (param as DoubleParam).Maximun || doublevalue < (param as DoubleParam).Minimun)
                            {
                                ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleStepOutRange_Msg"), i + 1, param.Name);
                                return false;
                            }
                        }
                    }

                    if (param.IsEnabled && param is IntParam)
                    {
                        int intvalue = (param as IntParam).Value;

                        if (intvalue > (param as IntParam).Maximun || intvalue < (param as IntParam).Minimun)
                        {
                            ruleCheckMessage = string.Format(ThemeSwitchCommon.GetResourceString("Recipe_RuleStepOutRange_Msg"), i + 1, param.Name);
                            return false;
                        }
                    }
                }
            }

            return true;
        }

        public void AddStep()
        {
            this.Recipe.Steps.Add(this.Recipe.CreateStep(this.Columns));

            if (this.editMode != EditMode.New && this.editMode != EditMode.ReName)
                this.editMode = EditMode.Edit;

            int index = 1;
            foreach (ObservableCollection<Param> parameters in this.Recipe.Steps)
            {
                (parameters[1] as StepParam).Value = index.ToString();
                index++;
            }

            var step = this.Recipe.Steps.Last();
            (step[3] as StepParam).Checked = true;
            (step[5] as ComboxParam).Value = "ByTime";
            this.UpdateView();
        }

        public void AppendStep()
        {
            int index = -1;
            bool found = false;
            for (var i = 0; i < this.Recipe.Steps.Count; i++)
            {
                if (this.Recipe.Steps[i][1] is StepParam && ((StepParam)this.Recipe.Steps[i][1]).Checked)
                {
                    index = i;
                    found = true;
                    break;
                }
            }
            if (found)
            {
                if (this.editMode != EditMode.New && this.editMode != EditMode.ReName)
                    this.editMode = EditMode.Edit;

                this.Recipe.Steps.Insert(index, this.Recipe.CreateStep(this.Columns));
                index = 1;
                foreach (ObservableCollection<Param> parameters in this.Recipe.Steps)
                {
                    (parameters[1] as StepParam).Value = index.ToString();
                    index++;
                }
            }
        }

        private ObservableCollection<ObservableCollection<Param>> copySteps = new ObservableCollection<ObservableCollection<Param>>();
        public void CopyStep()
        {
            this.copySteps.Clear();

            for (var i = 0; i < this.Recipe.Steps.Count; i++)
            {
                if (this.Recipe.Steps[i][1] is StepParam && ((StepParam)this.Recipe.Steps[i][1]).Checked)
                {
                    this.copySteps.Add(this.Recipe.CloneStep(this.Columns, this.Recipe.Steps[i]));
                }
            }
        }

        public void PasteStep()
        {
            if (this.copySteps.Count > 0)
            {
                if (this.editMode != EditMode.New && this.editMode != EditMode.ReName)
                    this.editMode = EditMode.Edit;

                int copyStep = 0;
                for (int i = 0; i < Recipe.Steps.Count; i++)
                {
                    if (((StepParam)Recipe.Steps[i][1]).Checked)
                    {
                        copyStep = i;
                        break;
                    }
                    copyStep = Recipe.Steps.Count;
                }
                copySteps.ToList().ForEach(t =>
                {
                    this.Recipe.Steps.Insert(copyStep, this.Recipe.CloneStep(this.Columns, t));
                    copyStep++;
                });
                int index = 1;
                foreach (ObservableCollection<Param> parameters in this.Recipe.Steps)
                {
                    (parameters[1] as StepParam).Value = index.ToString();
                    index++;
                }
                this.UpdateView();
            }
        }

        public void DeleteStep()
        {
            List<ObservableCollection<Param>> steps = this.Recipe.Steps.ToList();
            if (steps.Count == 0)
                return;


            for (var i = 0; i < steps.Count; i++)
            {
                if (steps[i][1] is StepParam && ((StepParam)steps[i][1]).Checked)
                {
                    if (this.editMode != EditMode.New && this.editMode != EditMode.ReName)
                        this.editMode = EditMode.Edit;
                    this.Recipe.Steps.Remove(steps[i]);
                }
            }
            int index = 1;
            foreach (ObservableCollection<Param> parameters in this.Recipe.Steps)
            {
                (parameters[1] as StepParam).Value = index.ToString();
                index++;
            }
        }

        public void RecipeTrue()
        {
            this.IsSavedDesc = true;
            this.OxygenContentAlarmchanged = true;
            this.PressureModechanged = true;
            this.IsStartTemp = true;
            this.IsHeatingRate = true;
            this.IsDelayTime = true;
            this.IsPidP = true;
            this.IsPidI = true;
            this.IsPidD = true;
            this.IsSwitchTemperature = true;
            this.IsMaxPower = true;
            this.IsMinPower = true;
            this.IsOffset1 = true;
            this.IsOffset2 = true;
            this.IsOffset3 = true;
            this.IsOffset4 = true;
            this.IsOffset5 = true;
            this.IsEmissivity1 = true;
            this.IsEmissivity2 = true;
            this.IsEmissivity3 = true;
            this.IsEmissivity4 = true;
            this.IsEmissivity5 = true;
            this.IsTemp1P1 = true;
            this.IsTemp1I1 = true;
            this.IsTemp1D1 = true;
            this.IsTemp1Threshold1 = true;
            this.IsTemp1P2 = true;
            this.IsTemp1I2 = true;
            this.IsTemp1D2 = true;
            this.IsTemp1Threshold2 = true;
            this.IsTemp1P3 = true;
            this.IsTemp1I3 = true;
            this.IsTemp1D3 = true;
            this.IsTemp1Threshold3 = true;
            this.IsTemp1P4 = true;
            this.IsTemp1I4 = true;
            this.IsTemp1D4 = true;
            this.IsTemp1Threshold4 = true;
            this.IsTemp1P5 = true;
            this.IsTemp1I5 = true;
            this.IsTemp1D5 = true;
            this.IsTemp1Threshold5 = true;
            this.IsTemp1P6 = true;
            this.IsTemp1I6 = true;
            this.IsTemp1D6 = true;
            this.IsTemp1Threshold6 = true;
            this.IsTemp1P7 = true;
            this.IsTemp1I7 = true;
            this.IsTemp1D7 = true;
            this.IsTemp1Threshold7 = true;
            this.IsTemp1P8 = true;
            this.IsTemp1I8 = true;
            this.IsTemp1D8 = true;
            this.IsTemp1Threshold8 = true;

            this.IsTemp2P1 = true;
            this.IsTemp2I1 = true;
            this.IsTemp2D1 = true;
            this.IsTemp2Threshold1 = true;
            this.IsTemp2P2 = true;
            this.IsTemp2I2 = true;
            this.IsTemp2D2 = true;
            this.IsTemp2Threshold2 = true;
            this.IsTemp2P3 = true;
            this.IsTemp2I3 = true;
            this.IsTemp2D3 = true;
            this.IsTemp2Threshold3 = true;
            this.IsTemp2P4 = true;
            this.IsTemp2I4 = true;
            this.IsTemp2D4 = true;
            this.IsTemp2Threshold4 = true;
            this.IsTemp2P5 = true;
            this.IsTemp2I5 = true;
            this.IsTemp2D5 = true;
            this.IsTemp2Threshold5 = true;
            this.IsTemp2P6 = true;
            this.IsTemp2I6 = true;
            this.IsTemp2D6 = true;
            this.IsTemp2Threshold6 = true;
            this.IsTemp2P7 = true;
            this.IsTemp2I7 = true;
            this.IsTemp2D7 = true;
            this.IsTemp2Threshold7 = true;
            this.IsTemp2P8 = true;
            this.IsTemp2I8 = true;
            this.IsTemp2D8 = true;
            this.IsTemp2Threshold8 = true;

            this.IsTemp3P1 = true;
            this.IsTemp3I1 = true;
            this.IsTemp3D1 = true;
            this.IsTemp3Threshold1 = true;
            this.IsTemp3P2 = true;
            this.IsTemp3I2 = true;
            this.IsTemp3D2 = true;
            this.IsTemp3Threshold2 = true;
            this.IsTemp3P3 = true;
            this.IsTemp3I3 = true;
            this.IsTemp3D3 = true;
            this.IsTemp3Threshold3 = true;
            this.IsTemp3P4 = true;
            this.IsTemp3I4 = true;
            this.IsTemp3D4 = true;
            this.IsTemp3Threshold4 = true;
            this.IsTemp3P5 = true;
            this.IsTemp3I5 = true;
            this.IsTemp3D5 = true;
            this.IsTemp3Threshold5 = true;
            this.IsTemp3P6 = true;
            this.IsTemp3I6 = true;
            this.IsTemp3D6 = true;
            this.IsTemp3Threshold6 = true;
            this.IsTemp3P7 = true;
            this.IsTemp3I7 = true;
            this.IsTemp3D7 = true;
            this.IsTemp3Threshold7 = true;
            this.IsTemp3P8 = true;
            this.IsTemp3I8 = true;
            this.IsTemp3D8 = true;
            this.IsTemp3Threshold8 = true;

            this.IsTemp4P1 = true;
            this.IsTemp4I1 = true;
            this.IsTemp4D1 = true;
            this.IsTemp4Threshold1 = true;
            this.IsTemp4P2 = true;
            this.IsTemp4I2 = true;
            this.IsTemp4D2 = true;
            this.IsTemp4Threshold2 = true;
            this.IsTemp4P3 = true;
            this.IsTemp4I3 = true;
            this.IsTemp4D3 = true;
            this.IsTemp4Threshold3 = true;
            this.IsTemp4P4 = true;
            this.IsTemp4I4 = true;
            this.IsTemp4D4 = true;
            this.IsTemp4Threshold4 = true;
            this.IsTemp4P5 = true;
            this.IsTemp4I5 = true;
            this.IsTemp4D5 = true;
            this.IsTemp4Threshold5 = true;
            this.IsTemp4P6 = true;
            this.IsTemp4I6 = true;
            this.IsTemp4D6 = true;
            this.IsTemp4Threshold6 = true;
            this.IsTemp4P7 = true;
            this.IsTemp4I7 = true;
            this.IsTemp4D7 = true;
            this.IsTemp4Threshold7 = true;
            this.IsTemp4P8 = true;
            this.IsTemp4I8 = true;
            this.IsTemp4D8 = true;
            this.IsTemp4Threshold8 = true;

            this.IsTemp5P1 = true;
            this.IsTemp5I1 = true;
            this.IsTemp5D1 = true;
            this.IsTemp5Threshold1 = true;
            this.IsTemp5P2 = true;
            this.IsTemp5I2 = true;
            this.IsTemp5D2 = true;
            this.IsTemp5Threshold2 = true;
            this.IsTemp5P3 = true;
            this.IsTemp5I3 = true;
            this.IsTemp5D3 = true;
            this.IsTemp5Threshold3 = true;
            this.IsTemp5P4 = true;
            this.IsTemp5I4 = true;
            this.IsTemp5D4 = true;
            this.IsTemp5Threshold4 = true;
            this.IsTemp5P5 = true;
            this.IsTemp5I5 = true;
            this.IsTemp5D5 = true;
            this.IsTemp5Threshold5 = true;
            this.IsTemp5P6 = true;
            this.IsTemp5I6 = true;
            this.IsTemp5D6 = true;
            this.IsTemp5Threshold6 = true;
            this.IsTemp5P7 = true;
            this.IsTemp5I7 = true;
            this.IsTemp5D7 = true;
            this.IsTemp5Threshold7 = true;
            this.IsTemp5P8 = true;
            this.IsTemp5I8 = true;
            this.IsTemp5D8 = true;
            this.IsTemp5Threshold8 = true;
        }
        private TreeViewItem GetParentObjectEx<TreeViewItem>(DependencyObject obj) where TreeViewItem : FrameworkElement
        {
            DependencyObject parent = VisualTreeHelper.GetParent(obj);
            while (parent != null)
            {
                if (parent is TreeViewItem)
                {
                    return (TreeViewItem)parent;
                }
                parent = VisualTreeHelper.GetParent(parent);
            }
            return null;
        }
        public void TreeRightMouseDown(MouseButtonEventArgs e)
        {
            var item = GetParentObjectEx<TreeViewItem>(e.OriginalSource as DependencyObject) as TreeViewItem;
            if (item != null)
            {
                item.Focus();
            }
        }

        private void ClearData()
        {
            this.editMode = EditMode.None;
            this.Recipe.Steps.Clear();
            this.Recipe.Name = string.Empty;
            this.Recipe.Description = string.Empty;
            this.Recipe.Creator = string.Empty;
            this.Recipe.CreateTime = DateTime.MinValue;
            this.Recipe.Revisor = string.Empty;
            this.Recipe.ReviseTime = DateTime.MinValue;
            this.Recipe.StartTemp = string.Empty;
            this.Recipe.HeatingRate = string.Empty;
            this.Recipe.DelayTime = string.Empty;
            this.Recipe.P = string.Empty;
            this.Recipe.I = string.Empty;
            this.Recipe.D = string.Empty;
            this.Recipe.SwitchTemperature = string.Empty;
            this.Recipe.MaxPower = string.Empty;
            this.Recipe.MinPower = string.Empty;
            this.Recipe.Offset1 = string.Empty;
            this.Recipe.Offset2 = string.Empty;
            this.Recipe.Offset3 = string.Empty;
            this.Recipe.Offset4 = string.Empty;
            this.Recipe.Offset5 = string.Empty;
            this.Recipe.Emissivity1 = string.Empty;
            this.Recipe.Emissivity2 = string.Empty;
            this.Recipe.Emissivity3 = string.Empty;
            this.Recipe.Emissivity4 = string.Empty;
            this.Recipe.Emissivity5 = string.Empty;
            this.Recipe.PressureMode = string.Empty;
            this.Recipe.OxygenContentAlarm = string.Empty;
            this.Recipe.TemperatureInfrared1P1 = string.Empty;
            this.Recipe.TemperatureInfrared1I1 = string.Empty;
            this.Recipe.TemperatureInfrared1D1 = string.Empty;
            this.Recipe.TemperatureInfrared1Threshold1 = string.Empty;
            this.Recipe.TemperatureInfrared1P2 = string.Empty;
            this.Recipe.TemperatureInfrared1I2 = string.Empty;
            this.Recipe.TemperatureInfrared1D2 = string.Empty;
            this.Recipe.TemperatureInfrared1Threshold2 = string.Empty;
            this.Recipe.TemperatureInfrared1P3 = string.Empty;
            this.Recipe.TemperatureInfrared1I3 = string.Empty;
            this.Recipe.TemperatureInfrared1D3 = string.Empty;
            this.Recipe.TemperatureInfrared1Threshold3 = string.Empty;
            this.Recipe.TemperatureInfrared1P4 = string.Empty;
            this.Recipe.TemperatureInfrared1I4 = string.Empty;
            this.Recipe.TemperatureInfrared1D4 = string.Empty;
            this.Recipe.TemperatureInfrared1Threshold4 = string.Empty;
            this.Recipe.TemperatureInfrared1P5 = string.Empty;
            this.Recipe.TemperatureInfrared1I5 = string.Empty;
            this.Recipe.TemperatureInfrared1D5 = string.Empty;
            this.Recipe.TemperatureInfrared1Threshold5 = string.Empty;
            this.Recipe.TemperatureInfrared1P6 = string.Empty;
            this.Recipe.TemperatureInfrared1I6 = string.Empty;
            this.Recipe.TemperatureInfrared1D6 = string.Empty;
            this.Recipe.TemperatureInfrared1Threshold6 = string.Empty;
            this.Recipe.TemperatureInfrared1P7 = string.Empty;
            this.Recipe.TemperatureInfrared1I7 = string.Empty;
            this.Recipe.TemperatureInfrared1D7 = string.Empty;
            this.Recipe.TemperatureInfrared1Threshold7 = string.Empty;
            this.Recipe.TemperatureInfrared1P8 = string.Empty;
            this.Recipe.TemperatureInfrared1I8 = string.Empty;
            this.Recipe.TemperatureInfrared1D8 = string.Empty;
            this.Recipe.TemperatureInfrared1Threshold8 = string.Empty;

            this.Recipe.TemperatureInfrared2P1 = string.Empty;
            this.Recipe.TemperatureInfrared2I1 = string.Empty;
            this.Recipe.TemperatureInfrared2D1 = string.Empty;
            this.Recipe.TemperatureInfrared2Threshold1 = string.Empty;
            this.Recipe.TemperatureInfrared2P2 = string.Empty;
            this.Recipe.TemperatureInfrared2I2 = string.Empty;
            this.Recipe.TemperatureInfrared2D2 = string.Empty;
            this.Recipe.TemperatureInfrared2Threshold2 = string.Empty;
            this.Recipe.TemperatureInfrared2P3 = string.Empty;
            this.Recipe.TemperatureInfrared2I3 = string.Empty;
            this.Recipe.TemperatureInfrared2D3 = string.Empty;
            this.Recipe.TemperatureInfrared2Threshold3 = string.Empty;
            this.Recipe.TemperatureInfrared2P4 = string.Empty;
            this.Recipe.TemperatureInfrared2I4 = string.Empty;
            this.Recipe.TemperatureInfrared2D4 = string.Empty;
            this.Recipe.TemperatureInfrared2Threshold4 = string.Empty;
            this.Recipe.TemperatureInfrared2P5 = string.Empty;
            this.Recipe.TemperatureInfrared2I5 = string.Empty;
            this.Recipe.TemperatureInfrared2D5 = string.Empty;
            this.Recipe.TemperatureInfrared2Threshold5 = string.Empty;
            this.Recipe.TemperatureInfrared2P6 = string.Empty;
            this.Recipe.TemperatureInfrared2I6 = string.Empty;
            this.Recipe.TemperatureInfrared2D6 = string.Empty;
            this.Recipe.TemperatureInfrared2Threshold6 = string.Empty;
            this.Recipe.TemperatureInfrared2P7 = string.Empty;
            this.Recipe.TemperatureInfrared2I7 = string.Empty;
            this.Recipe.TemperatureInfrared2D7 = string.Empty;
            this.Recipe.TemperatureInfrared2Threshold7 = string.Empty;
            this.Recipe.TemperatureInfrared2P8 = string.Empty;
            this.Recipe.TemperatureInfrared2I8 = string.Empty;
            this.Recipe.TemperatureInfrared2D8 = string.Empty;
            this.Recipe.TemperatureInfrared2Threshold8 = string.Empty;

            this.Recipe.TemperatureInfrared3P1 = string.Empty;
            this.Recipe.TemperatureInfrared3I1 = string.Empty;
            this.Recipe.TemperatureInfrared3D1 = string.Empty;
            this.Recipe.TemperatureInfrared3Threshold1 = string.Empty;
            this.Recipe.TemperatureInfrared3P2 = string.Empty;
            this.Recipe.TemperatureInfrared3I2 = string.Empty;
            this.Recipe.TemperatureInfrared3D2 = string.Empty;
            this.Recipe.TemperatureInfrared3Threshold2 = string.Empty;
            this.Recipe.TemperatureInfrared3P3 = string.Empty;
            this.Recipe.TemperatureInfrared3I3 = string.Empty;
            this.Recipe.TemperatureInfrared3D3 = string.Empty;
            this.Recipe.TemperatureInfrared3Threshold3 = string.Empty;
            this.Recipe.TemperatureInfrared3P4 = string.Empty;
            this.Recipe.TemperatureInfrared3I4 = string.Empty;
            this.Recipe.TemperatureInfrared3D4 = string.Empty;
            this.Recipe.TemperatureInfrared3Threshold4 = string.Empty;
            this.Recipe.TemperatureInfrared3P5 = string.Empty;
            this.Recipe.TemperatureInfrared3I5 = string.Empty;
            this.Recipe.TemperatureInfrared3D5 = string.Empty;
            this.Recipe.TemperatureInfrared3Threshold5 = string.Empty;
            this.Recipe.TemperatureInfrared3P6 = string.Empty;
            this.Recipe.TemperatureInfrared3I6 = string.Empty;
            this.Recipe.TemperatureInfrared3D6 = string.Empty;
            this.Recipe.TemperatureInfrared3Threshold6 = string.Empty;
            this.Recipe.TemperatureInfrared3P7 = string.Empty;
            this.Recipe.TemperatureInfrared3I7 = string.Empty;
            this.Recipe.TemperatureInfrared3D7 = string.Empty;
            this.Recipe.TemperatureInfrared3Threshold7 = string.Empty;
            this.Recipe.TemperatureInfrared3P8 = string.Empty;
            this.Recipe.TemperatureInfrared3I8 = string.Empty;
            this.Recipe.TemperatureInfrared3D8 = string.Empty;
            this.Recipe.TemperatureInfrared3Threshold8 = string.Empty;

            this.Recipe.TemperatureInfrared4P1 = string.Empty;
            this.Recipe.TemperatureInfrared4I1 = string.Empty;
            this.Recipe.TemperatureInfrared4D1 = string.Empty;
            this.Recipe.TemperatureInfrared4Threshold1 = string.Empty;
            this.Recipe.TemperatureInfrared4P2 = string.Empty;
            this.Recipe.TemperatureInfrared4I2 = string.Empty;
            this.Recipe.TemperatureInfrared4D2 = string.Empty;
            this.Recipe.TemperatureInfrared4Threshold2 = string.Empty;
            this.Recipe.TemperatureInfrared4P3 = string.Empty;
            this.Recipe.TemperatureInfrared4I3 = string.Empty;
            this.Recipe.TemperatureInfrared4D3 = string.Empty;
            this.Recipe.TemperatureInfrared4Threshold3 = string.Empty;
            this.Recipe.TemperatureInfrared4P4 = string.Empty;
            this.Recipe.TemperatureInfrared4I4 = string.Empty;
            this.Recipe.TemperatureInfrared4D4 = string.Empty;
            this.Recipe.TemperatureInfrared4Threshold4 = string.Empty;
            this.Recipe.TemperatureInfrared4P5 = string.Empty;
            this.Recipe.TemperatureInfrared4I5 = string.Empty;
            this.Recipe.TemperatureInfrared4D5 = string.Empty;
            this.Recipe.TemperatureInfrared4Threshold5 = string.Empty;
            this.Recipe.TemperatureInfrared4P6 = string.Empty;
            this.Recipe.TemperatureInfrared4I6 = string.Empty;
            this.Recipe.TemperatureInfrared4D6 = string.Empty;
            this.Recipe.TemperatureInfrared4Threshold6 = string.Empty;
            this.Recipe.TemperatureInfrared4P7 = string.Empty;
            this.Recipe.TemperatureInfrared4I7 = string.Empty;
            this.Recipe.TemperatureInfrared4D7 = string.Empty;
            this.Recipe.TemperatureInfrared4Threshold7 = string.Empty;
            this.Recipe.TemperatureInfrared4P8 = string.Empty;
            this.Recipe.TemperatureInfrared4I8 = string.Empty;
            this.Recipe.TemperatureInfrared4D8 = string.Empty;
            this.Recipe.TemperatureInfrared4Threshold8 = string.Empty;

            this.Recipe.TemperatureInfrared5P1 = string.Empty;
            this.Recipe.TemperatureInfrared5I1 = string.Empty;
            this.Recipe.TemperatureInfrared5D1 = string.Empty;
            this.Recipe.TemperatureInfrared5Threshold1 = string.Empty;
            this.Recipe.TemperatureInfrared5P2 = string.Empty;
            this.Recipe.TemperatureInfrared5I2 = string.Empty;
            this.Recipe.TemperatureInfrared5D2 = string.Empty;
            this.Recipe.TemperatureInfrared5Threshold2 = string.Empty;
            this.Recipe.TemperatureInfrared5P3 = string.Empty;
            this.Recipe.TemperatureInfrared5I3 = string.Empty;
            this.Recipe.TemperatureInfrared5D3 = string.Empty;
            this.Recipe.TemperatureInfrared5Threshold3 = string.Empty;
            this.Recipe.TemperatureInfrared5P4 = string.Empty;
            this.Recipe.TemperatureInfrared5I4 = string.Empty;
            this.Recipe.TemperatureInfrared5D4 = string.Empty;
            this.Recipe.TemperatureInfrared5Threshold4 = string.Empty;
            this.Recipe.TemperatureInfrared5P5 = string.Empty;
            this.Recipe.TemperatureInfrared5I5 = string.Empty;
            this.Recipe.TemperatureInfrared5D5 = string.Empty;
            this.Recipe.TemperatureInfrared5Threshold5 = string.Empty;
            this.Recipe.TemperatureInfrared5P6 = string.Empty;
            this.Recipe.TemperatureInfrared5I6 = string.Empty;
            this.Recipe.TemperatureInfrared5D6 = string.Empty;
            this.Recipe.TemperatureInfrared5Threshold6 = string.Empty;
            this.Recipe.TemperatureInfrared5P7 = string.Empty;
            this.Recipe.TemperatureInfrared5I7 = string.Empty;
            this.Recipe.TemperatureInfrared5D7 = string.Empty;
            this.Recipe.TemperatureInfrared5Threshold7 = string.Empty;
            this.Recipe.TemperatureInfrared5P8 = string.Empty;
            this.Recipe.TemperatureInfrared5I8 = string.Empty;
            this.Recipe.TemperatureInfrared5D8 = string.Empty;
            this.Recipe.TemperatureInfrared5Threshold8 = string.Empty;
        }

        private void LoadData(string recipename)
        {
            this.Recipe.Steps.Clear();
            var str = recipeProvider.LoadRecipe(recipename);
            this.Recipe.Name = recipename;
            if (string.IsNullOrEmpty(str))
            {
                return;
            }
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(str);
            this.Recipe.LoadHeader(doc.SelectSingleNode("Aitex/TableRecipeData"));
            this.Recipe.LoadSteps(this.Columns, doc.SelectNodes("Aitex/TableRecipeData/Step"));
            RecipeTrue();

            var index = 1;
            foreach (ObservableCollection<Param> parameters in this.Recipe.Steps)
            {
                (parameters[1] as StepParam).Value = index.ToString();
                index++;
            }
            PressureModeInfo = Recipe.PressureMode;
            OxygenContentAlarmInfo = Recipe.OxygenContentAlarm;

            this.editMode = EditMode.Normal;
        }

        private void UpdateView()
        {
            if (IsError)
            {
                this.EnableNew = false;
                this.EnableReName = false;
                this.EnableCopy = false;
                this.EnableDelete = false;
                this.EnableStep = false;
                this.EnableSave = false;
                this.EnableEdit = false;

                this.NotifyOfPropertyChange("EnableNew");
                this.NotifyOfPropertyChange("EnableReName");
                this.NotifyOfPropertyChange("EnableCopy");
                this.NotifyOfPropertyChange("EnableDelete");
                this.NotifyOfPropertyChange("EnableSave");
                this.NotifyOfPropertyChange("EnableStep");
                this.NotifyOfPropertyChange("EnableEdit");
                return;
            }
            this.EnableNew = true;
            this.EnableReName = true;
            this.EnableCopy = true;
            this.EnableDelete = true;
            this.EnableSave = true;
            this.EnableStep = true;
            this.EnableEdit = true;


            if (this.editMode == EditMode.None)
            {
                this.EnableNew = true;
                this.EnableReName = false;
                this.EnableCopy = false;
                this.EnableDelete = false;
                this.EnableStep = false;
                this.EnableSave = false;
                this.EnableEdit = false;

            }
            this.NotifyOfPropertyChange("EnableNew");
            this.NotifyOfPropertyChange("EnableReName");
            this.NotifyOfPropertyChange("EnableCopy");
            this.NotifyOfPropertyChange("EnableDelete");
            this.NotifyOfPropertyChange("EnableSave");
            this.NotifyOfPropertyChange("EnableStep");
            this.NotifyOfPropertyChange("EnableEdit");
            Recipe.IsIdle = !workRecipe.Contains(Recipe.Name);
        }

        public bool IsChanged
        {
            get
            {
                if (!Recipe.IsIdle)
                    return false;
                bool changed = false;
                if (this.editMode == EditMode.Edit || !this.IsSavedDesc || !this.OxygenContentAlarmchanged || !this.PressureModechanged || !this.IsStartTemp || !this.IsHeatingRate || !this.IsDelayTime || !this.IsPidP || !this.IsPidI || !this.IsPidD || !this.IsSwitchTemperature || !this.IsMaxPower || !this.IsMinPower || !this.IsOffset1 || !this.IsOffset2 || !this.IsOffset3 || !this.IsOffset4 || !this.IsOffset5 || !this.IsEmissivity1 || !this.IsEmissivity2 || !this.IsEmissivity3 || !this.IsEmissivity4 || !this.IsEmissivity5 ||
                            !this.IsTemp1P1 || !this.IsTemp1I1 || !this.IsTemp1D1 || !this.IsTemp1Threshold1 || !this.IsTemp1P2 || !this.IsTemp1I2 || !this.IsTemp1D2 || !this.IsTemp1Threshold2 || !this.IsTemp1P3 || !this.IsTemp1I3 || !this.IsTemp1D3 || !this.IsTemp1Threshold3 || !this.IsTemp1P4 || !this.IsTemp1I4 || !this.IsTemp1D4 || !this.IsTemp1Threshold4 || !this.IsTemp1P5 || !this.IsTemp1I5 || !this.IsTemp1D5 || !this.IsTemp1Threshold5 || !this.IsTemp1P6 || !this.IsTemp1I6 || !this.IsTemp1D6 || !this.IsTemp1Threshold6 || !this.IsTemp1P7 || !this.IsTemp1I7 || !this.IsTemp1D7 || !this.IsTemp1Threshold7 || !this.IsTemp1P8 || !this.IsTemp1I8 || !this.IsTemp1D8 || !this.IsTemp1Threshold8 ||
                            !this.IsTemp2P1 || !this.IsTemp2I1 || !this.IsTemp2D1 || !this.IsTemp2Threshold1 || !this.IsTemp2P2 || !this.IsTemp2I2 || !this.IsTemp2D2 || !this.IsTemp2Threshold2 || !this.IsTemp2P3 || !this.IsTemp2I3 || !this.IsTemp2D3 || !this.IsTemp2Threshold3 || !this.IsTemp2P4 || !this.IsTemp2I4 || !this.IsTemp2D4 || !this.IsTemp2Threshold4 || !this.IsTemp2P5 || !this.IsTemp2I5 || !this.IsTemp2D5 || !this.IsTemp2Threshold5 || !this.IsTemp2P6 || !this.IsTemp2I6 || !this.IsTemp2D6 || !this.IsTemp2Threshold6 || !this.IsTemp2P7 || !this.IsTemp2I7 || !this.IsTemp2D7 || !this.IsTemp2Threshold7 || !this.IsTemp2P8 || !this.IsTemp2I8 || !this.IsTemp2D8 || !this.IsTemp2Threshold8 ||
                            !this.IsTemp3P1 || !this.IsTemp3I1 || !this.IsTemp3D1 || !this.IsTemp3Threshold1 || !this.IsTemp3P2 || !this.IsTemp3I2 || !this.IsTemp3D2 || !this.IsTemp3Threshold2 || !this.IsTemp3P3 || !this.IsTemp3I3 || !this.IsTemp3D3 || !this.IsTemp3Threshold3 || !this.IsTemp3P4 || !this.IsTemp3I4 || !this.IsTemp3D4 || !this.IsTemp3Threshold4 || !this.IsTemp3P5 || !this.IsTemp3I5 || !this.IsTemp3D5 || !this.IsTemp3Threshold5 || !this.IsTemp3P6 || !this.IsTemp3I6 || !this.IsTemp3D6 || !this.IsTemp3Threshold6 || !this.IsTemp3P7 || !this.IsTemp3I7 || !this.IsTemp3D7 || !this.IsTemp3Threshold7 || !this.IsTemp3P8 || !this.IsTemp3I8 || !this.IsTemp3D8 || !this.IsTemp3Threshold8 ||
                            !this.IsTemp4P1 || !this.IsTemp4I1 || !this.IsTemp4D1 || !this.IsTemp4Threshold1 || !this.IsTemp4P2 || !this.IsTemp4I2 || !this.IsTemp4D2 || !this.IsTemp4Threshold2 || !this.IsTemp4P3 || !this.IsTemp4I3 || !this.IsTemp4D3 || !this.IsTemp4Threshold3 || !this.IsTemp4P4 || !this.IsTemp4I4 || !this.IsTemp4D4 || !this.IsTemp4Threshold4 || !this.IsTemp4P5 || !this.IsTemp4I5 || !this.IsTemp4D5 || !this.IsTemp4Threshold5 || !this.IsTemp4P6 || !this.IsTemp4I6 || !this.IsTemp4D6 || !this.IsTemp4Threshold6 || !this.IsTemp4P7 || !this.IsTemp4I7 || !this.IsTemp4D7 || !this.IsTemp4Threshold7 || !this.IsTemp4P8 || !this.IsTemp4I8 || !this.IsTemp4D8 || !this.IsTemp4Threshold8 ||
                            !this.IsTemp5P1 || !this.IsTemp5I1 || !this.IsTemp5D1 || !this.IsTemp5Threshold1 || !this.IsTemp5P2 || !this.IsTemp5I2 || !this.IsTemp5D2 || !this.IsTemp5Threshold2 || !this.IsTemp5P3 || !this.IsTemp5I3 || !this.IsTemp5D3 || !this.IsTemp5Threshold3 || !this.IsTemp5P4 || !this.IsTemp5I4 || !this.IsTemp5D4 || !this.IsTemp5Threshold4 || !this.IsTemp5P5 || !this.IsTemp5I5 || !this.IsTemp5D5 || !this.IsTemp5Threshold5 || !this.IsTemp5P6 || !this.IsTemp5I6 || !this.IsTemp5D6 || !this.IsTemp5Threshold6 || !this.IsTemp5P7 || !this.IsTemp5I7 || !this.IsTemp5D7 || !this.IsTemp5Threshold7 || !this.IsTemp5P8 || !this.IsTemp5I8 || !this.IsTemp5D8 || !this.IsTemp5Threshold8)
                    changed = true;
                else
                    foreach (ObservableCollection<Param> parameters in this.Recipe.Steps)
                    {
                        if (parameters.Where(param => param.IsSaved == false).Count() > 0)
                        {
                            changed = true;
                            break;
                        }
                    }
                return changed;
            }
        }

        private bool IsExist(string recipename)
        {
            bool existed = false;
            FileNode filenode = this.CurrentFileNode.IsFile ? this.CurrentFileNode.Parent : this.CurrentFileNode;
            for (var index = 0; index < filenode.Files.Count; index++)
            {
                if (filenode.Files[index].FullPath.ToLower() == recipename.ToLower())
                {
                    existed = true;
                    break;
                }
            }
            return existed;
        }
        public void SelectionModeChanged(ComboBoxItem NewPressureMode)
        {
            string NewMode = NewPressureMode?.Content.ToString();
            if (NewMode != null && NewMode != PressureModeInfo)
            {
                PressureModechanged = false;
            }
            else
            {
                PressureModechanged = true;
                this.editMode = EditMode.None;
            }

        }
        public void SelectionAlarmChanged(ComboBoxItem NewOxygenContentAlarm)
        {
            string NewAlarm = NewOxygenContentAlarm?.Content.ToString();
            if (NewAlarm != null && NewAlarm != OxygenContentAlarmInfo)
            {
                OxygenContentAlarmchanged = false;
            }
            else
            {
                OxygenContentAlarmchanged = true;
                this.editMode = EditMode.None;
            }
        }

        public void Handle(JobStateMessage message)
        {
            if (message.JobTypeName == JobType.Recipe)
            {
                workRecipe = message.JobNameList;
                if (workRecipe.Count > 0)
                    Recipe.IsIdle = !workRecipe.Contains(Recipe.Name);
            }
        }

        private string pressureModeInfo;
        public string PressureModeInfo
        {
            get
            {
                return pressureModeInfo;
            }
            set
            {
                pressureModeInfo = value;
                NotifyOfPropertyChange(nameof(PressureModeInfo));
            }
        }
        private bool pressureModechanged;
        public bool PressureModechanged
        {
            get
            {
                return pressureModechanged;
            }
            set
            {
                pressureModechanged = value;
                NotifyOfPropertyChange(nameof(PressureModechanged));
            }
        }
        private string oxygenContentAlarmInfo;
        public string OxygenContentAlarmInfo
        {
            get
            {
                return oxygenContentAlarmInfo;
            }
            set
            {
                oxygenContentAlarmInfo = value;
                NotifyOfPropertyChange(nameof(OxygenContentAlarmInfo));
            }
        }
        private bool oxygenContentAlarmchanged;
        public bool OxygenContentAlarmchanged
        {
            get
            {
                return oxygenContentAlarmchanged;
            }
            set
            {
                oxygenContentAlarmchanged = value;
                NotifyOfPropertyChange(nameof(OxygenContentAlarmchanged));
            }
        }

        #region Head Pyrometer Parameter
        private bool isStartTemp;
        public bool IsStartTemp
        {
            get
            {
                return isStartTemp;
            }
            set
            {
                isStartTemp = value;
                NotifyOfPropertyChange(nameof(IsStartTemp));
            }
        }
        private bool isHeatingRate;
        public bool IsHeatingRate
        {
            get
            {
                return isHeatingRate;
            }
            set
            {
                isHeatingRate = value;
                NotifyOfPropertyChange(nameof(IsHeatingRate));
            }
        }
        private bool isDelayTime;
        public bool IsDelayTime
        {
            get
            {
                return isDelayTime;
            }
            set
            {
                isDelayTime = value;
                NotifyOfPropertyChange(nameof(IsDelayTime));
            }
        }
        private bool isPidP;
        public bool IsPidP
        {
            get
            {
                return isPidP;
            }
            set
            {
                isPidP = value;
                NotifyOfPropertyChange(nameof(IsPidP));
            }
        }
        private bool isPidI;
        public bool IsPidI
        {
            get
            {
                return isPidI;
            }
            set
            {
                isPidI = value;
                NotifyOfPropertyChange(nameof(IsPidI));
            }
        }

        private bool isPidD;
        public bool IsPidD
        {
            get
            {
                return isPidD;
            }
            set
            {
                isPidD = value;
                NotifyOfPropertyChange(nameof(IsPidD));
            }
        }
        private bool isSwitchTemperature;
        public bool IsSwitchTemperature
        {
            get
            {
                return isSwitchTemperature;
            }
            set
            {
                isSwitchTemperature = value;
                NotifyOfPropertyChange(nameof(IsSwitchTemperature));
            }
        }
        private bool isMaxPower;
        public bool IsMaxPower
        {
            get
            {
                return isMaxPower;
            }
            set
            {
                isMaxPower = value;
                NotifyOfPropertyChange(nameof(IsMaxPower));
            }
        }
        private bool isMinPower;
        public bool IsMinPower
        {
            get
            {
                return isMinPower;
            }
            set
            {
                isMinPower = value;
                NotifyOfPropertyChange(nameof(IsMinPower));
            }
        }

        private bool isOffset1;
        public bool IsOffset1
        {
            get
            {
                return isOffset1;
            }
            set
            {
                isOffset1 = value;
                NotifyOfPropertyChange(nameof(IsOffset1));
            }
        }
        private bool isOffset2;
        public bool IsOffset2
        {
            get
            {
                return isOffset2;
            }
            set
            {
                isOffset2 = value;
                NotifyOfPropertyChange(nameof(IsOffset2));
            }
        }
        private bool isOffset3;
        public bool IsOffset3
        {
            get
            {
                return isOffset3;
            }
            set
            {
                isOffset3 = value;
                NotifyOfPropertyChange(nameof(IsOffset3));
            }
        }
        private bool isOffset4;
        public bool IsOffset4
        {
            get
            {
                return isOffset4;
            }
            set
            {
                isOffset4 = value;
                NotifyOfPropertyChange(nameof(IsOffset4));
            }
        }
        private bool isOffset5;
        public bool IsOffset5
        {
            get
            {
                return isOffset5;
            }
            set
            {
                isOffset5 = value;
                NotifyOfPropertyChange(nameof(IsOffset5));
            }
        }
        private bool isEmissivity1;
        public bool IsEmissivity1
        {
            get
            {
                return isEmissivity1;
            }
            set
            {
                isEmissivity1 = value;
                NotifyOfPropertyChange(nameof(IsEmissivity1));
            }
        }
        private bool isEmissivity2;
        public bool IsEmissivity2
        {
            get
            {
                return isEmissivity2;
            }
            set
            {
                isEmissivity2 = value;
                NotifyOfPropertyChange(nameof(IsEmissivity2));
            }
        }
        private bool isEmissivity3;
        public bool IsEmissivity3
        {
            get
            {
                return isEmissivity3;
            }
            set
            {
                isEmissivity3 = value;
                NotifyOfPropertyChange(nameof(IsEmissivity3));
            }
        }
        private bool isEmissivity4;
        public bool IsEmissivity4
        {
            get
            {
                return isEmissivity4;
            }
            set
            {
                isEmissivity4 = value;
                NotifyOfPropertyChange(nameof(IsEmissivity4));
            }
        }
        private bool isEmissivity5;
        public bool IsEmissivity5
        {
            get
            {
                return isEmissivity5;
            }
            set
            {
                isEmissivity5 = value;
                NotifyOfPropertyChange(nameof(IsEmissivity5));
            }
        }

        #region Temp1
        private bool isTemp1P1;
        public bool IsTemp1P1
        {
            get
            {
                return isTemp1P1;
            }
            set
            {
                isTemp1P1 = value;
                NotifyOfPropertyChange(nameof(IsTemp1P1));
            }
        }

        private bool isTemp1I1;
        public bool IsTemp1I1
        {
            get
            {
                return isTemp1I1;
            }
            set
            {
                isTemp1I1 = value;
                NotifyOfPropertyChange(nameof(IsTemp1I1));
            }
        }

        private bool isTemp1D1;
        public bool IsTemp1D1
        {
            get
            {
                return isTemp1D1;
            }
            set
            {
                isTemp1D1 = value;
                NotifyOfPropertyChange(nameof(IsTemp1D1));
            }
        }

        private bool isTemp1Threshold1;
        public bool IsTemp1Threshold1
        {
            get
            {
                return isTemp1Threshold1;
            }
            set
            {
                isTemp1Threshold1 = value;
                NotifyOfPropertyChange(nameof(IsTemp1Threshold1));
            }
        }

        private bool isTemp1P2;
        public bool IsTemp1P2
        {
            get
            {
                return isTemp1P2;
            }
            set
            {
                isTemp1P2 = value;
                NotifyOfPropertyChange(nameof(IsTemp1P2));
            }
        }

        private bool isTemp1I2;
        public bool IsTemp1I2
        {
            get
            {
                return isTemp1I2;
            }
            set
            {
                isTemp1I2 = value;
                NotifyOfPropertyChange(nameof(IsTemp1I2));
            }
        }

        private bool isTemp1D2;
        public bool IsTemp1D2
        {
            get
            {
                return isTemp1D2;
            }
            set
            {
                isTemp1D2 = value;
                NotifyOfPropertyChange(nameof(IsTemp1D2));
            }
        }

        private bool isTemp1Threshold2;
        public bool IsTemp1Threshold2
        {
            get
            {
                return isTemp1Threshold2;
            }
            set
            {
                isTemp1Threshold2 = value;
                NotifyOfPropertyChange(nameof(IsTemp1Threshold2));
            }
        }
        private bool isTemp1P3;
        public bool IsTemp1P3
        {
            get
            {
                return isTemp1P3;
            }
            set
            {
                isTemp1P3 = value;
                NotifyOfPropertyChange(nameof(IsTemp1P3));
            }
        }

        private bool isTemp1I3;
        public bool IsTemp1I3
        {
            get
            {
                return isTemp1I3;
            }
            set
            {
                isTemp1I3 = value;
                NotifyOfPropertyChange(nameof(IsTemp1I3));
            }
        }

        private bool isTemp1D3;
        public bool IsTemp1D3
        {
            get
            {
                return isTemp1D3;
            }
            set
            {
                isTemp1D3 = value;
                NotifyOfPropertyChange(nameof(IsTemp1D3));
            }
        }

        private bool isTemp1Threshold3;
        public bool IsTemp1Threshold3
        {
            get
            {
                return isTemp1Threshold3;
            }
            set
            {
                isTemp1Threshold3 = value;
                NotifyOfPropertyChange(nameof(IsTemp1Threshold3));
            }
        }
        private bool isTemp1P4;
        public bool IsTemp1P4
        {
            get
            {
                return isTemp1P4;
            }
            set
            {
                isTemp1P4 = value;
                NotifyOfPropertyChange(nameof(IsTemp1P4));
            }
        }

        private bool isTemp1I4;
        public bool IsTemp1I4
        {
            get
            {
                return isTemp1I4;
            }
            set
            {
                isTemp1I4 = value;
                NotifyOfPropertyChange(nameof(IsTemp1I4));
            }
        }

        private bool isTemp1D4;
        public bool IsTemp1D4
        {
            get
            {
                return isTemp1D4;
            }
            set
            {
                isTemp1D4 = value;
                NotifyOfPropertyChange(nameof(IsTemp1D4));
            }
        }

        private bool isTemp1Threshold4;
        public bool IsTemp1Threshold4
        {
            get
            {
                return isTemp1Threshold4;
            }
            set
            {
                isTemp1Threshold4 = value;
                NotifyOfPropertyChange(nameof(IsTemp1Threshold4));
            }
        }
        private bool isTemp1P5;
        public bool IsTemp1P5
        {
            get
            {
                return isTemp1P5;
            }
            set
            {
                isTemp1P5 = value;
                NotifyOfPropertyChange(nameof(IsTemp1P5));
            }
        }

        private bool isTemp1I5;
        public bool IsTemp1I5
        {
            get
            {
                return isTemp1I5;
            }
            set
            {
                isTemp1I5 = value;
                NotifyOfPropertyChange(nameof(IsTemp1I5));
            }
        }

        private bool isTemp1D5;
        public bool IsTemp1D5
        {
            get
            {
                return isTemp1D5;
            }
            set
            {
                isTemp1D5 = value;
                NotifyOfPropertyChange(nameof(IsTemp1D5));
            }
        }

        private bool isTemp1Threshold5;
        public bool IsTemp1Threshold5
        {
            get
            {
                return isTemp1Threshold5;
            }
            set
            {
                isTemp1Threshold5 = value;
                NotifyOfPropertyChange(nameof(IsTemp1Threshold5));
            }
        }
        private bool isTemp1P6;
        public bool IsTemp1P6
        {
            get
            {
                return isTemp1P6;
            }
            set
            {
                isTemp1P6 = value;
                NotifyOfPropertyChange(nameof(IsTemp1P6));
            }
        }

        private bool isTemp1I6;
        public bool IsTemp1I6
        {
            get
            {
                return isTemp1I6;
            }
            set
            {
                isTemp1I6 = value;
                NotifyOfPropertyChange(nameof(IsTemp1I6));
            }
        }

        private bool isTemp1D6;
        public bool IsTemp1D6
        {
            get
            {
                return isTemp1D6;
            }
            set
            {
                isTemp1D6 = value;
                NotifyOfPropertyChange(nameof(IsTemp1D6));
            }
        }

        private bool isTemp1Threshold6;
        public bool IsTemp1Threshold6
        {
            get
            {
                return isTemp1Threshold6;
            }
            set
            {
                isTemp1Threshold6 = value;
                NotifyOfPropertyChange(nameof(IsTemp1Threshold6));
            }
        }
        private bool isTemp1P7;
        public bool IsTemp1P7
        {
            get
            {
                return isTemp1P7;
            }
            set
            {
                isTemp1P7 = value;
                NotifyOfPropertyChange(nameof(IsTemp1P7));
            }
        }

        private bool isTemp1I7;
        public bool IsTemp1I7
        {
            get
            {
                return isTemp1I7;
            }
            set
            {
                isTemp1I7 = value;
                NotifyOfPropertyChange(nameof(IsTemp1I7));
            }
        }

        private bool isTemp1D7;
        public bool IsTemp1D7
        {
            get
            {
                return isTemp1D7;
            }
            set
            {
                isTemp1D7 = value;
                NotifyOfPropertyChange(nameof(IsTemp1D7));
            }
        }

        private bool isTemp1Threshold7;
        public bool IsTemp1Threshold7
        {
            get
            {
                return isTemp1Threshold7;
            }
            set
            {
                isTemp1Threshold7 = value;
                NotifyOfPropertyChange(nameof(IsTemp1Threshold7));
            }
        }
        private bool isTemp1P8;
        public bool IsTemp1P8
        {
            get
            {
                return isTemp1P8;
            }
            set
            {
                isTemp1P8 = value;
                NotifyOfPropertyChange(nameof(IsTemp1P8));
            }
        }

        private bool isTemp1I8;
        public bool IsTemp1I8
        {
            get
            {
                return isTemp1I8;
            }
            set
            {
                isTemp1I8 = value;
                NotifyOfPropertyChange(nameof(IsTemp1I8));
            }
        }

        private bool isTemp1D8;
        public bool IsTemp1D8
        {
            get
            {
                return isTemp1D8;
            }
            set
            {
                isTemp1D8 = value;
                NotifyOfPropertyChange(nameof(IsTemp1D8));
            }
        }

        private bool isTemp1Threshold8;
        public bool IsTemp1Threshold8
        {
            get
            {
                return isTemp1Threshold8;
            }
            set
            {
                isTemp1Threshold8 = value;
                NotifyOfPropertyChange(nameof(IsTemp1Threshold8));
            }
        }
        #endregion
        #region Temp2
        private bool isTemp2P1;
        public bool IsTemp2P1
        {
            get
            {
                return isTemp2P1;
            }
            set
            {
                isTemp2P1 = value;
                NotifyOfPropertyChange(nameof(IsTemp2P1));
            }
        }

        private bool isTemp2I1;
        public bool IsTemp2I1
        {
            get
            {
                return isTemp2I1;
            }
            set
            {
                isTemp2I1 = value;
                NotifyOfPropertyChange(nameof(IsTemp2I1));
            }
        }

        private bool isTemp2D1;
        public bool IsTemp2D1
        {
            get
            {
                return isTemp2D1;
            }
            set
            {
                isTemp2D1 = value;
                NotifyOfPropertyChange(nameof(IsTemp2D1));
            }
        }

        private bool isTemp2Threshold1;
        public bool IsTemp2Threshold1
        {
            get
            {
                return isTemp2Threshold1;
            }
            set
            {
                isTemp2Threshold1 = value;
                NotifyOfPropertyChange(nameof(IsTemp2Threshold1));
            }
        }

        private bool isTemp2P2;
        public bool IsTemp2P2
        {
            get
            {
                return isTemp2P2;
            }
            set
            {
                isTemp2P2 = value;
                NotifyOfPropertyChange(nameof(IsTemp2P2));
            }
        }

        private bool isTemp2I2;
        public bool IsTemp2I2
        {
            get
            {
                return isTemp2I2;
            }
            set
            {
                isTemp2I2 = value;
                NotifyOfPropertyChange(nameof(IsTemp2I2));
            }
        }

        private bool isTemp2D2;
        public bool IsTemp2D2
        {
            get
            {
                return isTemp2D2;
            }
            set
            {
                isTemp2D2 = value;
                NotifyOfPropertyChange(nameof(IsTemp2D2));
            }
        }

        private bool isTemp2Threshold2;
        public bool IsTemp2Threshold2
        {
            get
            {
                return isTemp2Threshold2;
            }
            set
            {
                isTemp2Threshold2 = value;
                NotifyOfPropertyChange(nameof(IsTemp2Threshold2));
            }
        }
        private bool isTemp2P3;
        public bool IsTemp2P3
        {
            get
            {
                return isTemp2P3;
            }
            set
            {
                isTemp2P3 = value;
                NotifyOfPropertyChange(nameof(IsTemp2P3));
            }
        }

        private bool isTemp2I3;
        public bool IsTemp2I3
        {
            get
            {
                return isTemp2I3;
            }
            set
            {
                isTemp2I3 = value;
                NotifyOfPropertyChange(nameof(IsTemp2I3));
            }
        }

        private bool isTemp2D3;
        public bool IsTemp2D3
        {
            get
            {
                return isTemp2D3;
            }
            set
            {
                isTemp2D3 = value;
                NotifyOfPropertyChange(nameof(IsTemp2D3));
            }
        }

        private bool isTemp2Threshold3;
        public bool IsTemp2Threshold3
        {
            get
            {
                return isTemp2Threshold3;
            }
            set
            {
                isTemp2Threshold3 = value;
                NotifyOfPropertyChange(nameof(IsTemp2Threshold3));
            }
        }
        private bool isTemp2P4;
        public bool IsTemp2P4
        {
            get
            {
                return isTemp2P4;
            }
            set
            {
                isTemp2P4 = value;
                NotifyOfPropertyChange(nameof(IsTemp2P4));
            }
        }

        private bool isTemp2I4;
        public bool IsTemp2I4
        {
            get
            {
                return isTemp2I4;
            }
            set
            {
                isTemp2I4 = value;
                NotifyOfPropertyChange(nameof(IsTemp2I4));
            }
        }

        private bool isTemp2D4;
        public bool IsTemp2D4
        {
            get
            {
                return isTemp2D4;
            }
            set
            {
                isTemp2D4 = value;
                NotifyOfPropertyChange(nameof(IsTemp2D4));
            }
        }

        private bool isTemp2Threshold4;
        public bool IsTemp2Threshold4
        {
            get
            {
                return isTemp2Threshold4;
            }
            set
            {
                isTemp2Threshold4 = value;
                NotifyOfPropertyChange(nameof(IsTemp2Threshold4));
            }
        }
        private bool isTemp2P5;
        public bool IsTemp2P5
        {
            get
            {
                return isTemp2P5;
            }
            set
            {
                isTemp2P5 = value;
                NotifyOfPropertyChange(nameof(IsTemp2P5));
            }
        }

        private bool isTemp2I5;
        public bool IsTemp2I5
        {
            get
            {
                return isTemp2I5;
            }
            set
            {
                isTemp2I5 = value;
                NotifyOfPropertyChange(nameof(IsTemp2I5));
            }
        }

        private bool isTemp2D5;
        public bool IsTemp2D5
        {
            get
            {
                return isTemp2D5;
            }
            set
            {
                isTemp2D5 = value;
                NotifyOfPropertyChange(nameof(IsTemp2D5));
            }
        }

        private bool isTemp2Threshold5;
        public bool IsTemp2Threshold5
        {
            get
            {
                return isTemp2Threshold5;
            }
            set
            {
                isTemp2Threshold5 = value;
                NotifyOfPropertyChange(nameof(IsTemp2Threshold5));
            }
        }
        private bool isTemp2P6;
        public bool IsTemp2P6
        {
            get
            {
                return isTemp2P6;
            }
            set
            {
                isTemp2P6 = value;
                NotifyOfPropertyChange(nameof(IsTemp2P6));
            }
        }

        private bool isTemp2I6;
        public bool IsTemp2I6
        {
            get
            {
                return isTemp2I6;
            }
            set
            {
                isTemp2I6 = value;
                NotifyOfPropertyChange(nameof(IsTemp2I6));
            }
        }

        private bool isTemp2D6;
        public bool IsTemp2D6
        {
            get
            {
                return isTemp2D6;
            }
            set
            {
                isTemp2D6 = value;
                NotifyOfPropertyChange(nameof(IsTemp2D6));
            }
        }

        private bool isTemp2Threshold6;
        public bool IsTemp2Threshold6
        {
            get
            {
                return isTemp2Threshold6;
            }
            set
            {
                isTemp2Threshold6 = value;
                NotifyOfPropertyChange(nameof(IsTemp2Threshold6));
            }
        }
        private bool isTemp2P7;
        public bool IsTemp2P7
        {
            get
            {
                return isTemp2P7;
            }
            set
            {
                isTemp2P7 = value;
                NotifyOfPropertyChange(nameof(IsTemp2P7));
            }
        }

        private bool isTemp2I7;
        public bool IsTemp2I7
        {
            get
            {
                return isTemp2I7;
            }
            set
            {
                isTemp2I7 = value;
                NotifyOfPropertyChange(nameof(IsTemp2I7));
            }
        }

        private bool isTemp2D7;
        public bool IsTemp2D7
        {
            get
            {
                return isTemp2D7;
            }
            set
            {
                isTemp2D7 = value;
                NotifyOfPropertyChange(nameof(IsTemp2D7));
            }
        }

        private bool isTemp2Threshold7;
        public bool IsTemp2Threshold7
        {
            get
            {
                return isTemp2Threshold7;
            }
            set
            {
                isTemp2Threshold7 = value;
                NotifyOfPropertyChange(nameof(IsTemp2Threshold7));
            }
        }
        private bool isTemp2P8;
        public bool IsTemp2P8
        {
            get
            {
                return isTemp2P8;
            }
            set
            {
                isTemp2P8 = value;
                NotifyOfPropertyChange(nameof(IsTemp2P8));
            }
        }

        private bool isTemp2I8;
        public bool IsTemp2I8
        {
            get
            {
                return isTemp2I8;
            }
            set
            {
                isTemp2I8 = value;
                NotifyOfPropertyChange(nameof(IsTemp2I8));
            }
        }

        private bool isTemp2D8;
        public bool IsTemp2D8
        {
            get
            {
                return isTemp2D8;
            }
            set
            {
                isTemp2D8 = value;
                NotifyOfPropertyChange(nameof(IsTemp2D8));
            }
        }

        private bool isTemp2Threshold8;
        public bool IsTemp2Threshold8
        {
            get
            {
                return isTemp2Threshold8;
            }
            set
            {
                isTemp2Threshold8 = value;
                NotifyOfPropertyChange(nameof(IsTemp2Threshold8));
            }
        }
        #endregion
        #region Temp3
        private bool isTemp3P1;
        public bool IsTemp3P1
        {
            get
            {
                return isTemp3P1;
            }
            set
            {
                isTemp3P1 = value;
                NotifyOfPropertyChange(nameof(IsTemp3P1));
            }
        }

        private bool isTemp3I1;
        public bool IsTemp3I1
        {
            get
            {
                return isTemp3I1;
            }
            set
            {
                isTemp3I1 = value;
                NotifyOfPropertyChange(nameof(IsTemp3I1));
            }
        }

        private bool isTemp3D1;
        public bool IsTemp3D1
        {
            get
            {
                return isTemp3D1;
            }
            set
            {
                isTemp3D1 = value;
                NotifyOfPropertyChange(nameof(IsTemp3D1));
            }
        }

        private bool isTemp3Threshold1;
        public bool IsTemp3Threshold1
        {
            get
            {
                return isTemp3Threshold1;
            }
            set
            {
                isTemp3Threshold1 = value;
                NotifyOfPropertyChange(nameof(IsTemp3Threshold1));
            }
        }

        private bool isTemp3P2;
        public bool IsTemp3P2
        {
            get
            {
                return isTemp3P2;
            }
            set
            {
                isTemp3P2 = value;
                NotifyOfPropertyChange(nameof(IsTemp3P2));
            }
        }

        private bool isTemp3I2;
        public bool IsTemp3I2
        {
            get
            {
                return isTemp3I2;
            }
            set
            {
                isTemp3I2 = value;
                NotifyOfPropertyChange(nameof(IsTemp3I2));
            }
        }

        private bool isTemp3D2;
        public bool IsTemp3D2
        {
            get
            {
                return isTemp3D2;
            }
            set
            {
                isTemp3D2 = value;
                NotifyOfPropertyChange(nameof(IsTemp3D2));
            }
        }

        private bool isTemp3Threshold2;
        public bool IsTemp3Threshold2
        {
            get
            {
                return isTemp3Threshold2;
            }
            set
            {
                isTemp3Threshold2 = value;
                NotifyOfPropertyChange(nameof(IsTemp3Threshold2));
            }
        }
        private bool isTemp3P3;
        public bool IsTemp3P3
        {
            get
            {
                return isTemp3P3;
            }
            set
            {
                isTemp3P3 = value;
                NotifyOfPropertyChange(nameof(IsTemp3P3));
            }
        }

        private bool isTemp3I3;
        public bool IsTemp3I3
        {
            get
            {
                return isTemp3I3;
            }
            set
            {
                isTemp3I3 = value;
                NotifyOfPropertyChange(nameof(IsTemp3I3));
            }
        }

        private bool isTemp3D3;
        public bool IsTemp3D3
        {
            get
            {
                return isTemp3D3;
            }
            set
            {
                isTemp3D3 = value;
                NotifyOfPropertyChange(nameof(IsTemp3D3));
            }
        }

        private bool isTemp3Threshold3;
        public bool IsTemp3Threshold3
        {
            get
            {
                return isTemp3Threshold3;
            }
            set
            {
                isTemp3Threshold3 = value;
                NotifyOfPropertyChange(nameof(IsTemp3Threshold3));
            }
        }
        private bool isTemp3P4;
        public bool IsTemp3P4
        {
            get
            {
                return isTemp3P4;
            }
            set
            {
                isTemp3P4 = value;
                NotifyOfPropertyChange(nameof(IsTemp3P4));
            }
        }

        private bool isTemp3I4;
        public bool IsTemp3I4
        {
            get
            {
                return isTemp3I4;
            }
            set
            {
                isTemp3I4 = value;
                NotifyOfPropertyChange(nameof(IsTemp3I4));
            }
        }

        private bool isTemp3D4;
        public bool IsTemp3D4
        {
            get
            {
                return isTemp3D4;
            }
            set
            {
                isTemp3D4 = value;
                NotifyOfPropertyChange(nameof(IsTemp3D4));
            }
        }

        private bool isTemp3Threshold4;
        public bool IsTemp3Threshold4
        {
            get
            {
                return isTemp3Threshold4;
            }
            set
            {
                isTemp3Threshold4 = value;
                NotifyOfPropertyChange(nameof(IsTemp3Threshold4));
            }
        }
        private bool isTemp3P5;
        public bool IsTemp3P5
        {
            get
            {
                return isTemp3P5;
            }
            set
            {
                isTemp3P5 = value;
                NotifyOfPropertyChange(nameof(IsTemp3P5));
            }
        }

        private bool isTemp3I5;
        public bool IsTemp3I5
        {
            get
            {
                return isTemp3I5;
            }
            set
            {
                isTemp3I5 = value;
                NotifyOfPropertyChange(nameof(IsTemp3I5));
            }
        }

        private bool isTemp3D5;
        public bool IsTemp3D5
        {
            get
            {
                return isTemp3D5;
            }
            set
            {
                isTemp3D5 = value;
                NotifyOfPropertyChange(nameof(IsTemp3D5));
            }
        }

        private bool isTemp3Threshold5;
        public bool IsTemp3Threshold5
        {
            get
            {
                return isTemp3Threshold5;
            }
            set
            {
                isTemp3Threshold5 = value;
                NotifyOfPropertyChange(nameof(IsTemp3Threshold5));
            }
        }
        private bool isTemp3P6;
        public bool IsTemp3P6
        {
            get
            {
                return isTemp3P6;
            }
            set
            {
                isTemp3P6 = value;
                NotifyOfPropertyChange(nameof(IsTemp3P6));
            }
        }

        private bool isTemp3I6;
        public bool IsTemp3I6
        {
            get
            {
                return isTemp3I6;
            }
            set
            {
                isTemp3I6 = value;
                NotifyOfPropertyChange(nameof(IsTemp3I6));
            }
        }

        private bool isTemp3D6;
        public bool IsTemp3D6
        {
            get
            {
                return isTemp3D6;
            }
            set
            {
                isTemp3D6 = value;
                NotifyOfPropertyChange(nameof(IsTemp3D6));
            }
        }

        private bool isTemp3Threshold6;
        public bool IsTemp3Threshold6
        {
            get
            {
                return isTemp3Threshold6;
            }
            set
            {
                isTemp3Threshold6 = value;
                NotifyOfPropertyChange(nameof(IsTemp3Threshold6));
            }
        }
        private bool isTemp3P7;
        public bool IsTemp3P7
        {
            get
            {
                return isTemp3P7;
            }
            set
            {
                isTemp3P7 = value;
                NotifyOfPropertyChange(nameof(IsTemp3P7));
            }
        }

        private bool isTemp3I7;
        public bool IsTemp3I7
        {
            get
            {
                return isTemp3I7;
            }
            set
            {
                isTemp3I7 = value;
                NotifyOfPropertyChange(nameof(IsTemp3I7));
            }
        }

        private bool isTemp3D7;
        public bool IsTemp3D7
        {
            get
            {
                return isTemp3D7;
            }
            set
            {
                isTemp3D7 = value;
                NotifyOfPropertyChange(nameof(IsTemp3D7));
            }
        }

        private bool isTemp3Threshold7;
        public bool IsTemp3Threshold7
        {
            get
            {
                return isTemp3Threshold7;
            }
            set
            {
                isTemp3Threshold7 = value;
                NotifyOfPropertyChange(nameof(IsTemp3Threshold7));
            }
        }
        private bool isTemp3P8;
        public bool IsTemp3P8
        {
            get
            {
                return isTemp3P8;
            }
            set
            {
                isTemp3P8 = value;
                NotifyOfPropertyChange(nameof(IsTemp3P8));
            }
        }

        private bool isTemp3I8;
        public bool IsTemp3I8
        {
            get
            {
                return isTemp3I8;
            }
            set
            {
                isTemp3I8 = value;
                NotifyOfPropertyChange(nameof(IsTemp3I8));
            }
        }

        private bool isTemp3D8;
        public bool IsTemp3D8
        {
            get
            {
                return isTemp3D8;
            }
            set
            {
                isTemp3D8 = value;
                NotifyOfPropertyChange(nameof(IsTemp3D8));
            }
        }

        private bool isTemp3Threshold8;
        public bool IsTemp3Threshold8
        {
            get
            {
                return isTemp3Threshold8;
            }
            set
            {
                isTemp3Threshold8 = value;
                NotifyOfPropertyChange(nameof(IsTemp3Threshold8));
            }
        }
        #endregion
        #region Temp4
        private bool isTemp4P1;
        public bool IsTemp4P1
        {
            get
            {
                return isTemp4P1;
            }
            set
            {
                isTemp4P1 = value;
                NotifyOfPropertyChange(nameof(IsTemp4P1));
            }
        }

        private bool isTemp4I1;
        public bool IsTemp4I1
        {
            get
            {
                return isTemp4I1;
            }
            set
            {
                isTemp4I1 = value;
                NotifyOfPropertyChange(nameof(IsTemp4I1));
            }
        }

        private bool isTemp4D1;
        public bool IsTemp4D1
        {
            get
            {
                return isTemp4D1;
            }
            set
            {
                isTemp4D1 = value;
                NotifyOfPropertyChange(nameof(IsTemp4D1));
            }
        }

        private bool isTemp4Threshold1;
        public bool IsTemp4Threshold1
        {
            get
            {
                return isTemp4Threshold1;
            }
            set
            {
                isTemp4Threshold1 = value;
                NotifyOfPropertyChange(nameof(IsTemp4Threshold1));
            }
        }

        private bool isTemp4P2;
        public bool IsTemp4P2
        {
            get
            {
                return isTemp4P2;
            }
            set
            {
                isTemp4P2 = value;
                NotifyOfPropertyChange(nameof(IsTemp4P2));
            }
        }

        private bool isTemp4I2;
        public bool IsTemp4I2
        {
            get
            {
                return isTemp4I2;
            }
            set
            {
                isTemp4I2 = value;
                NotifyOfPropertyChange(nameof(IsTemp4I2));
            }
        }

        private bool isTemp4D2;
        public bool IsTemp4D2
        {
            get
            {
                return isTemp4D2;
            }
            set
            {
                isTemp4D2 = value;
                NotifyOfPropertyChange(nameof(IsTemp4D2));
            }
        }

        private bool isTemp4Threshold2;
        public bool IsTemp4Threshold2
        {
            get
            {
                return isTemp4Threshold2;
            }
            set
            {
                isTemp4Threshold2 = value;
                NotifyOfPropertyChange(nameof(IsTemp4Threshold2));
            }
        }
        private bool isTemp4P3;
        public bool IsTemp4P3
        {
            get
            {
                return isTemp4P3;
            }
            set
            {
                isTemp4P3 = value;
                NotifyOfPropertyChange(nameof(IsTemp4P3));
            }
        }

        private bool isTemp4I3;
        public bool IsTemp4I3
        {
            get
            {
                return isTemp4I3;
            }
            set
            {
                isTemp4I3 = value;
                NotifyOfPropertyChange(nameof(IsTemp4I3));
            }
        }

        private bool isTemp4D3;
        public bool IsTemp4D3
        {
            get
            {
                return isTemp4D3;
            }
            set
            {
                isTemp4D3 = value;
                NotifyOfPropertyChange(nameof(IsTemp4D3));
            }
        }

        private bool isTemp4Threshold3;
        public bool IsTemp4Threshold3
        {
            get
            {
                return isTemp4Threshold3;
            }
            set
            {
                isTemp4Threshold3 = value;
                NotifyOfPropertyChange(nameof(IsTemp4Threshold3));
            }
        }
        private bool isTemp4P4;
        public bool IsTemp4P4
        {
            get
            {
                return isTemp4P4;
            }
            set
            {
                isTemp4P4 = value;
                NotifyOfPropertyChange(nameof(IsTemp4P4));
            }
        }

        private bool isTemp4I4;
        public bool IsTemp4I4
        {
            get
            {
                return isTemp4I4;
            }
            set
            {
                isTemp4I4 = value;
                NotifyOfPropertyChange(nameof(IsTemp4I4));
            }
        }

        private bool isTemp4D4;
        public bool IsTemp4D4
        {
            get
            {
                return isTemp4D4;
            }
            set
            {
                isTemp4D4 = value;
                NotifyOfPropertyChange(nameof(IsTemp4D4));
            }
        }

        private bool isTemp4Threshold4;
        public bool IsTemp4Threshold4
        {
            get
            {
                return isTemp4Threshold4;
            }
            set
            {
                isTemp4Threshold4 = value;
                NotifyOfPropertyChange(nameof(IsTemp4Threshold4));
            }
        }
        private bool isTemp4P5;
        public bool IsTemp4P5
        {
            get
            {
                return isTemp4P5;
            }
            set
            {
                isTemp4P5 = value;
                NotifyOfPropertyChange(nameof(IsTemp4P5));
            }
        }

        private bool isTemp4I5;
        public bool IsTemp4I5
        {
            get
            {
                return isTemp4I5;
            }
            set
            {
                isTemp4I5 = value;
                NotifyOfPropertyChange(nameof(IsTemp4I5));
            }
        }

        private bool isTemp4D5;
        public bool IsTemp4D5
        {
            get
            {
                return isTemp4D5;
            }
            set
            {
                isTemp4D5 = value;
                NotifyOfPropertyChange(nameof(IsTemp4D5));
            }
        }

        private bool isTemp4Threshold5;
        public bool IsTemp4Threshold5
        {
            get
            {
                return isTemp4Threshold5;
            }
            set
            {
                isTemp4Threshold5 = value;
                NotifyOfPropertyChange(nameof(IsTemp4Threshold5));
            }
        }
        private bool isTemp4P6;
        public bool IsTemp4P6
        {
            get
            {
                return isTemp4P6;
            }
            set
            {
                isTemp4P6 = value;
                NotifyOfPropertyChange(nameof(IsTemp4P6));
            }
        }

        private bool isTemp4I6;
        public bool IsTemp4I6
        {
            get
            {
                return isTemp4I6;
            }
            set
            {
                isTemp4I6 = value;
                NotifyOfPropertyChange(nameof(IsTemp4I6));
            }
        }

        private bool isTemp4D6;
        public bool IsTemp4D6
        {
            get
            {
                return isTemp4D6;
            }
            set
            {
                isTemp4D6 = value;
                NotifyOfPropertyChange(nameof(IsTemp4D6));
            }
        }

        private bool isTemp4Threshold6;
        public bool IsTemp4Threshold6
        {
            get
            {
                return isTemp4Threshold6;
            }
            set
            {
                isTemp4Threshold6 = value;
                NotifyOfPropertyChange(nameof(IsTemp4Threshold6));
            }
        }
        private bool isTemp4P7;
        public bool IsTemp4P7
        {
            get
            {
                return isTemp4P7;
            }
            set
            {
                isTemp4P7 = value;
                NotifyOfPropertyChange(nameof(IsTemp4P7));
            }
        }

        private bool isTemp4I7;
        public bool IsTemp4I7
        {
            get
            {
                return isTemp4I7;
            }
            set
            {
                isTemp4I7 = value;
                NotifyOfPropertyChange(nameof(IsTemp4I7));
            }
        }

        private bool isTemp4D7;
        public bool IsTemp4D7
        {
            get
            {
                return isTemp4D7;
            }
            set
            {
                isTemp4D7 = value;
                NotifyOfPropertyChange(nameof(IsTemp4D7));
            }
        }

        private bool isTemp4Threshold7;
        public bool IsTemp4Threshold7
        {
            get
            {
                return isTemp4Threshold7;
            }
            set
            {
                isTemp4Threshold7 = value;
                NotifyOfPropertyChange(nameof(IsTemp4Threshold7));
            }
        }
        private bool isTemp4P8;
        public bool IsTemp4P8
        {
            get
            {
                return isTemp4P8;
            }
            set
            {
                isTemp4P8 = value;
                NotifyOfPropertyChange(nameof(IsTemp4P8));
            }
        }

        private bool isTemp4I8;
        public bool IsTemp4I8
        {
            get
            {
                return isTemp4I8;
            }
            set
            {
                isTemp4I8 = value;
                NotifyOfPropertyChange(nameof(IsTemp4I8));
            }
        }

        private bool isTemp4D8;
        public bool IsTemp4D8
        {
            get
            {
                return isTemp4D8;
            }
            set
            {
                isTemp4D8 = value;
                NotifyOfPropertyChange(nameof(IsTemp4D8));
            }
        }

        private bool isTemp4Threshold8;
        public bool IsTemp4Threshold8
        {
            get
            {
                return isTemp4Threshold8;
            }
            set
            {
                isTemp4Threshold8 = value;
                NotifyOfPropertyChange(nameof(IsTemp4Threshold8));
            }
        }
        #endregion
        #region Temp5
        private bool isTemp5P1;
        public bool IsTemp5P1
        {
            get
            {
                return isTemp5P1;
            }
            set
            {
                isTemp5P1 = value;
                NotifyOfPropertyChange(nameof(IsTemp5P1));
            }
        }

        private bool isTemp5I1;
        public bool IsTemp5I1
        {
            get
            {
                return isTemp5I1;
            }
            set
            {
                isTemp5I1 = value;
                NotifyOfPropertyChange(nameof(IsTemp5I1));
            }
        }

        private bool isTemp5D1;
        public bool IsTemp5D1
        {
            get
            {
                return isTemp5D1;
            }
            set
            {
                isTemp5D1 = value;
                NotifyOfPropertyChange(nameof(IsTemp5D1));
            }
        }

        private bool isTemp5Threshold1;
        public bool IsTemp5Threshold1
        {
            get
            {
                return isTemp5Threshold1;
            }
            set
            {
                isTemp5Threshold1 = value;
                NotifyOfPropertyChange(nameof(IsTemp5Threshold1));
            }
        }

        private bool isTemp5P2;
        public bool IsTemp5P2
        {
            get
            {
                return isTemp5P2;
            }
            set
            {
                isTemp5P2 = value;
                NotifyOfPropertyChange(nameof(IsTemp5P2));
            }
        }

        private bool isTemp5I2;
        public bool IsTemp5I2
        {
            get
            {
                return isTemp5I2;
            }
            set
            {
                isTemp5I2 = value;
                NotifyOfPropertyChange(nameof(IsTemp5I2));
            }
        }

        private bool isTemp5D2;
        public bool IsTemp5D2
        {
            get
            {
                return isTemp5D2;
            }
            set
            {
                isTemp5D2 = value;
                NotifyOfPropertyChange(nameof(IsTemp5D2));
            }
        }

        private bool isTemp5Threshold2;
        public bool IsTemp5Threshold2
        {
            get
            {
                return isTemp5Threshold2;
            }
            set
            {
                isTemp5Threshold2 = value;
                NotifyOfPropertyChange(nameof(IsTemp5Threshold2));
            }
        }
        private bool isTemp5P3;
        public bool IsTemp5P3
        {
            get
            {
                return isTemp5P3;
            }
            set
            {
                isTemp5P3 = value;
                NotifyOfPropertyChange(nameof(IsTemp5P3));
            }
        }

        private bool isTemp5I3;
        public bool IsTemp5I3
        {
            get
            {
                return isTemp5I3;
            }
            set
            {
                isTemp5I3 = value;
                NotifyOfPropertyChange(nameof(IsTemp5I3));
            }
        }

        private bool isTemp5D3;
        public bool IsTemp5D3
        {
            get
            {
                return isTemp5D3;
            }
            set
            {
                isTemp5D3 = value;
                NotifyOfPropertyChange(nameof(IsTemp5D3));
            }
        }

        private bool isTemp5Threshold3;
        public bool IsTemp5Threshold3
        {
            get
            {
                return isTemp5Threshold3;
            }
            set
            {
                isTemp5Threshold3 = value;
                NotifyOfPropertyChange(nameof(IsTemp5Threshold3));
            }
        }
        private bool isTemp5P4;
        public bool IsTemp5P4
        {
            get
            {
                return isTemp5P4;
            }
            set
            {
                isTemp5P4 = value;
                NotifyOfPropertyChange(nameof(IsTemp5P4));
            }
        }

        private bool isTemp5I4;
        public bool IsTemp5I4
        {
            get
            {
                return isTemp5I4;
            }
            set
            {
                isTemp5I4 = value;
                NotifyOfPropertyChange(nameof(IsTemp5I4));
            }
        }

        private bool isTemp5D4;
        public bool IsTemp5D4
        {
            get
            {
                return isTemp5D4;
            }
            set
            {
                isTemp5D4 = value;
                NotifyOfPropertyChange(nameof(IsTemp5D4));
            }
        }

        private bool isTemp5Threshold4;
        public bool IsTemp5Threshold4
        {
            get
            {
                return isTemp5Threshold4;
            }
            set
            {
                isTemp5Threshold4 = value;
                NotifyOfPropertyChange(nameof(IsTemp5Threshold4));
            }
        }
        private bool isTemp5P5;
        public bool IsTemp5P5
        {
            get
            {
                return isTemp5P5;
            }
            set
            {
                isTemp5P5 = value;
                NotifyOfPropertyChange(nameof(IsTemp5P5));
            }
        }

        private bool isTemp5I5;
        public bool IsTemp5I5
        {
            get
            {
                return isTemp5I5;
            }
            set
            {
                isTemp5I5 = value;
                NotifyOfPropertyChange(nameof(IsTemp5I5));
            }
        }

        private bool isTemp5D5;
        public bool IsTemp5D5
        {
            get
            {
                return isTemp5D5;
            }
            set
            {
                isTemp5D5 = value;
                NotifyOfPropertyChange(nameof(IsTemp5D5));
            }
        }

        private bool isTemp5Threshold5;
        public bool IsTemp5Threshold5
        {
            get
            {
                return isTemp5Threshold5;
            }
            set
            {
                isTemp5Threshold5 = value;
                NotifyOfPropertyChange(nameof(IsTemp5Threshold5));
            }
        }
        private bool isTemp5P6;
        public bool IsTemp5P6
        {
            get
            {
                return isTemp5P6;
            }
            set
            {
                isTemp5P6 = value;
                NotifyOfPropertyChange(nameof(IsTemp5P6));
            }
        }

        private bool isTemp5I6;
        public bool IsTemp5I6
        {
            get
            {
                return isTemp5I6;
            }
            set
            {
                isTemp5I6 = value;
                NotifyOfPropertyChange(nameof(IsTemp5I6));
            }
        }

        private bool isTemp5D6;
        public bool IsTemp5D6
        {
            get
            {
                return isTemp5D6;
            }
            set
            {
                isTemp5D6 = value;
                NotifyOfPropertyChange(nameof(IsTemp5D6));
            }
        }

        private bool isTemp5Threshold6;
        public bool IsTemp5Threshold6
        {
            get
            {
                return isTemp5Threshold6;
            }
            set
            {
                isTemp5Threshold6 = value;
                NotifyOfPropertyChange(nameof(IsTemp5Threshold6));
            }
        }
        private bool isTemp5P7;
        public bool IsTemp5P7
        {
            get
            {
                return isTemp5P7;
            }
            set
            {
                isTemp5P7 = value;
                NotifyOfPropertyChange(nameof(IsTemp5P7));
            }
        }

        private bool isTemp5I7;
        public bool IsTemp5I7
        {
            get
            {
                return isTemp5I7;
            }
            set
            {
                isTemp5I7 = value;
                NotifyOfPropertyChange(nameof(IsTemp5I7));
            }
        }

        private bool isTemp5D7;
        public bool IsTemp5D7
        {
            get
            {
                return isTemp5D7;
            }
            set
            {
                isTemp5D7 = value;
                NotifyOfPropertyChange(nameof(IsTemp5D7));
            }
        }

        private bool isTemp5Threshold7;
        public bool IsTemp5Threshold7
        {
            get
            {
                return isTemp5Threshold7;
            }
            set
            {
                isTemp5Threshold7 = value;
                NotifyOfPropertyChange(nameof(IsTemp5Threshold7));
            }
        }
        private bool isTemp5P8;
        public bool IsTemp5P8
        {
            get
            {
                return isTemp5P8;
            }
            set
            {
                isTemp5P8 = value;
                NotifyOfPropertyChange(nameof(IsTemp5P8));
            }
        }

        private bool isTemp5I8;
        public bool IsTemp5I8
        {
            get
            {
                return isTemp5I8;
            }
            set
            {
                isTemp5I8 = value;
                NotifyOfPropertyChange(nameof(IsTemp5I8));
            }
        }

        private bool isTemp5D8;
        public bool IsTemp5D8
        {
            get
            {
                return isTemp5D8;
            }
            set
            {
                isTemp5D8 = value;
                NotifyOfPropertyChange(nameof(IsTemp5D8));
            }
        }

        private bool isTemp5Threshold8;
        public bool IsTemp5Threshold8
        {
            get
            {
                return isTemp5Threshold8;
            }
            set
            {
                isTemp5Threshold8 = value;
                NotifyOfPropertyChange(nameof(IsTemp5Threshold8));
            }
        }
        #endregion

        #endregion
        public ObservableCollection<FileNode> SearchedRcpFiles { get; set; }

        private ObservableCollection<FileNode> files;
        public ObservableCollection<FileNode> Files
        {
            get
            {
                return files;
            }
            set
            {
                files = value;
                if (SearchedRcpFiles == null)
                {
                    SearchedRcpFiles = new ObservableCollection<FileNode>();
                }
                else
                {
                    SearchedRcpFiles.Clear();
                }
                for (int i = 0; i < files[0].Files.Count; i++)
                {
                    if (i == 0)
                    {
                        files[0].Files[i].IsSelected = true;
                    }
                    SearchedRcpFiles.Add(files[0].Files[i]);
                }
            }
        }
        private string keyWords;
        public string Keywords
        {
            get
            {
                return keyWords;
            }
            set
            {
                if (keyWords != value)
                {
                    SearchedRcpFiles.Clear();
                    var data = from f in Files[0].Files
                               where f.Name.Trim().ToLower().Contains(value.Trim().ToLower())
                               select f;
                    foreach (var f in data)
                    {
                        SearchedRcpFiles.Add(f);
                    }
                }
                keyWords = value;
            }
        }

        public RecipeData Recipe { get; private set; }

        public FileNode CurrentFileNode { get; private set; }

        public ObservableCollection<ColumnBase> Columns { get; set; }
        private bool IsError = false;
        public bool EnableNew { get; set; }
        private bool enableReName;
        public bool EnableReName
        {
            get
            {
                return enableReName && Recipe.IsIdle && IsPermission;
            }
            set
            {
                enableReName = value;
            }
        }
        private bool EnableCopy { get; set; }
        private bool enableDelete;
        public bool EnableDelete
        {
            get
            {
                return enableDelete && Recipe.IsIdle;
            }
            set
            {
                enableDelete = value;
            }
        }
        public bool EnableEdit { get; set; }
        public bool EnableSave { get; set; }
        public bool EnableStep { get; set; }
        public bool IsSavedDesc { get; set; }

        private List<string> workRecipe = new List<string>();

        private RecipeColumnBuilder columnBuilder = new RecipeColumnBuilder();

        private EditMode editMode;

        private RecipeProvider recipeProvider = new RecipeProvider();
    }
}
 

  • 5
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

@创可贴

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值