/// <summary>
        /// Runs the screen driver.
        /// </summary>
        public void Run()
        {
            try {
                // Check for missing files before running
                string[] missingFiles = CheckForMissingFiles();
                if (missingFiles.Length > 0)
                {
                    Log.LogMissingFiles(missingFiles);
                    MissingFilesMenu.MissingFiles = missingFiles;
                    CurrentScreen = MissingFilesMenu;
                }
                else
                {
                    CurrentScreen = MainMenu;
                }
                LastScreen = CurrentScreen;

                // Run the screen driver loop
                do
                {
                    ScreenAction nextAction = CurrentScreen.Run();
                    Screen       nextScreen = nextAction?.Invoke(this);
                    if (nextScreen != CurrentScreen)
                    {
                        LastScreen    = CurrentScreen;
                        CurrentScreen = nextScreen;
                    }
                } while (CurrentScreen != null);
            }
            catch (Exception ex) {
                Log.LogException(ex);
                // Oh no! Tell the user what went wrong so it can be reported!
                ExceptionMenu.Exception = ex;
                ExceptionMenu.Run();
            }
        }
Beispiel #2
0
 /// <summary>
 /// Constructs the <see cref="MissingFilesMenu"/>.
 /// </summary>
 public MissingFilesMenu(string filePath) : base(filePath)
 {
     Choices = new ScreenAction[] {
         ScreenAction.Exit,
     };
 }
 /// <summary>
 /// Constructs the <see cref="ExceptionMenu"/>.
 /// </summary>
 public ExceptionMenu(string filePath) : base(filePath)
 {
     Choices = new ScreenAction[] {
         ScreenAction.Exit,
     };
 }