Browse Source

Fixes #4425 - `ApplicationImpl` internal (#4426)

* Pulled from v2_release

* Refactor migration guide for Terminal.Gui v2

Restructured and expanded the migration guide to provide a comprehensive resource for transitioning from Terminal.Gui v1 to v2. Key updates include:

- Added a Table of Contents for easier navigation.
- Summarized major architectural changes in v2, including the instance-based application model, IRunnable architecture, and 24-bit TrueColor support.
- Updated examples to reflect new patterns, such as initializers replacing constructors and explicit disposal using `IDisposable`.
- Documented changes to the layout system, including the removal of `Absolute`/`Computed` styles and the introduction of `Viewport`.
- Standardized event patterns to use `object sender, EventArgs args`.
- Detailed updates to the Keyboard, Mouse, and Navigation APIs, including configurable key bindings and viewport-relative mouse coordinates.
- Replaced legacy components like `ScrollView` and `ContextMenu` with built-in scrolling and `PopoverMenu`.
- Clarified disposal rules and introduced best practices for resource management.
- Provided a complete migration example and a summary of breaking changes.

This update aims to simplify the migration process by addressing breaking changes, introducing new features, and aligning with modern .NET conventions.

* Refactor to use Application.Instance for lifecycle management

Replaced all occurrences of `ApplicationImpl.Instance` with the new `Application.Instance` property across the codebase to align with the updated application lifecycle model.

Encapsulated the `ApplicationImpl` class by making it `internal`, ensuring it is no longer directly accessible outside its assembly. Introduced the `[Obsolete]` `Application.Instance` property as a backward-compatible singleton for the legacy static `Application` model, while encouraging the use of `Application.Create()` for new code.

Updated `MessageBox` methods to use `Application.Instance` for consistent modal dialog management. Improved documentation to reflect these changes and emphasize the transition to the instance-based application model.

Performed code cleanup in multiple classes to ensure consistency and maintainability. These changes maintain backward compatibility while preparing the codebase for the eventual removal of the legacy `ApplicationImpl` class.

* Fix doc bug

* - Removed obsolete `.cd` class diagram files.
- Introduced `IRunnable` interface for decoupling component execution.
- Added fluent API for running dialogs and retrieving results.
- Enhanced `View` with `App` and `Driver` properties for better decoupling.
- Improved testability with support for mock and real applications.
- Implemented `IDisposable` for proper resource cleanup.
- Replaced `RunnableSessionStack` with `SessionStack` for session management.
- Updated driver architecture to align with the new model.
- Scoped `IKeyboard` to application contexts for modularity.
- Updated documentation with migration strategies and best practices.

These changes modernize the library, improve maintainability, and align with current development practices.
Tig 1 week ago
parent
commit
0f72cf8a74
34 changed files with 278 additions and 833 deletions
  1. 1 1
      Examples/UICatalog/Scenarios/ContextMenus.cs
  2. 13 13
      Examples/UICatalog/Scenarios/CsvEditor.cs
  3. 2 2
      Examples/UICatalog/Scenarios/DynamicStatusBar.cs
  4. 9 9
      Examples/UICatalog/Scenarios/Editor.cs
  5. 5 5
      Examples/UICatalog/Scenarios/FileDialogExamples.cs
  6. 1 1
      Examples/UICatalog/Scenarios/Generic.cs
  7. 4 4
      Examples/UICatalog/Scenarios/HexEditor.cs
  8. 3 3
      Examples/UICatalog/Scenarios/Images.cs
  9. 1 1
      Examples/UICatalog/Scenarios/InteractiveTree.cs
  10. 4 4
      Examples/UICatalog/Scenarios/KeyBindings.cs
  11. 1 1
      Examples/UICatalog/Scenarios/ListColumns.cs
  12. 2 2
      Examples/UICatalog/Scenarios/MessageBoxes.cs
  13. 1 1
      Examples/UICatalog/Scenarios/MultiColouredTable.cs
  14. 1 1
      Examples/UICatalog/Scenarios/Navigation.cs
  15. 2 2
      Examples/UICatalog/Scenarios/Notepad.cs
  16. 3 3
      Examples/UICatalog/Scenarios/RuneWidthGreaterThanOne.cs
  17. 1 1
      Examples/UICatalog/Scenarios/WindowsAndFrameViews.cs
  18. 3 3
      Examples/UICatalog/Scenarios/WizardAsView.cs
  19. 17 1
      Terminal.Gui/App/Application.Lifecycle.cs
  20. 0 117
      Terminal.Gui/App/Application.cd
  21. 1 1
      Terminal.Gui/App/ApplicationImpl.Driver.cs
  22. 1 1
      Terminal.Gui/App/ApplicationImpl.Lifecycle.cs
  23. 1 1
      Terminal.Gui/App/ApplicationImpl.Run.cs
  24. 1 1
      Terminal.Gui/App/ApplicationImpl.Screen.cs
  25. 2 2
      Terminal.Gui/App/ApplicationImpl.cs
  26. 0 79
      Terminal.Gui/Views/Autocomplete/Autocomplete.cd
  27. 0 124
      Terminal.Gui/Views/CollectionNavigation/CollectionNavigation.cd
  28. 0 168
      Terminal.Gui/Views/FileDialogs/FileDialog.cd
  29. 1 1
      Terminal.Gui/Views/MessageBox.cs
  30. 1 1
      Terminal.Gui/Views/Shortcut.cs
  31. 0 89
      Tests/TerminalGuiFluentTesting/ClassDiagram1.cd
  32. 192 185
      docfx/docs/application.md
  33. 3 4
      docfx/docs/drivers.md
  34. 1 1
      docfx/docs/keyboard.md

+ 1 - 1
Examples/UICatalog/Scenarios/ContextMenus.cs

@@ -49,7 +49,7 @@ public class ContextMenus : Scenario
             var text = "Context Menu";
             var text = "Context Menu";
             var width = 20;
             var width = 20;
 
 
-            CreateWinContextMenu (ApplicationImpl.Instance);
+            CreateWinContextMenu (Application.Instance);
 
 
             var label = new Label
             var label = new Label
             {
             {

+ 13 - 13
Examples/UICatalog/Scenarios/CsvEditor.cs

@@ -215,7 +215,7 @@ public class CsvEditor : Scenario
                                       _tableView.Table.Columns
                                       _tableView.Table.Columns
                                      );
                                      );
 
 
-            int? result = MessageBox.Query (ApplicationImpl.Instance,
+            int? result = MessageBox.Query (Application.Instance,
                                            "Column Type",
                                            "Column Type",
                                            "Pick a data type for the column",
                                            "Pick a data type for the column",
                                            "Date",
                                            "Date",
@@ -308,7 +308,7 @@ public class CsvEditor : Scenario
 
 
         if (_tableView.SelectedColumn == -1)
         if (_tableView.SelectedColumn == -1)
         {
         {
-            MessageBox.ErrorQuery (ApplicationImpl.Instance, "No Column", "No column selected", "Ok");
+            MessageBox.ErrorQuery (Application.Instance, "No Column", "No column selected", "Ok");
 
 
             return;
             return;
         }
         }
@@ -320,7 +320,7 @@ public class CsvEditor : Scenario
         }
         }
         catch (Exception ex)
         catch (Exception ex)
         {
         {
-            MessageBox.ErrorQuery (ApplicationImpl.Instance, "Could not remove column", ex.Message, "Ok");
+            MessageBox.ErrorQuery (Application.Instance, "Could not remove column", ex.Message, "Ok");
         }
         }
     }
     }
 
 
@@ -342,7 +342,7 @@ public class CsvEditor : Scenario
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {
-                MessageBox.ErrorQuery (ApplicationImpl.Instance, 60, 20, "Failed to set text", ex.Message, "Ok");
+                MessageBox.ErrorQuery (Application.Instance, 60, 20, "Failed to set text", ex.Message, "Ok");
             }
             }
 
 
             _tableView.Update ();
             _tableView.Update ();
@@ -388,7 +388,7 @@ public class CsvEditor : Scenario
 
 
         if (_tableView.SelectedColumn == -1)
         if (_tableView.SelectedColumn == -1)
         {
         {
-            MessageBox.ErrorQuery (ApplicationImpl.Instance, "No Column", "No column selected", "Ok");
+            MessageBox.ErrorQuery (Application.Instance, "No Column", "No column selected", "Ok");
 
 
             return;
             return;
         }
         }
@@ -413,7 +413,7 @@ public class CsvEditor : Scenario
         }
         }
         catch (Exception ex)
         catch (Exception ex)
         {
         {
-            MessageBox.ErrorQuery (ApplicationImpl.Instance, "Error moving column", ex.Message, "Ok");
+            MessageBox.ErrorQuery (Application.Instance, "Error moving column", ex.Message, "Ok");
         }
         }
     }
     }
 
 
@@ -426,7 +426,7 @@ public class CsvEditor : Scenario
 
 
         if (_tableView.SelectedRow == -1)
         if (_tableView.SelectedRow == -1)
         {
         {
-            MessageBox.ErrorQuery (ApplicationImpl.Instance, "No Rows", "No row selected", "Ok");
+            MessageBox.ErrorQuery (Application.Instance, "No Rows", "No row selected", "Ok");
 
 
             return;
             return;
         }
         }
@@ -462,7 +462,7 @@ public class CsvEditor : Scenario
         }
         }
         catch (Exception ex)
         catch (Exception ex)
         {
         {
-            MessageBox.ErrorQuery (ApplicationImpl.Instance, "Error moving column", ex.Message, "Ok");
+            MessageBox.ErrorQuery (Application.Instance, "Error moving column", ex.Message, "Ok");
         }
         }
     }
     }
 
 
