diff --git a/Terminal.Gui/Application/Application.cs b/Terminal.Gui/Application/Application.cs
index c885bd41b8..cc0f84e2eb 100644
--- a/Terminal.Gui/Application/Application.cs
+++ b/Terminal.Gui/Application/Application.cs
@@ -226,6 +226,10 @@ internal static void ResetState (bool ignoreDisposed = false)
SynchronizationContext.SetSynchronizationContext (null);
}
- // Only return true if the Current has changed.
+
+ ///
+ /// Adds specified idle handler function to main iteration processing. The handler function will be called
+ /// once per iteration of the main loop after other events have been handled.
+ ///
public static void AddIdle (Func func) => ApplicationImpl.Instance.AddIdle (func);
}
diff --git a/Terminal.Gui/Application/ApplicationImpl.cs b/Terminal.Gui/Application/ApplicationImpl.cs
index 6362de053b..af92ded621 100644
--- a/Terminal.Gui/Application/ApplicationImpl.cs
+++ b/Terminal.Gui/Application/ApplicationImpl.cs
@@ -3,22 +3,29 @@
namespace Terminal.Gui;
+///
+/// Original Terminal.Gui implementation of core methods.
+///
public class ApplicationImpl : IApplication
{
// Private static readonly Lazy instance of Application
- private static Lazy lazyInstance = new (() => new ApplicationImpl ());
+ private static Lazy _lazyInstance = new (() => new ApplicationImpl ());
- // Public static property to access the instance
- public static IApplication Instance => lazyInstance.Value;
+ ///
+ /// Gets the currently configured backend implementation of gateway methods.
+ /// Change to your own implementation by using (before init).
+ ///
+ public static IApplication Instance => _lazyInstance.Value;
///
/// Change the singleton implementation, should not be called except before application
- /// startup.
+ /// startup. This method lets you provide alternative implementations of core static gateway
+ /// methods of .
///
///
public static void ChangeInstance (IApplication newApplication)
{
- lazyInstance = new Lazy (newApplication);
+ _lazyInstance = new Lazy (newApplication);
}
///
diff --git a/Terminal.Gui/Application/IApplication.cs b/Terminal.Gui/Application/IApplication.cs
index 1fc2b9c350..2383a12c44 100644
--- a/Terminal.Gui/Application/IApplication.cs
+++ b/Terminal.Gui/Application/IApplication.cs
@@ -152,7 +152,30 @@ public T Run (Func? errorHandler = null, IConsoleDriver? dri
void Invoke (Action action);
bool IsLegacy { get; }
+
+ ///
+ /// Adds specified idle handler function to main iteration processing. The handler function will be called
+ /// once per iteration of the main loop after other events have been handled.
+ ///
void AddIdle (Func func);
+
+ /// Adds a timeout to the application.
+ ///
+ /// When time specified passes, the callback will be invoked. If the callback returns true, the timeout will be
+ /// reset, repeating the invocation. If it returns false, the timeout will stop and be removed. The returned value is a
+ /// token that can be used to stop the timeout by calling .
+ ///
object AddTimeout (TimeSpan time, Func callback);
+
+ /// Removes a previously scheduled timeout
+ /// The token parameter is the value returned by .
+ ///
+ /// true
+ /// if the timeout is successfully removed; otherwise,
+ /// false
+ /// .
+ /// This method also returns
+ /// false
+ /// if the timeout is not found.
bool RemoveTimeout (object token);
}
\ No newline at end of file
diff --git a/Terminal.Gui/Application/MainLoop.cs b/Terminal.Gui/Application/MainLoop.cs
index 7eb9197a74..0081cadd5b 100644
--- a/Terminal.Gui/Application/MainLoop.cs
+++ b/Terminal.Gui/Application/MainLoop.cs
@@ -39,6 +39,9 @@ internal interface IMainLoopDriver
///
public class MainLoop : IDisposable
{
+ ///
+ /// Gets the class responsible for handling idles and timeouts
+ ///
public ITimedEvents TimedEvents { get; } = new TimedEvents();
/// Creates a new MainLoop.
@@ -77,13 +80,13 @@ public void Dispose ()
/// once per iteration of the main loop after other events have been handled.
///
///
- /// Remove an idle handler by calling with the token this method returns.
+ /// Remove an idle handler by calling with the token this method returns.
///
/// If the returns it will be removed and not called
/// subsequently.
///
///
- /// Token that can be used to remove the idle handler with .
+ /// Token that can be used to remove the idle handler with .
// QUESTION: Why are we re-inventing the event wheel here?
// PERF: This is heavy.
// CONCURRENCY: Race conditions exist here.
diff --git a/Terminal.Gui/Application/TimeoutEventArgs.cs b/Terminal.Gui/Application/TimeoutEventArgs.cs
index 6a2ca70674..2e01228c19 100644
--- a/Terminal.Gui/Application/TimeoutEventArgs.cs
+++ b/Terminal.Gui/Application/TimeoutEventArgs.cs
@@ -1,6 +1,6 @@
namespace Terminal.Gui;
-/// for timeout events (e.g. )
+/// for timeout events (e.g. )
public class TimeoutEventArgs : EventArgs
{
/// Creates a new instance of the class.
diff --git a/Terminal.Gui/ConsoleDrivers/AnsiResponseParser/AnsiRequestScheduler.cs b/Terminal.Gui/ConsoleDrivers/AnsiResponseParser/AnsiRequestScheduler.cs
index d2a7841c44..6ef0bed588 100644
--- a/Terminal.Gui/ConsoleDrivers/AnsiResponseParser/AnsiRequestScheduler.cs
+++ b/Terminal.Gui/ConsoleDrivers/AnsiResponseParser/AnsiRequestScheduler.cs
@@ -68,7 +68,7 @@ public AnsiRequestScheduler (IAnsiResponseParser parser, Func? now = n
///
/// Sends the immediately or queues it if there is already
- /// an outstanding request for the given .
+ /// an outstanding request for the given .
///
///
/// if request was sent immediately. if it was queued.
diff --git a/Terminal.Gui/ConsoleDrivers/IConsoleDriver.cs b/Terminal.Gui/ConsoleDrivers/IConsoleDriver.cs
index 7bc1d3638e..a661b84393 100644
--- a/Terminal.Gui/ConsoleDrivers/IConsoleDriver.cs
+++ b/Terminal.Gui/ConsoleDrivers/IConsoleDriver.cs
@@ -34,8 +34,7 @@ public interface IConsoleDriver
// BUGBUG: This should not be publicly settable.
///
- /// Gets or sets the contents of the application output. The driver outputs this buffer to the terminal when
- /// is called.
+ /// Gets or sets the contents of the application output. The driver outputs this buffer to the terminal.
/// The format of the array is rows, columns. The first index is the row, the second index is the column.
///
Cell [,]? Contents { get; set; }
diff --git a/Terminal.Gui/ConsoleDrivers/V2/ConsoleDriverFacade.cs b/Terminal.Gui/ConsoleDrivers/V2/ConsoleDriverFacade.cs
index bba097983c..8cdbbbaded 100644
--- a/Terminal.Gui/ConsoleDrivers/V2/ConsoleDriverFacade.cs
+++ b/Terminal.Gui/ConsoleDrivers/V2/ConsoleDriverFacade.cs
@@ -80,8 +80,7 @@ public int Cols
}
///
- /// The contents of the application output. The driver outputs this buffer to the terminal when
- /// is called.
+ /// The contents of the application output. The driver outputs this buffer to the terminal.
/// The format of the array is rows, columns. The first index is the row, the second index is the column.
///
public Cell [,] Contents