Example #1
0
        /// <summary>
        /// ShortestPath
        ///
        /// Runs the shortest path algorithm
        /// </summary>
        public void ShortestPath()
        {
            Console.Write("Enter the the starting station: ");
#pragma warning disable CS0219 // Variable is assigned but its value is never used
            bool error = false;
#pragma warning restore CS0219 // Variable is assigned but its value is never used
            if (char.TryParse(Console.ReadLine(), out char fromStation))
            {
                Console.Write("Enter the endstation: ");

                if (char.TryParse(Console.ReadLine(), out char toStation))
                {
                    map.PrintSPT(fromStation, toStation);
                }
                else
                {
                    error = true;
                    Helper.MessageDisplay("Invalid input please enter a character\n", ConsoleColor.Red);
                }
            }
            else
            {
                error = true;
                Helper.MessageDisplay("Invalid input please enter a character", ConsoleColor.Red);
            }
        }