Example #1
0
        /// <summary>
        /// Método pre-creado de conversión de temperaturas. Kelvins a Celsius y a Fahrenheits.
        /// </summary>
        public static void TmpKel()
        {
            bool rep = true;

            while (rep)
            {
                Console.Write($"Introduzca una temperatura en {temps[2]} a convertir:\n>> ");//Entrada en Kelvins
                try
                {
                    double kel = double.Parse(Regex.Replace(Console.ReadLine(), "[.,]", CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator));
                    Console.WriteLine("\n{0} {1} a {2} es: {3}", frmcv, temps[2], temps[0], frms[1]);
                    Console.WriteLine("{0} {1} a {2} es: {3}", frmcv, temps[2], temps[1], frms[5]);
                    Op_Temp.OpKelFahrCels(kel);
                }
                catch (Exception e) when(e.GetType() != typeof(FormatException))
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine($"\n{e.Message}\n");
                    Console.ForegroundColor = ConsoleColor.Green;
                }
                catch (FormatException e)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(FrmExc);
                    Console.WriteLine($"\n{e.Message}\n");
                    Console.ForegroundColor = ConsoleColor.Green;
                }
                Console.Write(Rp);
                string go = Console.ReadLine();
                if (go.ToUpper() != "S")
                {
                    rep = true;
                }
            }
        }