@@ -470,7 +470,7 @@ public class CsvEditor : Scenario
     {
     {
         if (_tableView?.Table is null)
         if (_tableView?.Table is null)
         {
         {
-            MessageBox.ErrorQuery (ApplicationImpl.Instance, "No Table Loaded", "No table has currently be opened", "Ok");
+            MessageBox.ErrorQuery (Application.Instance, "No Table Loaded", "No table has currently be opened", "Ok");
 
 
             return true;
             return true;
         }
         }
@@ -582,7 +582,7 @@ public class CsvEditor : Scenario
         }
         }
         catch (Exception ex)
         catch (Exception ex)
         {
         {
-            MessageBox.ErrorQuery (ApplicationImpl.Instance,
+            MessageBox.ErrorQuery (Application.Instance,
                                    "Open Failed",
                                    "Open Failed",
                                    $"Error on line {lineNumber}{Environment.NewLine}{ex.Message}",
                                    $"Error on line {lineNumber}{Environment.NewLine}{ex.Message}",
                                    "Ok"
                                    "Ok"
@@ -612,7 +612,7 @@ public class CsvEditor : Scenario
     {
     {
         if (_tableView?.Table is null || string.IsNullOrWhiteSpace (_currentFile) || _currentTable is null)
         if (_tableView?.Table is null || string.IsNullOrWhiteSpace (_currentFile) || _currentTable is null)
         {
         {
-            MessageBox.ErrorQuery (ApplicationImpl.Instance, "No file loaded", "No file is currently loaded", "Ok");
+            MessageBox.ErrorQuery (Application.Instance, "No file loaded", "No file is currently loaded", "Ok");
 
 
             return;
             return;
         }
         }
@@ -674,7 +674,7 @@ public class CsvEditor : Scenario
 
 
         if (col.DataType == typeof (string))
         if (col.DataType == typeof (string))
         {
         {
-            MessageBox.ErrorQuery (ApplicationImpl.Instance,
+            MessageBox.ErrorQuery (Application.Instance,
                                    "Cannot Format Column",
                                    "Cannot Format Column",
                                    "String columns cannot be Formatted, try adding a new column to the table with a date/numerical Type",
                                    "String columns cannot be Formatted, try adding a new column to the table with a date/numerical Type",
                                    "Ok"
                                    "Ok"
@@ -711,7 +711,7 @@ public class CsvEditor : Scenario
 
 
         if (_tableView.SelectedColumn == -1)
         if (_tableView.SelectedColumn == -1)
         {
         {
-            MessageBox.ErrorQuery (ApplicationImpl.Instance, "No Column", "No column selected", "Ok");
+            MessageBox.ErrorQuery (Application.Instance, "No Column", "No column selected", "Ok");
 
 
             return;
             return;
         }
         }

+ 2 - 2
Examples/UICatalog/Scenarios/DynamicStatusBar.cs

@@ -79,7 +79,7 @@ public class DynamicStatusBar : Scenario
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {
-                MessageBox.ErrorQuery (ApplicationImpl.Instance, "Binding Error", $"Binding failed: {ex}.", "Ok");
+                MessageBox.ErrorQuery (Application.Instance, "Binding Error", $"Binding failed: {ex}.", "Ok");
             }
             }
         }
         }
     }
     }
@@ -140,7 +140,7 @@ public class DynamicStatusBar : Scenario
         public TextView TextAction { get; }
         public TextView TextAction { get; }
         public TextField TextShortcut { get; }
         public TextField TextShortcut { get; }
         public TextField TextTitle { get; }
         public TextField TextTitle { get; }
-        public Action CreateAction (DynamicStatusItem item) { return () => MessageBox.ErrorQuery (ApplicationImpl.Instance, item.Title, item.Action, "Ok"); }
+        public Action CreateAction (DynamicStatusItem item) { return () => MessageBox.ErrorQuery (Application.Instance, item.Title, item.Action, "Ok"); }
 
 
         public void EditStatusItem (Shortcut statusItem)
         public void EditStatusItem (Shortcut statusItem)
         {
         {

+ 9 - 9
Examples/UICatalog/Scenarios/Editor.cs

@@ -201,7 +201,7 @@ public class Editor : Scenario
         Debug.Assert (_textView.IsDirty);
         Debug.Assert (_textView.IsDirty);
 
 
         int? r = MessageBox.ErrorQuery (
         int? r = MessageBox.ErrorQuery (
-                                       ApplicationImpl.Instance,
+                                       Application.Instance,
                                        "Save File",
                                        "Save File",
                                        $"Do you want save changes in {_appWindow.Title}?",
                                        $"Do you want save changes in {_appWindow.Title}?",
                                        "Yes",
                                        "Yes",
@@ -236,7 +236,7 @@ public class Editor : Scenario
         }
         }
         catch (Exception ex)
         catch (Exception ex)
         {
         {
-            MessageBox.ErrorQuery (ApplicationImpl.Instance, "Error", ex.Message, "Ok");
+            MessageBox.ErrorQuery (Application.Instance, "Error", ex.Message, "Ok");
         }
         }
     }
     }
 
 
@@ -315,11 +315,11 @@ public class Editor : Scenario
 
 
         if (!found)
         if (!found)
         {
         {
-            MessageBox.Query (ApplicationImpl.Instance, "Find", $"The following specified text was not found: '{_textToFind}'", "Ok");
+            MessageBox.Query (Application.Instance, "Find", $"The following specified text was not found: '{_textToFind}'", "Ok");
         }
         }
         else if (gaveFullTurn)
         else if (gaveFullTurn)
         {
         {
-            MessageBox.Query (ApplicationImpl.Instance,
+            MessageBox.Query (Application.Instance,
                               "Find",
                               "Find",
                               $"No more occurrences were found for the following specified text: '{_textToFind}'",
                               $"No more occurrences were found for the following specified text: '{_textToFind}'",
                               "Ok"
                               "Ok"
@@ -895,7 +895,7 @@ public class Editor : Scenario
 
 
         if (_textView.ReplaceAllText (_textToFind, _matchCase, _matchWholeWord, _textToReplace))
         if (_textView.ReplaceAllText (_textToFind, _matchCase, _matchWholeWord, _textToReplace))
         {
         {
-            MessageBox.Query (ApplicationImpl.Instance,
+            MessageBox.Query (Application.Instance,
                               "Replace All",
                               "Replace All",
                               $"All occurrences were replaced for the following specified text: '{_textToReplace}'",
                               $"All occurrences were replaced for the following specified text: '{_textToReplace}'",
                               "Ok"
                               "Ok"
@@ -903,7 +903,7 @@ public class Editor : Scenario
         }
         }
         else
         else
         {
         {
-            MessageBox.Query (ApplicationImpl.Instance,
+            MessageBox.Query (Application.Instance,
                               "Replace All",
                               "Replace All",
                               $"None of the following specified text was found: '{_textToFind}'",
                               $"None of the following specified text was found: '{_textToFind}'",
                               "Ok"
                               "Ok"
@@ -1155,7 +1155,7 @@ public class Editor : Scenario
         {
         {
             if (File.Exists (path))
             if (File.Exists (path))
             {
             {
-                if (MessageBox.Query (ApplicationImpl.Instance,
+                if (MessageBox.Query (Application.Instance,
                                       "Save File",
                                       "Save File",
                                       "File already exists. Overwrite any way?",
                                       "File already exists. Overwrite any way?",
                                       "No",
                                       "No",
@@ -1194,11 +1194,11 @@ public class Editor : Scenario
             _originalText = Encoding.Unicode.GetBytes (_textView.Text);
             _originalText = Encoding.Unicode.GetBytes (_textView.Text);
             _saved = true;
             _saved = true;
             _textView.ClearHistoryChanges ();
             _textView.ClearHistoryChanges ();
-            MessageBox.Query (ApplicationImpl.Instance, "Save File", "File was successfully saved.", "Ok");
+            MessageBox.Query (Application.Instance, "Save File", "File was successfully saved.", "Ok");
         }
         }
         catch (Exception ex)
         catch (Exception ex)
         {
         {
-            MessageBox.ErrorQuery (ApplicationImpl.Instance, "Error", ex.Message, "Ok");
+            MessageBox.ErrorQuery (Application.Instance, "Error", ex.Message, "Ok");
 
 
             return false;
             return false;
         }
         }

+ 5 - 5
Examples/UICatalog/Scenarios/FileDialogExamples.cs

@@ -133,7 +133,7 @@ public class FileDialogExamples : Scenario
                              }
                              }
                              catch (Exception ex)
                              catch (Exception ex)
                              {
                              {
-                                 MessageBox.ErrorQuery (ApplicationImpl.Instance, "Error", ex.ToString (), "_Ok");
+                                 MessageBox.ErrorQuery (Application.Instance, "Error", ex.ToString (), "_Ok");
                              }
                              }
                              finally
                              finally
                              {
                              {
@@ -153,7 +153,7 @@ public class FileDialogExamples : Scenario
         {
         {
             if (File.Exists (e.Dialog.Path))
             if (File.Exists (e.Dialog.Path))
             {
             {
-                int? result = MessageBox.Query (ApplicationImpl.Instance, "Overwrite?", "File already exists", "_Yes", "_No");
+                int? result = MessageBox.Query (Application.Instance, "Overwrite?", "File already exists", "_Yes", "_No");
                 e.Cancel = result == 1;
                 e.Cancel = result == 1;
             }
             }
         }
         }
@@ -248,7 +248,7 @@ public class FileDialogExamples : Scenario
 
 
             if (canceled)
             if (canceled)
             {
             {
-                MessageBox.Query (ApplicationImpl.Instance,
+                MessageBox.Query (Application.Instance,
                                   "Canceled",
                                   "Canceled",
                                   "You canceled navigation and did not pick anything",
                                   "You canceled navigation and did not pick anything",
                                   "Ok"
                                   "Ok"
@@ -256,7 +256,7 @@ public class FileDialogExamples : Scenario
             }
             }
             else if (_cbAllowMultipleSelection.CheckedState == CheckState.Checked)
             else if (_cbAllowMultipleSelection.CheckedState == CheckState.Checked)
             {
             {
-                MessageBox.Query (ApplicationImpl.Instance,
+                MessageBox.Query (Application.Instance,
                                   "Chosen!",
                                   "Chosen!",
                                   "You chose:" + Environment.NewLine + string.Join (Environment.NewLine, multiSelected.Select (m => m)),
                                   "You chose:" + Environment.NewLine + string.Join (Environment.NewLine, multiSelected.Select (m => m)),
                                   "Ok"
                                   "Ok"
@@ -264,7 +264,7 @@ public class FileDialogExamples : Scenario
             }
             }
             else
             else
             {
             {
-                MessageBox.Query (ApplicationImpl.Instance,
+                MessageBox.Query (Application.Instance,
                                   "Chosen!",
                                   "Chosen!",
                                   "You chose:" + Environment.NewLine + path,
                                   "You chose:" + Environment.NewLine + path,
                                   "Ok"
                                   "Ok"

+ 1 - 1
Examples/UICatalog/Scenarios/Generic.cs

@@ -29,7 +29,7 @@ public sealed class Generic : Scenario
                             {
                             {
                                 // When Accepting is handled, set e.Handled to true to prevent further processing.
                                 // When Accepting is handled, set e.Handled to true to prevent further processing.
                                 e.Handled = true;
                                 e.Handled = true;
-                                MessageBox.ErrorQuery (ApplicationImpl.Instance, "Error", "You pressed the button!", "_Ok");
+                                MessageBox.ErrorQuery (Application.Instance, "Error", "You pressed the button!", "_Ok");
                             };
                             };
 
 
         appWindow.Add (button);
         appWindow.Add (button);

+ 4 - 4
Examples/UICatalog/Scenarios/HexEditor.cs

@@ -181,7 +181,7 @@ public class HexEditor : Scenario
         }
         }
     }
     }
 
 
-    private void Copy () { MessageBox.ErrorQuery (ApplicationImpl.Instance, "Not Implemented", "Functionality not yet implemented.", "Ok"); }
+    private void Copy () { MessageBox.ErrorQuery (Application.Instance, "Not Implemented", "Functionality not yet implemented.", "Ok"); }
 
 
     private void CreateDemoFile (string fileName)
     private void CreateDemoFile (string fileName)
     {
     {
@@ -208,7 +208,7 @@ public class HexEditor : Scenario
         ms.Close ();
         ms.Close ();
     }
     }
 
 
-    private void Cut () { MessageBox.ErrorQuery (ApplicationImpl.Instance, "Not Implemented", "Functionality not yet implemented.", "Ok"); }
+    private void Cut () { MessageBox.ErrorQuery (Application.Instance, "Not Implemented", "Functionality not yet implemented.", "Ok"); }
 
 
     private Stream LoadFile ()
     private Stream LoadFile ()
     {
     {
@@ -216,7 +216,7 @@ public class HexEditor : Scenario
 
 
         if (!_saved && _hexView!.Edits.Count > 0 && _hexView.Source is {})
         if (!_saved && _hexView!.Edits.Count > 0 && _hexView.Source is {})
         {
         {
-            if (MessageBox.ErrorQuery (ApplicationImpl.Instance,
+            if (MessageBox.ErrorQuery (Application.Instance,
                                        "Save",
                                        "Save",
                                        "The changes were not saved. Want to open without saving?",
                                        "The changes were not saved. Want to open without saving?",
                                        "_Yes",
                                        "_Yes",
@@ -267,7 +267,7 @@ public class HexEditor : Scenario
         d.Dispose ();
         d.Dispose ();
     }
     }
 
 
-    private void Paste () { MessageBox.ErrorQuery (ApplicationImpl.Instance, "Not Implemented", "Functionality not yet implemented.", "_Ok"); }
+    private void Paste () { MessageBox.ErrorQuery (Application.Instance, "Not Implemented", "Functionality not yet implemented.", "_Ok"); }
     private void Quit () { Application.RequestStop (); }
     private void Quit () { Application.RequestStop (); }
 
 
     private void Save ()
     private void Save ()

+ 3 - 3
Examples/UICatalog/Scenarios/Images.cs

@@ -183,7 +183,7 @@ public class Images : Scenario
 
 
         if (!_sixelSupportResult.SupportsTransparency)
         if (!_sixelSupportResult.SupportsTransparency)
         {
         {
-            if (MessageBox.Query (ApplicationImpl.Instance,
+            if (MessageBox.Query (Application.Instance,
                                   "Transparency Not Supported",
                                   "Transparency Not Supported",
                                   "It looks like your terminal does not support transparent sixel backgrounds. Do you want to try anyway?",
                                   "It looks like your terminal does not support transparent sixel backgrounds. Do you want to try anyway?",
                                   "Yes",
                                   "Yes",
@@ -288,7 +288,7 @@ public class Images : Scenario
         }
         }
         catch (Exception ex)
         catch (Exception ex)
         {
         {
-            MessageBox.ErrorQuery (ApplicationImpl.Instance, "Could not open file", ex.Message, "Ok");
+            MessageBox.ErrorQuery (Application.Instance, "Could not open file", ex.Message, "Ok");
 
 
             return;
             return;
         }
         }
@@ -492,7 +492,7 @@ public class Images : Scenario
     {
     {
         if (_imageView.FullResImage == null)
         if (_imageView.FullResImage == null)
         {
         {
-            MessageBox.Query (ApplicationImpl.Instance, "No Image Loaded", "You must first open an image.  Use the 'Open Image' button above.", "Ok");
+            MessageBox.Query (Application.Instance, "No Image Loaded", "You must first open an image.  Use the 'Open Image' button above.", "Ok");
 
 
             return;
             return;
         }
         }

+ 1 - 1
Examples/UICatalog/Scenarios/InteractiveTree.cs

@@ -173,7 +173,7 @@ public class InteractiveTree : Scenario
 
 
                 if (parent is null)
                 if (parent is null)
                 {
                 {
-                    MessageBox.ErrorQuery (ApplicationImpl.Instance,
+                    MessageBox.ErrorQuery (Application.Instance,
                                            "Could not delete",
                                            "Could not delete",
                                            $"Parent of '{toDelete}' was unexpectedly null",
                                            $"Parent of '{toDelete}' was unexpectedly null",
                                            "Ok"
                                            "Ok"

+ 4 - 4
Examples/UICatalog/Scenarios/KeyBindings.cs

@@ -164,17 +164,17 @@ public class KeyBindingsDemo : View
 
 
         AddCommand (Command.Save, ctx =>
         AddCommand (Command.Save, ctx =>
                                  {
                                  {
-                                     MessageBox.Query (ApplicationImpl.Instance, $"{ctx.Command}", $"Ctx: {ctx}", buttons: "Ok");
+                                     MessageBox.Query (Application.Instance, $"{ctx.Command}", $"Ctx: {ctx}", buttons: "Ok");
                                      return true;
                                      return true;
                                  });
                                  });
         AddCommand (Command.New, ctx =>
         AddCommand (Command.New, ctx =>
                                 {
                                 {
-                                    MessageBox.Query (ApplicationImpl.Instance, $"{ctx.Command}", $"Ctx: {ctx}", buttons: "Ok");
+                                    MessageBox.Query (Application.Instance, $"{ctx.Command}", $"Ctx: {ctx}", buttons: "Ok");
                                     return true;
                                     return true;
                                 });
                                 });
         AddCommand (Command.HotKey, ctx =>
         AddCommand (Command.HotKey, ctx =>
         {
         {
-            MessageBox.Query (ApplicationImpl.Instance, $"{ctx.Command}", $"Ctx: {ctx}\nCommand: {ctx.Command}", buttons: "Ok");
+            MessageBox.Query (Application.Instance, $"{ctx.Command}", $"Ctx: {ctx}\nCommand: {ctx.Command}", buttons: "Ok");
             SetFocus ();
             SetFocus ();
             return true;
             return true;
         });
         });
@@ -189,7 +189,7 @@ public class KeyBindingsDemo : View
                                              {
                                              {
                                                  return false;
                                                  return false;
                                              }
                                              }
-                                             MessageBox.Query (ApplicationImpl.Instance, $"{keyCommandContext.Binding}", $"Key: {keyCommandContext.Binding.Key}\nCommand: {ctx.Command}", buttons: "Ok");
+                                             MessageBox.Query (Application.Instance, $"{keyCommandContext.Binding}", $"Key: {keyCommandContext.Binding.Key}\nCommand: {ctx.Command}", buttons: "Ok");
                                              Application.RequestStop ();
                                              Application.RequestStop ();
                                              return true;
                                              return true;
                                          });
                                          });

+ 1 - 1
Examples/UICatalog/Scenarios/ListColumns.cs

@@ -336,7 +336,7 @@ public class ListColumns : Scenario
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {
-                MessageBox.ErrorQuery (ApplicationImpl.Instance, 60, 20, "Failed to set", ex.Message, "Ok");
+                MessageBox.ErrorQuery (Application.Instance, 60, 20, "Failed to set", ex.Message, "Ok");
             }
             }
         }
         }
     }
     }

+ 2 - 2
Examples/UICatalog/Scenarios/MessageBoxes.cs

@@ -251,7 +251,7 @@ public class MessageBoxes : Scenario
                                                {
                                                {
                                                    buttonPressedLabel.Text =
                                                    buttonPressedLabel.Text =
                                                        $"{MessageBox.Query (
                                                        $"{MessageBox.Query (
-                                                                            ApplicationImpl.Instance, width,
+                                                                            Application.Instance, width,
                                                                              height,
                                                                              height,
                                                                              titleEdit.Text,
                                                                              titleEdit.Text,
                                                                              messageEdit.Text,
                                                                              messageEdit.Text,
@@ -263,7 +263,7 @@ public class MessageBoxes : Scenario
                                                else
                                                else
                                                {
                                                {
                                                    buttonPressedLabel.Text =
                                                    buttonPressedLabel.Text =
-                                                       $"{MessageBox.ErrorQuery (ApplicationImpl.Instance,
+                                                       $"{MessageBox.ErrorQuery (Application.Instance,
                                                                                  width,
                                                                                  width,
                                                                                  height,
                                                                                  height,
                                                                                  titleEdit.Text,
                                                                                  titleEdit.Text,

+ 1 - 1
Examples/UICatalog/Scenarios/MultiColouredTable.cs

@@ -99,7 +99,7 @@ public class MultiColouredTable : Scenario
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {
-                MessageBox.ErrorQuery (ApplicationImpl.Instance, 60, 20, "Failed to set text", ex.Message, "Ok");
+                MessageBox.ErrorQuery (Application.Instance, 60, 20, "Failed to set text", ex.Message, "Ok");
             }
             }
 
 
             _tableView.Update ();
             _tableView.Update ();

+ 1 - 1
Examples/UICatalog/Scenarios/Navigation.cs

@@ -59,7 +59,7 @@ public class Navigation : Scenario
             Y = 0,
             Y = 0,
             Title = $"TopButton _{GetNextHotKey ()}"
             Title = $"TopButton _{GetNextHotKey ()}"
         };
         };
-        button.Accepting += (sender, args) => MessageBox.Query (ApplicationImpl.Instance, "hi", button.Title, "_Ok");
+        button.Accepting += (sender, args) => MessageBox.Query (Application.Instance, "hi", button.Title, "_Ok");
 
 
         testFrame.Add (button);
         testFrame.Add (button);
 
 

+ 2 - 2
Examples/UICatalog/Scenarios/Notepad.cs

@@ -71,7 +71,7 @@ public class Notepad : Scenario
                                        new MenuItem
                                        new MenuItem
                                        {
                                        {
                                            Title = "_About",
                                            Title = "_About",
-                                           Action = () => MessageBox.Query (ApplicationImpl.Instance,  "Notepad", "About Notepad...", "Ok")
+                                           Action = () => MessageBox.Query (Application.Instance,  "Notepad", "About Notepad...", "Ok")
                                        }
                                        }
                                    ]
                                    ]
                                   )
                                   )
@@ -196,7 +196,7 @@ public class Notepad : Scenario
 
 
         if (tab.UnsavedChanges)
         if (tab.UnsavedChanges)
         {
         {
-            int? result = MessageBox.Query (ApplicationImpl.Instance,
+            int? result = MessageBox.Query (Application.Instance,
                                             "Save Changes",
                                             "Save Changes",
                                             $"Save changes to {tab.Text.TrimEnd ('*')}",
                                             $"Save changes to {tab.Text.TrimEnd ('*')}",
                                             "Yes",
                                             "Yes",

+ 3 - 3
Examples/UICatalog/Scenarios/RuneWidthGreaterThanOne.cs

@@ -166,7 +166,7 @@ public class RuneWidthGreaterThanOne : Scenario
     {
     {
         if (_text is { })
         if (_text is { })
         {
         {
-            MessageBox.Query (ApplicationImpl.Instance, "Say Hello 你", $"Hello {_text.Text}", "Ok");
+            MessageBox.Query (Application.Instance, "Say Hello 你", $"Hello {_text.Text}", "Ok");
         }
         }
     }
     }
 
 
@@ -197,7 +197,7 @@ public class RuneWidthGreaterThanOne : Scenario
     {
     {
         if (_text is { })
         if (_text is { })
         {
         {
-            MessageBox.Query (ApplicationImpl.Instance, "Say Hello", $"Hello {_text.Text}", "Ok");
+            MessageBox.Query (Application.Instance, "Say Hello", $"Hello {_text.Text}", "Ok");
         }
         }
     }
     }
 
 
@@ -252,7 +252,7 @@ public class RuneWidthGreaterThanOne : Scenario
     {
     {
         if (_text is { })
         if (_text is { })
         {
         {
-            MessageBox.Query (ApplicationImpl.Instance, "こんにちはと言う", $"こんにちは {_text.Text}", "Ok");
+            MessageBox.Query (Application.Instance, "こんにちはと言う", $"こんにちは {_text.Text}", "Ok");
         }
         }
     }
     }
 
 

+ 1 - 1
Examples/UICatalog/Scenarios/WindowsAndFrameViews.cs

@@ -18,7 +18,7 @@ public class WindowsAndFrameViews : Scenario
 
 
         static int? About ()
         static int? About ()
         {
         {
-            return MessageBox.Query (ApplicationImpl.Instance,
+            return MessageBox.Query (Application.Instance,
                                      "About UI Catalog",
                                      "About UI Catalog",
                                      "UI Catalog is a comprehensive sample library for Terminal.Gui",
                                      "UI Catalog is a comprehensive sample library for Terminal.Gui",
                                      "Ok"
                                      "Ok"

+ 3 - 3
Examples/UICatalog/Scenarios/WizardAsView.cs

@@ -21,7 +21,7 @@ public class WizardAsView : Scenario
                                        {
                                        {
                                            Title = "_Restart Configuration...",
                                            Title = "_Restart Configuration...",
                                            Action = () => MessageBox.Query (
                                            Action = () => MessageBox.Query (
-                                                                            ApplicationImpl.Instance,
+                                                                            Application.Instance,
                                                                             "Wizard",
                                                                             "Wizard",
                                                                             "Are you sure you want to reset the Wizard and start over?",
                                                                             "Are you sure you want to reset the Wizard and start over?",
                                                                             "Ok",
                                                                             "Ok",
@@ -32,7 +32,7 @@ public class WizardAsView : Scenario
                                        {
                                        {
                                            Title = "Re_boot Server...",
                                            Title = "Re_boot Server...",
                                            Action = () => MessageBox.Query (
                                            Action = () => MessageBox.Query (
-                                                                            ApplicationImpl.Instance,
+                                                                            Application.Instance,
                                                                             "Wizard",
                                                                             "Wizard",
                                                                             "Are you sure you want to reboot the server start over?",
                                                                             "Are you sure you want to reboot the server start over?",
                                                                             "Ok",
                                                                             "Ok",
@@ -43,7 +43,7 @@ public class WizardAsView : Scenario
                                        {
                                        {
                                            Title = "_Shutdown Server...",
                                            Title = "_Shutdown Server...",
                                            Action = () => MessageBox.Query (
                                            Action = () => MessageBox.Query (
-                                                                            ApplicationImpl.Instance,
+                                                                            Application.Instance,
                                                                             "Wizard",
                                                                             "Wizard",
                                                                             "Are you sure you want to cancel setup and shutdown?",
                                                                             "Are you sure you want to cancel setup and shutdown?",
                                                                             "Ok",
                                                                             "Ok",

+ 17 - 1
Terminal.Gui/App/Application.Lifecycle.cs

@@ -10,6 +10,22 @@ namespace Terminal.Gui.App;
 
 
 public static partial class Application // Lifecycle (Init/Shutdown)
 public static partial class Application // Lifecycle (Init/Shutdown)
 {
 {
+    /// <summary>
+    ///     Gets the singleton <see cref="IApplication"/> instance used by the legacy static Application model.
+    /// </summary>
+    /// <remarks>
+    ///     <para>
+    ///         For new code, prefer using <see cref="Create"/> to get an instance-based application.
+    ///         This property is provided for backward compatibility and internal use.
+    ///     </para>
+    ///     <para>
+    ///         This property returns the same singleton instance used by the legacy static <see cref="Application"/>
+    ///         methods like <see cref="Init"/> and <see cref="Run(IRunnable, Func{Exception, bool}?)"/>.
+    ///     </para>
+    /// </remarks>
+    [Obsolete ("The legacy static Application object is going away. Use Application.Create() for new code.")]
+    public static IApplication Instance => ApplicationImpl.Instance;
+
     /// <summary>
     /// <summary>
     ///     Creates a new <see cref="IApplication"/> instance.
     ///     Creates a new <see cref="IApplication"/> instance.
     /// </summary>
     /// </summary>
@@ -49,7 +65,7 @@ public static partial class Application // Lifecycle (Init/Shutdown)
         internal set => ApplicationImpl.Instance.MainThreadId = value;
         internal set => ApplicationImpl.Instance.MainThreadId = value;
     }
     }
 
 
-    /// <inheritdoc cref="IApplication.Dispose"/>
+    /// <inheritdoc cref="IDisposable.Dispose"/>
     [Obsolete ("The legacy static Application object is going away.")]
     [Obsolete ("The legacy static Application object is going away.")]
     public static void Shutdown () => ApplicationImpl.Instance.Dispose ();
     public static void Shutdown () => ApplicationImpl.Instance.Dispose ();
 
 

+ 0 - 117
Terminal.Gui/App/Application.cd

@@ -1,117 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<ClassDiagram MajorVersion="1" MinorVersion="1">
-  <Class Name="Terminal.Gui.App.Application">
-    <Position X="2.25" Y="1.5" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>gEK4FIgQOAQIuhQeBwoUgSCgAAJL0AACESIKoAiBWw8=</HashCode>
-      <FileName>App\Application.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Class Name="Terminal.Gui.App.ApplicationNavigation" Collapsed="true">
-    <Position X="14.75" Y="2.75" Width="2" />
-    <TypeIdentifier>
-      <HashCode>AABAAAAAAABCAAAAAAAAAAAAAAAAIgIAAAAAAAAAAAA=</HashCode>
-      <FileName>App\ApplicationNavigation.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Class Name="Terminal.Gui.App.IterationEventArgs" Collapsed="true">
-    <Position X="17" Y="3" Width="2" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
-      <FileName>App\IterationEventArgs.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Class Name="Terminal.Gui.App.MainLoop" Collapsed="true" BaseTypeListCollapsed="true">
-    <Position X="11.25" Y="3.75" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAACAAAAAAAAAAAAAACBAAEAAIIAIAgAAAEAI=</HashCode>
-      <FileName>App\MainLoop.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" Collapsed="true" />
-  </Class>
-  <Class Name="Terminal.Gui.App.MainLoopSyncContext" Collapsed="true">
-    <Position X="13" Y="3.75" Width="2" />
-    <TypeIdentifier>
-      <HashCode>AAAAAgAAAAAAAAAAAEAAAAAACAAAAAAAAAAAAAAAAAA=</HashCode>
-      <FileName>App\MainLoopSyncContext.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Class Name="Terminal.Gui.App.SessionToken" Collapsed="true" BaseTypeListCollapsed="true">
-    <Position X="15.25" Y="4" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAACACAgAAAAAAAAAAAAAAAAACQAAAAAAAAAA=</HashCode>
-      <FileName>App\SessionToken.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" Collapsed="true" />
-  </Class>
-  <Class Name="Terminal.Gui.App.SessionTokenEventArgs" Collapsed="true">
-    <Position X="17" Y="4" Width="2" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAA=</HashCode>
-      <FileName>App\SessionTokenEventArgs.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Class Name="Terminal.Gui.App.Timeout" Collapsed="true">
-    <Position X="11.25" Y="4.75" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAQAA=</HashCode>
-      <FileName>App\Timeout.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Class Name="Terminal.Gui.App.TimeoutEventArgs" Collapsed="true">
-    <Position X="13" Y="4.75" Width="2" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAACAIAAAAAAAAAAAA=</HashCode>
-      <FileName>App\TimeoutEventArgs.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Class Name="Terminal.Gui.App.ApplicationImpl" BaseTypeListCollapsed="true">
-    <Position X="4" Y="5" Width="2" />
-    <TypeIdentifier>
-      <HashCode>AABgAAAAIAAIAgQUAAAAAQAAAAAAAAAAQAAKgAAAEAI=</HashCode>
-      <FileName>App\ApplicationImpl.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="Terminal.Gui.App.MouseGrabHandler" Collapsed="true">
-    <Position X="6.25" Y="9.25" Width="2" />
-    <TypeIdentifier>
-      <HashCode>BAAgAAAAgABAAoAAAAAAABAAACEAAAAAAABAAgAAAAA=</HashCode>
-      <FileName>App\MouseGrabHandler.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Interface Name="Terminal.Gui.App.IMainLoopDriver">
-    <Position X="11.25" Y="1.5" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAACAAAAAQAAAAABAAAAAAAEAAAAAAAAAAAAAA=</HashCode>
-      <FileName>App\MainLoop.cs</FileName>
-    </TypeIdentifier>
-  </Interface>
-  <Interface Name="Terminal.Gui.App.IApplication">
-    <Position X="4" Y="1.5" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AAAgAAAAAAAIAgQUAAAAAQAAAAAAAAAAAAAKgAAAEAI=</HashCode>
-      <FileName>App\IApplication.cs</FileName>
-    </TypeIdentifier>
-    <ShowAsAssociation>
-      <Property Name="MouseGrabHandler" />
-      <Property Name="TimedEvents" />
-    </ShowAsAssociation>
-  </Interface>
-  <Interface Name="Terminal.Gui.App.IMouseGrabHandler">
-    <Position X="7" Y="1.5" Width="2" />
-    <TypeIdentifier>
-      <HashCode>BAAgAAAAAAAAAgAAAAAAABAAACEAAAAAAAAAAgAAAAA=</HashCode>
-      <FileName>App\IMouseGrabHandler.cs</FileName>
-    </TypeIdentifier>
-  </Interface>
-  <Interface Name="Terminal.Gui.App.ITimedEvents">
-    <Position X="7" Y="4.5" Width="2" />
-    <TypeIdentifier>
-      <HashCode>BAAAIAAAAQAAAAAQACAAAIBAAQAAAAAAAAAIgAAAAAA=</HashCode>
-      <FileName>App\ITimedEvents.cs</FileName>
-    </TypeIdentifier>
-  </Interface>
-  <Font Name="Segoe UI" Size="9" />
-</ClassDiagram>

+ 1 - 1
Terminal.Gui/App/ApplicationImpl.Driver.cs

@@ -2,7 +2,7 @@ using System.Collections.Concurrent;
 
 
 namespace Terminal.Gui.App;
 namespace Terminal.Gui.App;
 
 
-public partial class ApplicationImpl
+internal partial class ApplicationImpl
 {
 {
     /// <inheritdoc/>
     /// <inheritdoc/>
     public IDriver? Driver { get; set; }
     public IDriver? Driver { get; set; }

+ 1 - 1
Terminal.Gui/App/ApplicationImpl.Lifecycle.cs

@@ -3,7 +3,7 @@ using System.Diagnostics.CodeAnalysis;
 
 
 namespace Terminal.Gui.App;
 namespace Terminal.Gui.App;
 
 
-public partial class ApplicationImpl
+internal partial class ApplicationImpl
 {
 {
     /// <inheritdoc/>
     /// <inheritdoc/>
     public int? MainThreadId { get; set; }
     public int? MainThreadId { get; set; }

+ 1 - 1
Terminal.Gui/App/ApplicationImpl.Run.cs

@@ -3,7 +3,7 @@ using System.Diagnostics.CodeAnalysis;
 
 
 namespace Terminal.Gui.App;
 namespace Terminal.Gui.App;
 
 
-public partial class ApplicationImpl
+internal partial class ApplicationImpl
 {
 {
     // Lock object to protect session stack operations and cached state updates
     // Lock object to protect session stack operations and cached state updates
     private readonly object _sessionStackLock = new ();
     private readonly object _sessionStackLock = new ();

+ 1 - 1
Terminal.Gui/App/ApplicationImpl.Screen.cs

@@ -1,7 +1,7 @@
 
 
 namespace Terminal.Gui.App;
 namespace Terminal.Gui.App;
 
 
-public partial class ApplicationImpl
+internal partial class ApplicationImpl
 {
 {
     /// <inheritdoc/>
     /// <inheritdoc/>
     public event EventHandler<EventArgs<Rectangle>>? ScreenChanged;
     public event EventHandler<EventArgs<Rectangle>>? ScreenChanged;

+ 2 - 2
Terminal.Gui/App/ApplicationImpl.cs

@@ -6,7 +6,7 @@ namespace Terminal.Gui.App;
 ///     Implementation of core <see cref="Application"/> methods using the modern
 ///     Implementation of core <see cref="Application"/> methods using the modern
 ///     main loop architecture with component factories for different platforms.
 ///     main loop architecture with component factories for different platforms.
 /// </summary>
 /// </summary>
-public partial class ApplicationImpl : IApplication
+internal partial class ApplicationImpl : IApplication
 {
 {
     /// <summary>
     /// <summary>
     ///     INTERNAL: Creates a new instance of the Application backend and subscribes to Application configuration property
     ///     INTERNAL: Creates a new instance of the Application backend and subscribes to Application configuration property
@@ -75,7 +75,7 @@ public partial class ApplicationImpl : IApplication
     /// <summary>
     /// <summary>
     ///     Gets the currently configured backend implementation of <see cref="Application"/> gateway methods.
     ///     Gets the currently configured backend implementation of <see cref="Application"/> gateway methods.
     /// </summary>
     /// </summary>
-    public static IApplication Instance
+    internal static IApplication Instance
     {
     {
         get
         get
         {
         {

+ 0 - 79
Terminal.Gui/Views/Autocomplete/Autocomplete.cd

@@ -1,79 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<ClassDiagram MajorVersion="1" MinorVersion="1">
-  <Class Name="Terminal.Gui.Views.AppendAutocomplete" Collapsed="true">
-    <Position X="0.5" Y="6.5" Width="2" />
-    <TypeIdentifier>
-      <HashCode>AAAgAABAAQIAAAAAAAAAAAAABAAAIAQAgAEIAggAIAA=</HashCode>
-      <FileName>Core\Autocomplete\AppendAutocomplete.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Class Name="Terminal.Gui.Views.AutocompleteBase" Collapsed="true">
-    <Position X="1.75" Y="5.25" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AAQgAAAAAUAAIAAAAAIAAAAAAAEAIAQIgQAIQAAAMBA=</HashCode>
-      <FileName>Core\Autocomplete\AutocompleteBase.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="Terminal.Gui.Views.PopupAutocomplete" Collapsed="true">
-    <Position X="2.75" Y="6.5" Width="1.5" />
-    <NestedTypes>
-      <Class Name="Terminal.Gui.Views.PopupAutocomplete.Popup" Collapsed="true">
-        <TypeIdentifier>
-          <NewMemberFileName>Core\Autocomplete\PopupAutocomplete.cs</NewMemberFileName>
-        </TypeIdentifier>
-      </Class>
-    </NestedTypes>
-    <TypeIdentifier>
-      <HashCode>IAEhAAQAASBEQAAAAAIBAAgYAAAAIAwAwKAAQACBAAA=</HashCode>
-      <FileName>Core\Autocomplete\PopupAutocomplete.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Class Name="Terminal.Gui.Views.SingleWordSuggestionGenerator" BaseTypeListCollapsed="true">
-    <Position X="6.25" Y="3.5" Width="3" />
-    <TypeIdentifier>
-      <HashCode>CEAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAIAA=</HashCode>
-      <FileName>Core\Autocomplete\SingleWordSuggestionGenerator.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="Terminal.Gui.Views.Suggestion">
-    <Position X="4.5" Y="2.5" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAAAAAAEAAAAAABAAAAAAAAAAAAAAAAAAAAAE=</HashCode>
-      <FileName>Core\Autocomplete\Suggestion.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Class Name="Terminal.Gui.Views.TextFieldAutocomplete" Collapsed="true">
-    <Position X="1.5" Y="7.5" Width="2" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAgAAAAAAAAAA=</HashCode>
-      <FileName>Views\TextField.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Class Name="Terminal.Gui.Views.TextViewAutocomplete" Collapsed="true">
-    <Position X="3.75" Y="7.5" Width="2.25" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAgAAAAAAAAAA=</HashCode>
-      <FileName>Views\TextView.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Interface Name="Terminal.Gui.Views.IAutocomplete">
-    <Position X="1.75" Y="0.5" Width="2.5" />
-    <TypeIdentifier>
-      <HashCode>AAQgAAAAAUAAIAAAAAAAAAAAAAEAIAQIgQAIQAAAMBA=</HashCode>
-      <FileName>Core\Autocomplete\IAutocomplete.cs</FileName>
-    </TypeIdentifier>
-    <ShowAsAssociation>
-      <Property Name="SuggestionGenerator" />
-    </ShowAsAssociation>
-  </Interface>
-  <Interface Name="Terminal.Gui.Views.ISuggestionGenerator">
-    <Position X="6.25" Y="1.75" Width="2.25" />
-    <TypeIdentifier>
-      <HashCode>AEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAA=</HashCode>
-      <FileName>Core\Autocomplete\ISuggestionGenerator.cs</FileName>
-    </TypeIdentifier>
-  </Interface>
-  <Font Name="Segoe UI" Size="9" />
-</ClassDiagram>

+ 0 - 124
Terminal.Gui/Views/CollectionNavigation/CollectionNavigation.cd

@@ -1,124 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<ClassDiagram MajorVersion="1" MinorVersion="1">
-  <Comment CommentText="Views that use the CollectionNavigation system">
-    <Position X="0.5" Y="0.5" Height="0.458" Width="1.856" />
-  </Comment>
-  <Comment CommentText="Specialized navigators for each collection type (e.g. list, tree etc)">
-    <Position X="4.646" Y="0.5" Height="0.5" Width="3.169" />
-  </Comment>
-  <Comment CommentText="Shared matching component (users should provide alternative implementations of this class if they want to modify collection navigation behaviour)">
-    <Position X="9.448" Y="0.5" Height="0.708" Width="3.169" />
-  </Comment>
-  <Class Name="Terminal.Gui.Views.CollectionNavigatorBase" Collapsed="true">
-    <Position X="6.25" Y="1.5" Width="2" />
-    <TypeIdentifier>
-      <HashCode>AAgEAAAAAAAQAAAIAAEAAgAAAAAABAAEAAAAACwAAAA=</HashCode>
-      <FileName>Views\CollectionNavigation\CollectionNavigatorBase.cs</FileName>
-    </TypeIdentifier>
-    <ShowAsAssociation>
-      <Property Name="Matcher" />
-    </ShowAsAssociation>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="Terminal.Gui.Views.CollectionNavigator" Collapsed="true">
-    <Position X="4.5" Y="3.5" Width="2" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAAAAAQAAAAAAAAgAAAAAAAAAEAAAAAAAAAAA=</HashCode>
-      <FileName>Views\CollectionNavigation\CollectionNavigator.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="Terminal.Gui.Views.DefaultCollectionNavigatorMatcher">
-    <Position X="9.5" Y="2.5" Width="2.75" />
-    <TypeIdentifier>
-      <HashCode>AAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAQA=</HashCode>
-      <FileName>Views\CollectionNavigation\DefaultCollectionNavigatorMatcher.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="Terminal.Gui.Views.TableCollectionNavigator" Collapsed="true">
-    <Position X="4.75" Y="6.5" Width="2.25" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAEAAAAIAAAAAA=</HashCode>
-      <FileName>Views\CollectionNavigation\TableCollectionNavigator.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Class Name="Terminal.Gui.Views.ListView" Collapsed="true">
-    <Position X="0.5" Y="4.25" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AAE+ASAkEnAAABAAKGAggYAZJAIAABEAcBAaAwAQIAA=</HashCode>
-      <FileName>Views\ListView.cs</FileName>
-    </TypeIdentifier>
-    <ShowAsAssociation>
-      <Property Name="KeystrokeNavigator" />
-    </ShowAsAssociation>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="Terminal.Gui.Views.TableView" Collapsed="true" BaseTypeListCollapsed="true">
-    <Position X="0.5" Y="6.5" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>QwUeAxwgICIAcABIABeR0oBAkhoFGGOBDABgAN3oPEI=</HashCode>
-      <FileName>Views\TableView\TableView.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="Terminal.Gui.Views.TreeView" Collapsed="true">
-    <Position X="0.5" Y="3" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAA=</HashCode>
-      <FileName>Views\TreeView\TreeView.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="Terminal.Gui.Views.TreeView&lt;T&gt;" Collapsed="true">
-    <Position X="0.5" Y="2" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>UwAGySBgBSBGMAQgIiCaBDUItJIBSAWwRMQOSgQCwJI=</HashCode>
-      <FileName>Views\TreeView\TreeView.cs</FileName>
-    </TypeIdentifier>
-    <ShowAsAssociation>
-      <Property Name="KeystrokeNavigator" />
-    </ShowAsAssociation>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="Terminal.Gui.Views.FileDialog" Collapsed="true">
-    <Position X="0.5" Y="5.5" Width="1.75" />
-    <Compartments>
-      <Compartment Name="Nested Types" Collapsed="false" />
-    </Compartments>
-    <TypeIdentifier>
-      <HashCode>iIY4LQFUHDKVIHIESBoigQcFT6GxhBDABGJItBQAwAQ=</HashCode>
-      <FileName>Views\FileDialogs\FileDialog.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="Terminal.Gui.Views.FileDialogCollectionNavigator" Collapsed="true">
-    <Position X="4.75" Y="5.5" Width="2.25" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAEAAAAAAAAAAA=</HashCode>
-      <FileName>Views\FileDialogs\FileDialogCollectionNavigator.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Interface Name="Terminal.Gui.Views.ICollectionNavigatorMatcher" Collapsed="true">
-    <Position X="9.5" Y="1.5" Width="2.75" />
-    <TypeIdentifier>
-      <HashCode>AAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAA=</HashCode>
-      <FileName>Views\CollectionNavigation\ICollectionNavigatorMatcher.cs</FileName>
-    </TypeIdentifier>
-  </Interface>
-  <Interface Name="Terminal.Gui.Views.IListCollectionNavigator" Collapsed="true">
-    <Position X="3.75" Y="2.25" Width="2" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
-      <FileName>Views\CollectionNavigation\IListCollectionNavigator.cs</FileName>
-    </TypeIdentifier>
-  </Interface>
-  <Interface Name="Terminal.Gui.Views.ICollectionNavigator" Collapsed="true">
-    <Position X="3.75" Y="1.5" Width="2" />
-    <TypeIdentifier>
-      <HashCode>AAgAAAAAAAAAAAAIAAAAAAAAAAAABAAAAAAAACgAAAA=</HashCode>
-      <FileName>Views\CollectionNavigation\ICollectionNavigator.cs</FileName>
-    </TypeIdentifier>
-  </Interface>
-  <Font Name="Segoe UI" Size="9" />
-</ClassDiagram>

+ 0 - 168
Terminal.Gui/Views/FileDialogs/FileDialog.cd

@@ -1,168 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<ClassDiagram MajorVersion="1" MinorVersion="1">
-  <Class Name="Terminal.Gui.FileServices.DefaultSearchMatcher" Collapsed="true" BaseTypeListCollapsed="true">
-    <Position X="9.25" Y="6" Width="2" />
-    <TypeIdentifier>
-      <HashCode>AAACAAAAAAgAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
-      <FileName>FileServices\DefaultSearchMatcher.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="Terminal.Gui.FileServices.FileSystemInfoStats">
-    <Position X="14" Y="0.5" Width="2.5" />
-    <TypeIdentifier>
-      <HashCode>ABAIQAIIIAAAAAACQAAAAIQAAAQAAIAAAQAAAAAIAAI=</HashCode>
-      <FileName>FileServices\FileSystemInfoStats.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Class Name="Terminal.Gui.Views.FileDialog">
-    <Position X="0.5" Y="0.5" Width="2.75" />
-    <Compartments>
-      <Compartment Name="Fields" Collapsed="true" />
-      <Compartment Name="Methods" Collapsed="true" />
-      <Compartment Name="Nested Types" Collapsed="false" />
-    </Compartments>
-    <NestedTypes>
-      <Class Name="Terminal.Gui.Views.FileDialog.SearchState" Collapsed="true">
-        <TypeIdentifier>
-          <NewMemberFileName>Views\FileDialogs\FileDialog.cs</NewMemberFileName>
-        </TypeIdentifier>
-      </Class>
-    </NestedTypes>
-    <TypeIdentifier>
-      <HashCode>iIY4LQFUHDKVIHIESBoigQcFT6GxhBDABGJItBQAwAQ=</HashCode>
-      <FileName>Views\FileDialogs\FileDialog.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="Terminal.Gui.Views.FileDialogStyle">
-    <Position X="3.5" Y="0.5" Width="2.75" />
-    <TypeIdentifier>
-      <HashCode>GgBAAAFHAAAAuAAAAAAAEAQQBYAAKREAAAAYQCCAAAA=</HashCode>
-      <FileName>Views\FileDialogs\FileDialogStyle.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Class Name="Terminal.Gui.Views.FilesSelectedEventArgs">
-    <Position X="6.5" Y="0.5" Width="2" />
-    <Compartments>
-      <Compartment Name="Methods" Collapsed="true" />
-    </Compartments>
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAA=</HashCode>
-      <FileName>Views\FileDialogs\FilesSelectedEventArgs.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Class Name="Terminal.Gui.Views.FileDialogHistory">
-    <Position X="9.25" Y="0.5" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AQABAgEAAAAAAAAAIACAAAAAAAAAAQAAAAAAAAAADAI=</HashCode>
-      <FileName>Views\FileDialogs\FileDialogHistory.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Class Name="Terminal.Gui.Views.FileDialogState">
-    <Position X="11.5" Y="0.5" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AABAABAAAAAAAAIAAAAEQAAAAAAAQAAAAgAAAAAAAAI=</HashCode>
-      <FileName>Views\FileDialogs\FileDialogState.cs</FileName>
-    </TypeIdentifier>
-    <ShowAsCollectionAssociation>
-      <Property Name="Children" />
-    </ShowAsCollectionAssociation>
-  </Class>
-  <Class Name="Terminal.Gui.Views.AllowedType" BaseTypeListCollapsed="true">
-    <Position X="13.25" Y="5.75" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAAAAgAAAEAAAAAAAAAAAAAAAAAAgAAAAABAA=</HashCode>
-      <FileName>Views\FileDialogs\AllowedType.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="Terminal.Gui.Views.AllowedTypeAny" BaseTypeListCollapsed="true">
-    <Position X="11.75" Y="5.75" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAABAA=</HashCode>
-      <FileName>Views\FileDialogs\AllowedType.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="Terminal.Gui.Text.NerdFonts">
-    <Position X="9.25" Y="6.75" Width="2" />
-    <Compartments>
-      <Compartment Name="Fields" Collapsed="true" />
-    </Compartments>
-    <TypeIdentifier>
-      <HashCode>AIACAAABQAAAAAAAAAAACAAAIACAAAAAAAIAAAAAAAA=</HashCode>
-      <FileName>Text\NerdFonts.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Class Name="Terminal.Gui.FileServices.FileSystemTreeBuilder" BaseTypeListCollapsed="true">
-    <Position X="0.5" Y="6.75" Width="1.75" />
-    <TypeIdentifier>
-      <HashCode>EAAAAAAAAAAAAAAAAAAABAAwAAAAQAAAAABAAAAACAA=</HashCode>
-      <FileName>FileServices\FileSystemTreeBuilder.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="Terminal.Gui.Views.DefaultFileOperations" BaseTypeListCollapsed="true">
-    <Position X="7" Y="6" Width="2" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAAAAAACAAAAAAACAAAAEAAAAAAAAAAAAAgAA=</HashCode>
-      <FileName>Views\FileDialogs\DefaultFileOperations.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="Terminal.Gui.FileServices.FileSystemColorProvider" Collapsed="true">
-    <Position X="7" Y="8.5" Width="2" />
-    <TypeIdentifier>
-      <HashCode>AgAAAAAAAEAAAAAAAAAAAAEAAAAAAACAAAAAAAAAAAA=</HashCode>
-      <FileName>FileServices\FileSystemColorProvider.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Class Name="Terminal.Gui.FileServices.FileSystemIconProvider" Collapsed="true">
-    <Position X="7" Y="7.75" Width="2" />
-    <TypeIdentifier>
-      <HashCode>ABAAAAAAAACAQAAAAAAAAEAgAAAAAQAAAAAAAAAAAiA=</HashCode>
-      <FileName>FileServices\FileSystemIconProvider.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Class Name="Terminal.Gui.Views.FileDialogTableSource">
-    <Position X="2.5" Y="8" Width="2.5" />
-    <Compartments>
-      <Compartment Name="Fields" Collapsed="true" />
-    </Compartments>
-    <TypeIdentifier>
-      <HashCode>AQAAAAAAIAACAEAACAAAAAACAAAEAAAEAAAAgAgBBAA=</HashCode>
-      <FileName>Views\FileDialogs\FileDialogTableSource.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Interface Name="Terminal.Gui.FileServices.IFileOperations">
-    <Position X="7" Y="4.25" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAAAAAACAAAAAAAAAAAAEAAAAAAAAAAAAAgAA=</HashCode>
-      <FileName>FileServices\IFileOperations.cs</FileName>
-    </TypeIdentifier>
-  </Interface>
-  <Interface Name="Terminal.Gui.FileServices.ISearchMatcher">
-    <Position X="9.25" Y="4.25" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AAACAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
-      <FileName>FileServices\ISearchMatcher.cs</FileName>
-    </TypeIdentifier>
-  </Interface>
-  <Interface Name="Terminal.Gui.Views.IAllowedType" Collapsed="true">
-    <Position X="12" Y="4.25" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAA=</HashCode>
-      <FileName>Views\FileDialogs\AllowedType.cs</FileName>
-    </TypeIdentifier>
-  </Interface>
-  <Enum Name="Terminal.Gui.Views.OpenMode">
-    <Position X="7.5" Y="2.5" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AAAAABAAAAAAACAAAAAAAAAAAAAEAAAAAAAAAAAAAAA=</HashCode>
-      <FileName>Views\FileDialogs\OpenMode.cs</FileName>
-    </TypeIdentifier>
-  </Enum>
-  <Font Name="Segoe UI" Size="9" />
-</ClassDiagram>

+ 1 - 1
Terminal.Gui/Views/MessageBox.cs

@@ -18,7 +18,7 @@ namespace Terminal.Gui.Views;
 ///         <b>Important:</b> All MessageBox methods require an <see cref="IApplication"/> instance to be passed.
 ///         <b>Important:</b> All MessageBox methods require an <see cref="IApplication"/> instance to be passed.
 ///         This enables proper modal dialog management and respects the application's lifecycle. Pass your
 ///         This enables proper modal dialog management and respects the application's lifecycle. Pass your
 ///         application instance (from <see cref="Application.Create()"/>) or use the legacy
 ///         application instance (from <see cref="Application.Create()"/>) or use the legacy
-///         <see cref="ApplicationImpl.Instance"/> if using the static Application pattern.
+///         <see cref="Application.Instance"/> if using the static Application pattern.
 ///     </para>
 ///     </para>
 ///     <para>
 ///     <para>
 ///         Example using instance-based pattern:
 ///         Example using instance-based pattern:

+ 1 - 1
Terminal.Gui/Views/Shortcut.cs

@@ -634,7 +634,7 @@ public class Shortcut : View, IOrientation, IDesignable
         get => _bindKeyToApplication;
         get => _bindKeyToApplication;
         set
         set
         {
         {
-            App ??= SuperView?.App ?? ApplicationImpl.Instance; // HACK: Remove once legacy static Application is gone
+            App ??= SuperView?.App ?? Application.Instance; // HACK: Remove once legacy static Application is gone
             Debug.Assert (App is { });
             Debug.Assert (App is { });
 
 
             if (value == _bindKeyToApplication)
             if (value == _bindKeyToApplication)

+ 0 - 89
Tests/TerminalGuiFluentTesting/ClassDiagram1.cd

@@ -1,89 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<ClassDiagram MajorVersion="1" MinorVersion="1">
-  <Class Name="TerminalGuiFluentTesting.With" Collapsed="true">
-    <Position X="0.5" Y="1.5" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAIAAAAAA=</HashCode>
-      <FileName>With.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Class Name="TerminalGuiFluentTesting.FakeInput&lt;T&gt;" Collapsed="true">
-    <Position X="7" Y="1.5" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AQAAAAAAACAAAQEAAAAgAAAAAAAAAAAAAAAAAAAAAAI=</HashCode>
-      <FileName>FakeInput.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="TerminalGuiFluentTesting.FakeNetInput" Collapsed="true">
-    <Position X="8.25" Y="2.75" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
-      <FileName>FakeNetInput.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="TerminalGuiFluentTesting.FakeWindowsInput" Collapsed="true">
-    <Position X="6" Y="2.75" Width="1.75" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
-      <FileName>FakeWindowsInput.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="TerminalGuiFluentTesting.FakeOutput" Collapsed="true" BaseTypeListCollapsed="true">
-    <Position X="5.5" Y="0.5" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAgCAAgAAAAAAAAAAAAAAAQAAAMAAAAAEAAAA=</HashCode>
-      <FileName>FakeOutput.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="TerminalGuiFluentTesting.GuiTestContext" BaseTypeListCollapsed="true">
-    <Position X="2.25" Y="0.5" Width="2.25" />
-    <Compartments>
-      <Compartment Name="Fields" Collapsed="true" />
-    </Compartments>
-    <TypeIdentifier>
-      <HashCode>ABJAAAIAACBACRAAg4IAAAAgAJIEgQQAKACIBACAIgI=</HashCode>
-      <FileName>GuiTestContext.cs</FileName>
-    </TypeIdentifier>
-    <ShowAsAssociation>
-      <Field Name="_output" />
-      <Field Name="_winInput" />
-      <Field Name="_netInput" />
-    </ShowAsAssociation>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="TerminalGuiFluentTesting.TextWriterLoggerProvider" Collapsed="true">
-    <Position X="10" Y="2.75" Width="2" />
-    <TypeIdentifier>
-      <HashCode>AAAAAIAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
-      <FileName>TextWriterLoggerProvider.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="TerminalGuiFluentTesting.TextWriterLogger" Collapsed="true">
-    <Position X="10" Y="1.75" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAAAAAAAAAAAEAAAAAAAgAAAAAAAAIAAAAAAA=</HashCode>
-      <FileName>TextWriterLogger.cs</FileName>
-    </TypeIdentifier>
-    <Lollipop Position="0.2" />
-  </Class>
-  <Class Name="TerminalGuiFluentTesting.NetSequences">
-    <Position X="11" Y="4.5" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAACACAAAAAAgI=</HashCode>
-      <FileName>NetSequences.cs</FileName>
-    </TypeIdentifier>
-  </Class>
-  <Enum Name="TerminalGuiFluentTesting.V2TestDriver">
-    <Position X="9.25" Y="4.5" Width="1.5" />
-    <TypeIdentifier>
-      <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAACAAA=</HashCode>
-      <FileName>V2TestDriver.cs</FileName>
-    </TypeIdentifier>
-  </Enum>
-  <Font Name="Segoe UI" Size="9" />
-</ClassDiagram>

+ 192 - 185
docfx/docs/application.md

@@ -18,7 +18,7 @@ Terminal.Gui v2 uses an instance-based application architecture with the **IRunn
 graph TB
 graph TB
     subgraph ViewTree["View Hierarchy (SuperView/SubView)"]
     subgraph ViewTree["View Hierarchy (SuperView/SubView)"]
         direction TB
         direction TB
-        Top[app.Current<br/>Window]
+        Top[app.TopRunnable<br/>Window]
         Menu[MenuBar]
         Menu[MenuBar]
         Status[StatusBar]
         Status[StatusBar]
         Content[Content View]
         Content[Content View]
@@ -59,19 +59,19 @@ sequenceDiagram
     
     
     App->>Main: Run(mainWindow)
     App->>Main: Run(mainWindow)
     activate Main
     activate Main
-    Note over App: SessionStack: [Main]<br/>Current: Main
+    Note over App: SessionStack: [Main]<br/>TopRunnable: Main
     
     
     Main->>Dialog: Run(dialog)
     Main->>Dialog: Run(dialog)
     activate Dialog
     activate Dialog
-    Note over App: SessionStack: [Dialog, Main]<br/>Current: Dialog
+    Note over App: SessionStack: [Dialog, Main]<br/>TopRunnable: Dialog
     
     
     Dialog->>App: RequestStop()
     Dialog->>App: RequestStop()
     deactivate Dialog
     deactivate Dialog
-    Note over App: SessionStack: [Main]<br/>Current: Main
+    Note over App: SessionStack: [Main]<br/>TopRunnable: Main
     
     
     Main->>App: RequestStop()
     Main->>App: RequestStop()
     deactivate Main
     deactivate Main
-    Note over App: SessionStack: []<br/>Current: null
+    Note over App: SessionStack: []<br/>TopRunnable: null
 ```
 ```
 
 
 ## Key Concepts
 ## Key Concepts
@@ -82,37 +82,37 @@ sequenceDiagram
 
 
 ```csharp
 ```csharp
 // OLD (v1 / early v2 - still works but obsolete):
 // OLD (v1 / early v2 - still works but obsolete):
-Application.Init();
-var top = new Window();
-top.Add(myView);
-Application.Run(top);
-top.Dispose();
-Application.Shutdown(); // Obsolete - use Dispose() instead
+Application.Init ();
+Window top = new ();
+top.Add (myView);
+Application.Run (top);
+top.Dispose ();
+Application.Shutdown (); // Obsolete - use Dispose() instead
 
 
 // RECOMMENDED (v2 - instance-based with using statement):
 // RECOMMENDED (v2 - instance-based with using statement):
-using (var app = Application.Create().Init())
+using (IApplication app = Application.Create ().Init ())
 {
 {
-    var top = new Window();
-    top.Add(myView);
-    app.Run(top);
-    top.Dispose();
+    Window top = new ();
+    top.Add (myView);
+    app.Run (top);
+    top.Dispose ();
 } // app.Dispose() called automatically
 } // app.Dispose() called automatically
 
 
 // WITH IRunnable (fluent API with automatic disposal):
 // WITH IRunnable (fluent API with automatic disposal):
-using (var app = Application.Create().Init())
+using (IApplication app = Application.Create ().Init ())
 {
 {
-    app.Run<ColorPickerDialog>();
-    Color? result = app.GetResult<Color>();
+    app.Run<ColorPickerDialog> ();
+    Color? result = app.GetResult<Color> ();
 }
 }
 
 
 // SIMPLEST (manual disposal):
 // SIMPLEST (manual disposal):
-var app = Application.Create().Init();
-app.Run<ColorPickerDialog>();
-Color? result = app.GetResult<Color>();
-app.Dispose();
+IApplication app = Application.Create ().Init ();
+app.Run<ColorPickerDialog> ();
+Color? result = app.GetResult<Color> ();
+app.Dispose ();
 ```
 ```
 
 
-**Note:** The static `Application` class delegates to `ApplicationImpl.Instance` (a singleton). `Application.Create()` creates a **new** `ApplicationImpl` instance, enabling multiple application contexts and better testability.
+**Note:** The static `Application` class delegates to a singleton instance accessible via `Application.Instance`. `Application.Create()` creates a **new** application instance, enabling multiple application contexts and better testability.
 
 
 ### View.App Property
 ### View.App Property
 
 
@@ -130,7 +130,7 @@ public class View
     /// Gets the application context, checking parent hierarchy if needed.
     /// Gets the application context, checking parent hierarchy if needed.
     /// Override to customize application resolution.
     /// Override to customize application resolution.
     /// </summary>
     /// </summary>
-    public virtual IApplication? GetApp() => App ?? SuperView?.GetApp();
+    public virtual IApplication? GetApp () => App ?? SuperView?.GetApp ();
 }
 }
 ```
 ```
 
 
@@ -147,10 +147,10 @@ public class View
 ```csharp
 ```csharp
 public class MyView : View
 public class MyView : View
 {
 {
-    public override void OnEnter(View view)
+    public override void OnEnter (View view)
     {
     {
         // Use View.App instead of static Application
         // Use View.App instead of static Application
-        App?.Current?.SetNeedsDraw();
+        App?.TopRunnable?.SetNeedsDraw ();
         
         
         // Access SessionStack
         // Access SessionStack
         if (App?.SessionStack.Count > 0)
         if (App?.SessionStack.Count > 0)
@@ -168,15 +168,15 @@ public class MyView : View
 {
 {
     private readonly IApplication _app;
     private readonly IApplication _app;
     
     
-    public MyView(IApplication app)
+    public MyView (IApplication app)
     {
     {
         _app = app;
         _app = app;
         // Now completely decoupled from static Application
         // Now completely decoupled from static Application
     }
     }
     
     
-    public void DoWork()
+    public void DoWork ()
     {
     {
-        _app.Current?.SetNeedsDraw();
+        _app.TopRunnable?.SetNeedsDraw ();
     }
     }
 }
 }
 ```
 ```
@@ -199,26 +199,26 @@ The fluent API enables elegant method chaining with automatic resource managemen
 
 
 ```csharp
 ```csharp
 // Recommended: using statement with GetResult
 // Recommended: using statement with GetResult
-using (var app = Application.Create().Init())
+using (IApplication app = Application.Create ().Init ())
 {
 {
-    app.Run<ColorPickerDialog>();
-    Color? result = app.GetResult<Color>();
+    app.Run<ColorPickerDialog> ();
+    Color? result = app.GetResult<Color> ();
     
     
     if (result is { })
     if (result is { })
     {
     {
-        ApplyColor(result);
+        ApplyColor (result);
     }
     }
 }
 }
 
 
 // Alternative: Manual disposal
 // Alternative: Manual disposal
-var app = Application.Create().Init();
-app.Run<ColorPickerDialog>();
-Color? result = app.GetResult<Color>();
-app.Dispose();
+IApplication app = Application.Create ().Init ();
+app.Run<ColorPickerDialog> ();
+Color? result = app.GetResult<Color> ();
+app.Dispose ();
 
 
 if (result is { })
 if (result is { })
 {
 {
-    ApplyColor(result);
+    ApplyColor (result);
 }
 }
 ```
 ```
 
 
@@ -240,19 +240,19 @@ if (result is { })
 
 
 ```csharp
 ```csharp
 // Framework ownership - automatic disposal
 // Framework ownership - automatic disposal
-using (var app = Application.Create().Init())
+using (IApplication app = Application.Create ().Init ())
 {
 {
-    app.Run<MyDialog>(); // Dialog disposed automatically when Run returns
-    var result = app.GetResult<MyResultType>();
+    app.Run<MyDialog> (); // Dialog disposed automatically when Run returns
+    MyResultType? result = app.GetResult<MyResultType> ();
 }
 }
 
 
 // Caller ownership - manual disposal
 // Caller ownership - manual disposal
-using (var app = Application.Create().Init())
+using (IApplication app = Application.Create ().Init ())
 {
 {
-    var dialog = new MyDialog();
-    app.Run(dialog);
-    var result = dialog.Result;
-    dialog.Dispose();  // Caller must dispose
+    MyDialog dialog = new ();
+    app.Run (dialog);
+    MyResultType? result = dialog.Result;
+    dialog.Dispose ();  // Caller must dispose
 }
 }
 ```
 ```
 
 
@@ -265,35 +265,36 @@ public class FileDialog : Runnable<string?>
 {
 {
     private TextField _pathField;
     private TextField _pathField;
     
     
-    public FileDialog()
+    public FileDialog ()
     {
     {
         Title = "Select File";
         Title = "Select File";
         
         
-        _pathField = new TextField { X = 1, Y = 1, Width = Dim.Fill(1) };
+        _pathField = new () { X = 1, Y = 1, Width = Dim.Fill (1) };
         
         
-        var okButton = new Button { Text = "OK", IsDefault = true };
-        okButton.Accepting += (s, e) => {
+        Button okButton = new () { Text = "OK", IsDefault = true };
+        okButton.Accepting += (s, e) =>
+        {
             Result = _pathField.Text;
             Result = _pathField.Text;
-            Application.RequestStop();
+            Application.RequestStop ();
         };
         };
         
         
-        Add(_pathField, okButton);
+        Add (_pathField, okButton);
     }
     }
     
     
-    protected override bool OnIsRunningChanging(bool oldValue, bool newValue)
+    protected override bool OnIsRunningChanging (bool oldValue, bool newValue)
     {
     {
         if (!newValue)  // Stopping - extract result before disposal
         if (!newValue)  // Stopping - extract result before disposal
         {
         {
             Result = _pathField?.Text;
             Result = _pathField?.Text;
         }
         }
-        return base.OnIsRunningChanging(oldValue, newValue);
+        return base.OnIsRunningChanging (oldValue, newValue);
     }
     }
 }
 }
 ```
 ```
 
 
 ### Lifecycle Properties
 ### Lifecycle Properties
 
 
-- **`IsRunning`** - True when runnable is on `RunnableSessionStack`
+- **`IsRunning`** - True when runnable is on `SessionStack`
 - **`IsModal`** - True when runnable is at top of stack (capturing all input)
 - **`IsModal`** - True when runnable is at top of stack (capturing all input)
 - **`Result`** - Typed result value set before stopping
 - **`Result`** - Typed result value set before stopping
 
 
@@ -310,7 +311,7 @@ All events follow Terminal.Gui's Cancellable Work Pattern:
 **Example - Result Extraction:**
 **Example - Result Extraction:**
 
 
 ```csharp
 ```csharp
-protected override bool OnIsRunningChanging(bool oldValue, bool newValue)
+protected override bool OnIsRunningChanging (bool oldValue, bool newValue)
 {
 {
     if (!newValue)  // Stopping
     if (!newValue)  // Stopping
     {
     {
@@ -318,33 +319,39 @@ protected override bool OnIsRunningChanging(bool oldValue, bool newValue)
         Result = _colorPicker.SelectedColor;
         Result = _colorPicker.SelectedColor;
         
         
         // Optionally cancel stop (e.g., unsaved changes)
         // Optionally cancel stop (e.g., unsaved changes)
-        if (HasUnsavedChanges())
+        if (HasUnsavedChanges ())
         {
         {
-            int response = MessageBox.Query("Save?", "Save changes?", "Yes", "No", "Cancel");
-            if (response == 2) return true;  // Cancel stop
-            if (response == 0) Save();
+            var response = MessageBox.Query ("Save?", "Save changes?", "Yes", "No", "Cancel");
+            if (response == 2)
+            {
+                return true;  // Cancel stop
+            }
+            if (response == 0)
+            {
+                Save ();
+            }
         }
         }
     }
     }
     
     
-    return base.OnIsRunningChanging(oldValue, newValue);
+    return base.OnIsRunningChanging (oldValue, newValue);
 }
 }
 ```
 ```
 
 
-### RunnableSessionStack
+### SessionStack
 
 
-The `RunnableSessionStack` manages all running `IRunnable` sessions:
+The `SessionStack` manages all running `IRunnable` sessions:
 
 
 ```csharp
 ```csharp
 public interface IApplication
 public interface IApplication
 {
 {
     /// <summary>
     /// <summary>
     /// Stack of running IRunnable sessions.
     /// Stack of running IRunnable sessions.
-    /// Each entry is a RunnableSessionToken wrapping an IRunnable.
+    /// Each entry is a SessionToken wrapping an IRunnable.
     /// </summary>
     /// </summary>
-    ConcurrentStack<RunnableSessionToken>? RunnableSessionStack { get; }
+    ConcurrentStack<SessionToken>? SessionStack { get; }
     
     
     /// <summary>
     /// <summary>
-    /// The IRunnable at the top of RunnableSessionStack (currently modal).
+    /// The IRunnable at the top of SessionStack (currently modal).
     /// </summary>
     /// </summary>
     IRunnable? TopRunnable { get; }
     IRunnable? TopRunnable { get; }
 }
 }
@@ -353,9 +360,9 @@ public interface IApplication
 **Stack Behavior:**
 **Stack Behavior:**
 
 
 - Push: `Begin(IRunnable)` adds to top of stack
 - Push: `Begin(IRunnable)` adds to top of stack
-- Pop: `End(RunnableSessionToken)` removes from stack
+- Pop: `End(SessionToken)` removes from stack
 - Peek: `TopRunnable` returns current modal runnable
 - Peek: `TopRunnable` returns current modal runnable
-- All: `RunnableSessionStack` enumerates all running sessions
+- All: `SessionStack` enumerates all running sessions
 
 
 ## IApplication Interface
 ## IApplication Interface
 
 
@@ -374,19 +381,19 @@ public interface IApplication
     IMainLoopCoordinator? Coordinator { get; }
     IMainLoopCoordinator? Coordinator { get; }
     
     
     // Fluent API methods  
     // Fluent API methods  
-    IApplication Init(string? driverName = null);
-    void Dispose(); // IDisposable
+    IApplication Init (string? driverName = null);
+    void Dispose (); // IDisposable
     
     
     // Runnable methods
     // Runnable methods
-    SessionToken? Begin(IRunnable runnable);
-    object? Run(IRunnable runnable, Func<Exception, bool>? errorHandler = null);
-    IApplication Run<TRunnable>(Func<Exception, bool>? errorHandler = null) where TRunnable : IRunnable, new();
-    void RequestStop(IRunnable? runnable);
-    void End(SessionToken sessionToken);
+    SessionToken? Begin (IRunnable runnable);
+    object? Run (IRunnable runnable, Func<Exception, bool>? errorHandler = null);
+    IApplication Run<TRunnable> (Func<Exception, bool>? errorHandler = null) where TRunnable : IRunnable, new();
+    void RequestStop (IRunnable? runnable);
+    void End (SessionToken sessionToken);
     
     
     // Result extraction
     // Result extraction
-    object? GetResult();
-    T? GetResult<T>() where T : class;
+    object? GetResult ();
+    T? GetResult<T> () where T : class;
     
     
     // ... other members
     // ... other members
 }
 }
@@ -423,13 +430,13 @@ The `SessionStack` property is the stack of running sessions:
 
 
 ```csharp
 ```csharp
 // Access all running sessions
 // Access all running sessions
-foreach (var runnable in app.SessionStack)
+foreach (SessionToken runnable in app.SessionStack)
 {
 {
     // Process each session
     // Process each session
 }
 }
 
 
 // From within a view
 // From within a view
-int sessionCount = App?.SessionStack.Count ?? 0;
+var sessionCount = App?.SessionStack.Count ?? 0;
 ```
 ```
 
 
 **Why "SessionStack" instead of "Runnables"?**
 **Why "SessionStack" instead of "Runnables"?**
@@ -439,25 +446,25 @@ int sessionCount = App?.SessionStack.Count ?? 0;
 
 
 ## Migration from Static Application
 ## Migration from Static Application
 
 
-The static `Application` class delegates to `ApplicationImpl.Instance` (a singleton) and is marked obsolete. All static methods and properties are marked with `[Obsolete]` but remain functional for backward compatibility:
+The static `Application` class delegates to a singleton instance and is marked obsolete. All static methods and properties are marked with `[Obsolete]` but remain functional for backward compatibility:
 
 
 ```csharp
 ```csharp
 public static partial class Application
 public static partial class Application
 {
 {
-    [Obsolete("The legacy static Application object is going away.")]
-    public static View? TopRunnableView => ApplicationImpl.Instance.TopRunnableView;
+    [Obsolete ("The legacy static Application object is going away.")]
+    public static View? TopRunnableView => Instance.TopRunnableView;
     
     
-    [Obsolete("The legacy static Application object is going away.")]
-    public static IRunnable? TopRunnable => ApplicationImpl.Instance.TopRunnable;
+    [Obsolete ("The legacy static Application object is going away.")]
+    public static IRunnable? TopRunnable => Instance.TopRunnable;
     
     
-    [Obsolete("The legacy static Application object is going away.")]
-    public static ConcurrentStack<SessionToken>? SessionStack => ApplicationImpl.Instance.SessionStack;
+    [Obsolete ("The legacy static Application object is going away.")]
+    public static ConcurrentStack<SessionToken>? SessionStack => Instance.SessionStack;
     
     
     // ... other obsolete static members
     // ... other obsolete static members
 }
 }
 ```
 ```
 
 
-**Important:** The static `Application` class uses a singleton (`ApplicationImpl.Instance`), while `Application.Create()` creates new instances. For new code, prefer the instance-based pattern using `Application.Create()`.
+**Important:** The static `Application` class uses a singleton (`Application.Instance`), while `Application.Create()` creates new instances. For new code, prefer the instance-based pattern using `Application.Create()`.
 
 
 ### Migration Strategies
 ### Migration Strategies
 
 
@@ -465,15 +472,15 @@ public static partial class Application
 
 
 ```csharp
 ```csharp
 // OLD:
 // OLD:
-void MyMethod()
+void MyMethod ()
 {
 {
-    Application.TopRunnable?.SetNeedsDraw();
+    Application.TopRunnable?.SetNeedsDraw ();
 }
 }
 
 
 // NEW:
 // NEW:
-void MyMethod(View view)
+void MyMethod (View view)
 {
 {
-    view.App?.TopRunnableView?.SetNeedsDraw();
+    view.App?.TopRunnableView?.SetNeedsDraw ();
 }
 }
 ```
 ```
 
 
@@ -481,18 +488,18 @@ void MyMethod(View view)
 
 
 ```csharp
 ```csharp
 // OLD:
 // OLD:
-void ProcessSessions()
+void ProcessSessions ()
 {
 {
-    foreach (var runnable in Application.SessionStack)
+    foreach (SessionToken runnable in Application.SessionStack)
     {
     {
         // Process
         // Process
     }
     }
 }
 }
 
 
 // NEW:
 // NEW:
-void ProcessSessions(IApplication app)
+void ProcessSessions (IApplication app)
 {
 {
-    foreach (var runnable in app.SessionStack)
+    foreach (SessionToken runnable in app.SessionStack)
     {
     {
         // Process
         // Process
     }
     }
@@ -506,14 +513,14 @@ public class MyService
 {
 {
     private readonly IApplication _app;
     private readonly IApplication _app;
     
     
-    public MyService(IApplication app)
+    public MyService (IApplication app)
     {
     {
         _app = app;
         _app = app;
     }
     }
     
     
-    public void DoWork()
+    public void DoWork ()
     {
     {
-        _app.Current?.Title = "Processing...";
+        _app.TopRunnable?.Title = "Processing...";
     }
     }
 }
 }
 ```
 ```
@@ -530,9 +537,9 @@ Terminal.Gui v2 implements the `IDisposable` pattern for proper resource cleanup
 
 
 ```csharp
 ```csharp
 // Automatic disposal with using statement
 // Automatic disposal with using statement
-using (var app = Application.Create().Init())
+using (IApplication app = Application.Create ().Init ())
 {
 {
-    app.Run<MyDialog>();
+    app.Run<MyDialog> ();
     // app.Dispose() automatically called when scope exits
     // app.Dispose() automatically called when scope exits
 }
 }
 ```
 ```
@@ -541,15 +548,15 @@ using (var app = Application.Create().Init())
 
 
 ```csharp
 ```csharp
 // Manual disposal
 // Manual disposal
-var app = Application.Create();
+IApplication app = Application.Create ();
 try
 try
 {
 {
-    app.Init();
-    app.Run<MyDialog>();
+    app.Init ();
+    app.Run<MyDialog> ();
 }
 }
 finally
 finally
 {
 {
-    app.Dispose(); // Ensure cleanup even if exception occurs
+    app.Dispose (); // Ensure cleanup even if exception occurs
 }
 }
 ```
 ```
 
 
@@ -561,44 +568,44 @@ finally
 
 
 ```csharp
 ```csharp
 // RECOMMENDED (using statement):
 // RECOMMENDED (using statement):
-using (var app = Application.Create().Init())
+using (IApplication app = Application.Create ().Init ())
 {
 {
-    app.Run<MyDialog>();
-    var result = app.GetResult<MyResult>();
+    app.Run<MyDialog> ();
+    MyResult? result = app.GetResult<MyResult> ();
     // app.Dispose() called automatically here
     // app.Dispose() called automatically here
 }
 }
 
 
 // ALTERNATIVE (manual disposal):
 // ALTERNATIVE (manual disposal):
-var app = Application.Create().Init();
-app.Run<MyDialog>();
-var result = app.GetResult<MyResult>();
-app.Dispose(); // Must call explicitly
+IApplication app = Application.Create ().Init ();
+app.Run<MyDialog> ();
+MyResult? result = app.GetResult<MyResult> ();
+app.Dispose (); // Must call explicitly
 
 
 // OLD (obsolete - do not use):
 // OLD (obsolete - do not use):
-var result = app.Run<MyDialog>().Shutdown() as MyResult;
+object? result = app.Run<MyDialog> ().Shutdown ();
 ```
 ```
 
 
 ### Input Thread Lifecycle
 ### Input Thread Lifecycle
 
 
-When you call `Init()`, Terminal.Gui starts a dedicated input thread that continuously polls for console input. This thread must be stopped properly:
+When calling `Init()`, Terminal.Gui starts a dedicated input thread that continuously polls for console input. This thread must be stopped properly:
 
 
 ```csharp
 ```csharp
-var app = Application.Create();
-app.Init("fake"); // Input thread starts here
+IApplication app = Application.Create ();
+app.Init ("fake"); // Input thread starts here
 
 
 // Input thread runs in background at ~50 polls/second (20ms throttle)
 // Input thread runs in background at ~50 polls/second (20ms throttle)
 
 
-app.Dispose(); // Cancels input thread and waits for it to exit
+app.Dispose (); // Cancels input thread and waits for it to exit
 ```
 ```
 
 
 **Important for Tests**: Always dispose applications in tests to prevent thread leaks:
 **Important for Tests**: Always dispose applications in tests to prevent thread leaks:
 
 
 ```csharp
 ```csharp
 [Fact]
 [Fact]
-public void My_Test()
+public void My_Test ()
 {
 {
-    using var app = Application.Create();
-    app.Init("fake");
+    using IApplication app = Application.Create ();
+    app.Init ("fake");
     
     
     // Test code here
     // Test code here
     
     
@@ -612,22 +619,22 @@ The legacy static `Application` singleton can be re-initialized after disposal (
 
 
 ```csharp
 ```csharp
 // Test 1
 // Test 1
-Application.Init();
-Application.Shutdown(); // Obsolete but still works for legacy singleton
+Application.Init ();
+Application.Shutdown (); // Obsolete but still works for legacy singleton
 
 
 // Test 2 - singleton resets and can be re-initialized
 // Test 2 - singleton resets and can be re-initialized
-Application.Init(); // ✅ Works!
-Application.Shutdown(); // Obsolete but still works for legacy singleton
+Application.Init (); // ✅ Works!
+Application.Shutdown (); // Obsolete but still works for legacy singleton
 ```
 ```
 
 
 However, instance-based applications follow standard `IDisposable` semantics and cannot be reused after disposal:
 However, instance-based applications follow standard `IDisposable` semantics and cannot be reused after disposal:
 
 
 ```csharp
 ```csharp
-var app = Application.Create();
-app.Init();
-app.Dispose();
+IApplication app = Application.Create ();
+app.Init ();
+app.Dispose ();
 
 
-app.Init(); // ❌ Throws ObjectDisposedException
+app.Init (); // ❌ Throws ObjectDisposedException
 ```
 ```
 
 
 ## Session Management
 ## Session Management
@@ -637,21 +644,21 @@ app.Init(); // ❌ Throws ObjectDisposedException
 Applications manage sessions through `Begin()` and `End()`:
 Applications manage sessions through `Begin()` and `End()`:
 
 
 ```csharp
 ```csharp
-using var app = Application.Create ();
-app.Init();
+using IApplication app = Application.Create ();
+app.Init ();
 
 
-var window = new Window();
+Window window = new ();
 
 
 // Begin a new session - pushes to SessionStack
 // Begin a new session - pushes to SessionStack
-SessionToken? token = app.Begin(window);
+SessionToken? token = app.Begin (window);
 
 
 // TopRunnable now points to this window
 // TopRunnable now points to this window
-Debug.Assert(app.TopRunnable == window);
+Debug.Assert (app.TopRunnable == window);
 
 
 // End the session - pops from SessionStack
 // End the session - pops from SessionStack
 if (token != null)
 if (token != null)
 {
 {
-    app.End(token);
+    app.End (token);
 }
 }
 
 
 // TopRunnable restored to previous runnable (if any)
 // TopRunnable restored to previous runnable (if any)
@@ -662,25 +669,25 @@ if (token != null)
 Multiple sessions can run nested:
 Multiple sessions can run nested:
 
 
 ```csharp
 ```csharp
-using var app = Application.Create ();
-app.Init();
+using IApplication app = Application.Create ();
+app.Init ();
 
 
 // Session 1
 // Session 1
-var main = new Window { Title = "Main" };
-var token1 = app.Begin(main);
+Window main = new () { Title = "Main" };
+SessionToken? token1 = app.Begin (main);
 // app.TopRunnable == main, SessionStack.Count == 1
 // app.TopRunnable == main, SessionStack.Count == 1
 
 
 // Session 2 (nested)
 // Session 2 (nested)
-var dialog = new Dialog { Title = "Dialog" };
-var token2 = app.Begin(dialog);
+Dialog dialog = new () { Title = "Dialog" };
+SessionToken? token2 = app.Begin (dialog);
 // app.TopRunnable == dialog, SessionStack.Count == 2
 // app.TopRunnable == dialog, SessionStack.Count == 2
 
 
 // End dialog
 // End dialog
-app.End(token2);
+app.End (token2);
 // app.TopRunnable == main, SessionStack.Count == 1
 // app.TopRunnable == main, SessionStack.Count == 1
 
 
 // End main
 // End main
-app.End(token1);
+app.End (token1);
 // app.TopRunnable == null, SessionStack.Count == 0
 // app.TopRunnable == null, SessionStack.Count == 0
 ```
 ```
 
 
@@ -694,24 +701,24 @@ public class View
     /// <summary>
     /// <summary>
     /// Gets the driver for this view.
     /// Gets the driver for this view.
     /// </summary>
     /// </summary>
-    public IDriver? Driver => GetDriver();
+    public IDriver? Driver => GetDriver ();
     
     
     /// <summary>
     /// <summary>
     /// Gets the driver, checking application context if needed.
     /// Gets the driver, checking application context if needed.
     /// Override to customize driver resolution.
     /// Override to customize driver resolution.
     /// </summary>
     /// </summary>
-    public virtual IDriver? GetDriver() => App?.Driver;
+    public virtual IDriver? GetDriver () => App?.Driver;
 }
 }
 ```
 ```
 
 
 **Usage:**
 **Usage:**
 
 
 ```csharp
 ```csharp
-public override void OnDrawContent(Rectangle viewport)
+public override void OnDrawContent (Rectangle viewport)
 {
 {
     // Use view's driver instead of Application.Driver
     // Use view's driver instead of Application.Driver
-    Driver?.Move(0, 0);
-    Driver?.AddStr("Hello");
+    Driver?.Move (0, 0);
+    Driver?.AddStr ("Hello");
 }
 }
 ```
 ```
 
 
@@ -723,44 +730,44 @@ The instance-based architecture dramatically improves testability:
 
 
 ```csharp
 ```csharp
 [Fact]
 [Fact]
-public void MyView_DisplaysCorrectly()
+public void MyView_DisplaysCorrectly ()
 {
 {
     // Create mock application
     // Create mock application
-    var mockApp = new Mock<IApplication>();
-    mockApp.Setup(a => a.Current).Returns(new Runnable());
+    Mock<IApplication> mockApp = new ();
+    mockApp.Setup (a => a.TopRunnable).Returns (new Runnable ());
     
     
     // Create view with mock app
     // Create view with mock app
-    var view = new MyView { App = mockApp.Object };
+    MyView view = new () { App = mockApp.Object };
     
     
     // Test without Application.Init()!
     // Test without Application.Init()!
-    view.SetNeedsDraw();
-    Assert.True(view.NeedsDraw);
+    view.SetNeedsDraw ();
+    Assert.True (view.NeedsDraw);
     
     
     // No Application.Shutdown() needed!
     // No Application.Shutdown() needed!
 }
 }
 ```
 ```
 
 
-### Testing with Real ApplicationImpl
+### Testing with Real Application
 
 
 ```csharp
 ```csharp
 [Fact]
 [Fact]
-public void MyView_WorksWithRealApplication()
+public void MyView_WorksWithRealApplication ()
 {
 {
-    using var app = Application.Create ();
-    app.Init("fake");
+    using IApplication app = Application.Create ();
+    app.Init ("fake");
     
     
-    var view = new MyView();
-    var top = new Window();
-    top.Add(view);
+    MyView view = new ();
+    Window top = new ();
+    top.Add (view);
     
     
-    app.Begin(top);
+    app.Begin (top);
     
     
     // View.App automatically set
     // View.App automatically set
-    Assert.NotNull(view.App);
-    Assert.Same(app, view.App);
+    Assert.NotNull (view.App);
+    Assert.Same (app, view.App);
     
     
     // Test view behavior
     // Test view behavior
-    view.DoSomething();
+    view.DoSomething ();
 }
 }
 ```
 ```
 
 
@@ -770,9 +777,9 @@ public void MyView_WorksWithRealApplication()
 
 
 ```csharp
 ```csharp
 ✅ GOOD:
 ✅ GOOD:
-public void Refresh()
+public void Refresh ()
 {
 {
-    App?.TopRunnableView?.SetNeedsDraw();
+    App?.TopRunnableView?.SetNeedsDraw ();
 }
 }
 ```
 ```
 
 
@@ -780,9 +787,9 @@ public void Refresh()
 
 
 ```csharp
 ```csharp
 ❌ AVOID:
 ❌ AVOID:
-public void Refresh()
+public void Refresh ()
 {
 {
-    Application.TopRunnableView?.SetNeedsDraw(); // Obsolete!
+    Application.TopRunnableView?.SetNeedsDraw (); // Obsolete!
 }
 }
 ```
 ```
 
 
@@ -792,7 +799,7 @@ public void Refresh()
 ✅ GOOD:
 ✅ GOOD:
 public class Service
 public class Service
 {
 {
-    public Service(IApplication app) { }
+    public Service (IApplication app) { }
 }
 }
 ```
 ```
 
 
@@ -800,15 +807,15 @@ public class Service
 
 
 ```csharp
 ```csharp
 ❌ AVOID (obsolete pattern):
 ❌ AVOID (obsolete pattern):
-public void Refresh()
+public void Refresh ()
 {
 {
-    Application.TopRunnableView?.SetNeedsDraw(); // Obsolete static access
+    Application.TopRunnableView?.SetNeedsDraw (); // Obsolete static access
 }
 }
 
 
 ✅ PREFERRED:
 ✅ PREFERRED:
-public void Refresh()
+public void Refresh ()
 {
 {
-    App?.TopRunnableView?.SetNeedsDraw(); // Use View.App property
+    App?.TopRunnableView?.SetNeedsDraw (); // Use View.App property
 }
 }
 ```
 ```
 
 
@@ -820,9 +827,9 @@ public class SpecialView : View
 {
 {
     private IApplication? _customApp;
     private IApplication? _customApp;
     
     
-    public override IApplication? GetApp()
+    public override IApplication? GetApp ()
     {
     {
-        return _customApp ?? base.GetApp();
+        return _customApp ?? base.GetApp ();
     }
     }
 }
 }
 ```
 ```
@@ -835,15 +842,15 @@ The instance-based architecture enables multiple applications:
 
 
 ```csharp
 ```csharp
 // Application 1
 // Application 1
-using var app1 = Application.Create ();
-app1.Init("windows");
-var top1 = new Window { Title = "App 1" };
+using IApplication app1 = Application.Create ();
+app1.Init ("windows");
+Window top1 = new () { Title = "App 1" };
 // ... configure top1
 // ... configure top1
 
 
 // Application 2 (different driver!)
 // Application 2 (different driver!)
-using var app2 = Application.Create ();
-app2.Init("unix");
-var top2 = new Window { Title = "App 2" };
+using IApplication app2 = Application.Create ();
+app2.Init ("unix");
+Window top2 = new () { Title = "App 2" };
 // ... configure top2
 // ... configure top2
 
 
 // Views in top1 use app1
 // Views in top1 use app1
@@ -857,14 +864,14 @@ Create views that work with any application:
 ```csharp
 ```csharp
 public class UniversalView : View
 public class UniversalView : View
 {
 {
-    public void ShowMessage(string message)
+    public void ShowMessage (string message)
     {
     {
         // Works regardless of which application context
         // Works regardless of which application context
-        var app = GetApp();
+        IApplication? app = GetApp ();
         if (app != null)
         if (app != null)
         {
         {
-            var msg = new MessageBox(message);
-            app.Begin(msg);
+            MessageBox msg = new (message);
+            app.Begin (msg);
         }
         }
     }
     }
 }
 }

+ 3 - 4
docfx/docs/drivers.md

@@ -97,7 +97,7 @@ The driver architecture employs a **multi-threaded design** for optimal responsi
 
 
 ```
 ```
 ┌─────────────────────────────────────────────┐
 ┌─────────────────────────────────────────────┐
-│         ApplicationImpl.Init()              │
+│         IApplication.Init()              │
 │  Creates MainLoopCoordinator<T> with        │
 │  Creates MainLoopCoordinator<T> with        │
 │  ComponentFactory<T>                        │
 │  ComponentFactory<T>                        │
 └────────────────┬────────────────────────────┘
 └────────────────┬────────────────────────────┘
@@ -128,7 +128,7 @@ This separation ensures that input is never lost and the UI remains responsive d
 
 
 When you call `Application.Init()`:
 When you call `Application.Init()`:
 
 
-1. **ApplicationImpl.Init()** is invoked
+1. **IApplication.Init()** is invoked
 2. Creates a `MainLoopCoordinator<T>` with the appropriate `ComponentFactory<T>`
 2. Creates a `MainLoopCoordinator<T>` with the appropriate `ComponentFactory<T>`
 3. **MainLoopCoordinator.StartAsync()** begins:
 3. **MainLoopCoordinator.StartAsync()** begins:
    - Starts the input thread which creates `IInput<T>`
    - Starts the input thread which creates `IInput<T>`
@@ -220,6 +220,5 @@ This ensures Terminal.Gui applications can be debugged directly in Visual Studio
 ## See Also
 ## See Also
 
 
 - @Terminal.Gui.Drivers - API Reference
 - @Terminal.Gui.Drivers - API Reference
-- @Terminal.Gui.App.Application - Application class
-- @Terminal.Gui.App.ApplicationImpl - Application implementation
+- @Terminal.Gui.App.IApplication - Application interface
 - @Terminal.Gui.App.MainLoopCoordinator`1 - Main loop coordination
 - @Terminal.Gui.App.MainLoopCoordinator`1 - Main loop coordination

+ 1 - 1
docfx/docs/keyboard.md

@@ -230,7 +230,7 @@ The @Terminal.Gui.App.Keyboard class implements @Terminal.Gui.App.IKeyboard and
 - **Events**: KeyDown, KeyUp events for application-level keyboard monitoring
 - **Events**: KeyDown, KeyUp events for application-level keyboard monitoring
 - **Command Implementations**: Handlers for Application-scoped commands (Quit, Suspend, Navigation, Refresh, Arrange)
 - **Command Implementations**: Handlers for Application-scoped commands (Quit, Suspend, Navigation, Refresh, Arrange)
 
 
-The @Terminal.Gui.App.ApplicationImpl class creates and manages the @Terminal.Gui.App.IKeyboard instance, setting its `IApplication` property to `this` to provide the necessary @Terminal.Gui.App.IApplication reference.
+The @Terminal.Gui.App.IApplication implementations create and manage the @Terminal.Gui.App.IKeyboard instance, setting its `IApplication` property to `this` to provide the necessary @Terminal.Gui.App.IApplication reference.
 
 
 ## Driver
 ## Driver