Exemplo n.º 1
0
        static double Brackets(string func)
        // Если есть скобки
        {
            int    open = 0, close = 0;
            string Temp, Temp2;
            double Temp3;

            do
            {
                open = func.LastIndexOf("(");
                for (int q = open; q < func.Length; q++)
                {
                    if (func[q] == ')')
                    {
                        close = q;
                        break;
                    }
                }
                Temp  = func.Substring(open, close - open + 1);
                Temp2 = Temp.Trim('(', ')');
                Temp3 = Calculate(StringToArr(Temp2));
                func  = func.Replace(Temp, Temp3.ToString());
            }while (func.Contains("("));
            return(Calculate(StringToArr(func)));
        }
        public string GetValue(string selectedSetting)
        {
            CookerSettings setting = (CookerSettings)Enum.Parse(typeof(CookerSettings), selectedSetting, true);

            switch (setting)
            {
            case CookerSettings.Temp1:
                return(Temp1.ToString());

            case CookerSettings.Temp2:
                return(Temp2.ToString());

            case CookerSettings.Temp3:
                return(Temp3.ToString());

            case CookerSettings.Temp4:
                return(Temp4.ToString());

            default:
                return("");
            }
        }