mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Fixes build warnings recently introduced (#4506)
* Fixed warnings I recently introduced. Replaced nullable App references with null-forgiving operator (!) in MessageBox and dialog calls to suppress nullable warnings. Updated XML docs to use Dim.Fill() and clarified method references. Made Application.Popover registration null-safe. Fixed test output helper usage in ShadowTests. No functional changes. * Fixes Release build warnings
This commit is contained in:
@@ -101,13 +101,13 @@ public class ExampleWindow : Window
|
|||||||
{
|
{
|
||||||
if (userNameText.Text == "admin" && passwordText.Text == "password")
|
if (userNameText.Text == "admin" && passwordText.Text == "password")
|
||||||
{
|
{
|
||||||
MessageBox.Query (App, "Logging In", "Login Successful", "Ok");
|
MessageBox.Query (App!, "Logging In", "Login Successful", "Ok");
|
||||||
UserName = userNameText.Text;
|
UserName = userNameText.Text;
|
||||||
Application.RequestStop ();
|
Application.RequestStop ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox.ErrorQuery (App, "Logging In", "Incorrect username or password", "Ok");
|
MessageBox.ErrorQuery (App!, "Logging In", "Incorrect username or password", "Ok");
|
||||||
}
|
}
|
||||||
// Anytime Accepting is handled, make sure to set e.Handled to true.
|
// Anytime Accepting is handled, make sure to set e.Handled to true.
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
|
|||||||
@@ -100,13 +100,13 @@ public class ExampleWindow : Runnable<string>
|
|||||||
{
|
{
|
||||||
if (userNameText.Text == "admin" && passwordText.Text == "password")
|
if (userNameText.Text == "admin" && passwordText.Text == "password")
|
||||||
{
|
{
|
||||||
MessageBox.Query (App, "Logging In", "Login Successful", "Ok");
|
MessageBox.Query (App!, "Logging In", "Login Successful", "Ok");
|
||||||
Result = userNameText.Text;
|
Result = userNameText.Text;
|
||||||
App?.RequestStop ();
|
App?.RequestStop ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox.ErrorQuery (App, "Logging In", "Incorrect username or password", "Ok");
|
MessageBox.ErrorQuery (App!, "Logging In", "Incorrect username or password", "Ok");
|
||||||
}
|
}
|
||||||
// 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;
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public class AnimationScenario : Scenario
|
|||||||
if (!f.Exists)
|
if (!f.Exists)
|
||||||
{
|
{
|
||||||
Debug.WriteLine ($"Could not find {f.FullName}");
|
Debug.WriteLine ($"Could not find {f.FullName}");
|
||||||
MessageBox.ErrorQuery (_imageView?.App, "Could not find gif", $"Could not find\n{f.FullName}", "Ok");
|
MessageBox.ErrorQuery (_imageView?.App!, "Could not find gif", $"Could not find\n{f.FullName}", "Ok");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ public class ConfigurationEditor : Scenario
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int? result = MessageBox.Query (editor?.App,
|
int? result = MessageBox.Query (editor?.App!,
|
||||||
"Save Changes",
|
"Save Changes",
|
||||||
$"Save changes to {editor?.FileInfo!.Name}",
|
$"Save changes to {editor?.FileInfo!.Name}",
|
||||||
"_Yes",
|
"_Yes",
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ public class ContextMenus : Scenario
|
|||||||
{
|
{
|
||||||
Title = "_Configuration...",
|
Title = "_Configuration...",
|
||||||
HelpText = "Show configuration",
|
HelpText = "Show configuration",
|
||||||
Action = () => MessageBox.Query (app,
|
Action = () => MessageBox.Query (app!,
|
||||||
50,
|
50,
|
||||||
10,
|
10,
|
||||||
"Configuration",
|
"Configuration",
|
||||||
@@ -147,7 +147,7 @@ public class ContextMenus : Scenario
|
|||||||
Title = "_Setup...",
|
Title = "_Setup...",
|
||||||
HelpText = "Perform setup",
|
HelpText = "Perform setup",
|
||||||
Action = () => MessageBox
|
Action = () => MessageBox
|
||||||
.Query (app,
|
.Query (app!,
|
||||||
50,
|
50,
|
||||||
10,
|
10,
|
||||||
"Setup",
|
"Setup",
|
||||||
@@ -161,7 +161,7 @@ public class ContextMenus : Scenario
|
|||||||
Title = "_Maintenance...",
|
Title = "_Maintenance...",
|
||||||
HelpText = "Maintenance mode",
|
HelpText = "Maintenance mode",
|
||||||
Action = () => MessageBox
|
Action = () => MessageBox
|
||||||
.Query (app,
|
.Query (app!,
|
||||||
50,
|
50,
|
||||||
10,
|
10,
|
||||||
"Maintenance",
|
"Maintenance",
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ public class DimEditor : EditorBase
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
MessageBox.ErrorQuery (App, "Exception", e.Message, "Ok");
|
MessageBox.ErrorQuery (App!, "Exception", e.Message, "Ok");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ public class PosEditor : EditorBase
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
MessageBox.ErrorQuery (App, "Exception", e.Message, "Ok");
|
MessageBox.ErrorQuery (App!, "Exception", e.Message, "Ok");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -347,7 +347,7 @@ public class Menus : Scenario
|
|||||||
};
|
};
|
||||||
|
|
||||||
ContextMenu.EnableForDesign (ref host);
|
ContextMenu.EnableForDesign (ref host);
|
||||||
Application.Popover.Register (ContextMenu);
|
Application.Popover?.Register (ContextMenu);
|
||||||
|
|
||||||
ContextMenu.Visible = false;
|
ContextMenu.Visible = false;
|
||||||
|
|
||||||
|
|||||||
@@ -566,6 +566,6 @@ public class Shortcuts : Scenario
|
|||||||
{
|
{
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
var view = sender as View;
|
var view = sender as View;
|
||||||
MessageBox.Query ((sender as View)?.App, "Hi", $"You clicked {view?.Text}", "_Ok");
|
MessageBox.Query ((sender as View)?.App!, "Hi", $"You clicked {view?.Text}", "_Ok");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ public class SingleBackgroundWorker : Scenario
|
|||||||
|
|
||||||
bool Close ()
|
bool Close ()
|
||||||
{
|
{
|
||||||
int? n = MessageBox.Query (App,
|
int? n = MessageBox.Query (App!,
|
||||||
50,
|
50,
|
||||||
7,
|
7,
|
||||||
"Close Window.",
|
"Close Window.",
|
||||||
|
|||||||
@@ -1032,7 +1032,7 @@ public class TableEditor : Scenario
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.ErrorQuery ((sender as View)?.App, 60, 20, "Failed to set text", ex.Message, "Ok");
|
MessageBox.ErrorQuery ((sender as View)?.App!, 60, 20, "Failed to set text", ex.Message, "Ok");
|
||||||
}
|
}
|
||||||
|
|
||||||
_tableView!.Update ();
|
_tableView!.Update ();
|
||||||
@@ -1171,7 +1171,7 @@ public class TableEditor : Scenario
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
MessageBox.ErrorQuery (_tableView?.App, "Could not find local drives", e.Message, "Ok");
|
MessageBox.ErrorQuery (_tableView?.App!, "Could not find local drives", e.Message, "Ok");
|
||||||
}
|
}
|
||||||
|
|
||||||
_tableView!.Table = source;
|
_tableView!.Table = source;
|
||||||
@@ -1235,7 +1235,7 @@ public class TableEditor : Scenario
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.ErrorQuery (_tableView.App, 60, 20, "Failed to set", ex.Message, "Ok");
|
MessageBox.ErrorQuery (_tableView.App!, 60, 20, "Failed to set", ex.Message, "Ok");
|
||||||
}
|
}
|
||||||
|
|
||||||
_tableView!.Update ();
|
_tableView!.Update ();
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public sealed class Transparent : Scenario
|
|||||||
};
|
};
|
||||||
appButton.Accepting += (sender, args) =>
|
appButton.Accepting += (sender, args) =>
|
||||||
{
|
{
|
||||||
MessageBox.Query ((sender as View)?.App, "AppButton", "Transparency is cool!", "_Ok");
|
MessageBox.Query ((sender as View)?.App!, "AppButton", "Transparency is cool!", "_Ok");
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
};
|
};
|
||||||
appWindow.Add (appButton);
|
appWindow.Add (appButton);
|
||||||
@@ -112,7 +112,7 @@ public sealed class Transparent : Scenario
|
|||||||
};
|
};
|
||||||
button.Accepting += (sender, args) =>
|
button.Accepting += (sender, args) =>
|
||||||
{
|
{
|
||||||
MessageBox.Query (App, "Clicked!", "Button in Transparent View", "_Ok");
|
MessageBox.Query (App!, "Clicked!", "Button in Transparent View", "_Ok");
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ public sealed class WideGlyphs : Scenario
|
|||||||
};
|
};
|
||||||
arrangeableViewAtOdd.Accepting += (sender, args) =>
|
arrangeableViewAtOdd.Accepting += (sender, args) =>
|
||||||
{
|
{
|
||||||
MessageBox.Query ((sender as View)?.App, "Button Pressed", "You Pressed it!");
|
MessageBox.Query ((sender as View)?.App!, "Button Pressed", "You Pressed it!");
|
||||||
};
|
};
|
||||||
appWindow.Add (arrangeableViewAtOdd);
|
appWindow.Add (arrangeableViewAtOdd);
|
||||||
|
|
||||||
|
|||||||
@@ -83,13 +83,13 @@ public class WizardAsView : Scenario
|
|||||||
wizard.Finished += (s, args) =>
|
wizard.Finished += (s, args) =>
|
||||||
{
|
{
|
||||||
//args.Cancel = true;
|
//args.Cancel = true;
|
||||||
MessageBox.Query ((s as View)?.App, "Setup Wizard", "Finished", "Ok");
|
MessageBox.Query ((s as View)?.App!, "Setup Wizard", "Finished", "Ok");
|
||||||
Application.RequestStop ();
|
Application.RequestStop ();
|
||||||
};
|
};
|
||||||
|
|
||||||
wizard.Cancelled += (s, args) =>
|
wizard.Cancelled += (s, args) =>
|
||||||
{
|
{
|
||||||
int? btn = MessageBox.Query ((s as View)?.App, "Setup Wizard", "Are you sure you want to cancel?", "Yes", "No");
|
int? btn = MessageBox.Query ((s as View)?.App!, "Setup Wizard", "Are you sure you want to cancel?", "Yes", "No");
|
||||||
args.Cancel = btn == 1;
|
args.Cancel = btn == 1;
|
||||||
|
|
||||||
if (btn == 0)
|
if (btn == 0)
|
||||||
@@ -126,7 +126,7 @@ public class WizardAsView : Scenario
|
|||||||
{
|
{
|
||||||
secondStep.Title = "2nd Step";
|
secondStep.Title = "2nd Step";
|
||||||
|
|
||||||
MessageBox.Query ((s as View)?.App,
|
MessageBox.Query ((s as View)?.App!,
|
||||||
"Wizard Scenario",
|
"Wizard Scenario",
|
||||||
"This Wizard Step's title was changed to '2nd Step'",
|
"This Wizard Step's title was changed to '2nd Step'",
|
||||||
"Ok"
|
"Ok"
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ using System.Diagnostics;
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Reflection.Metadata;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
@@ -57,8 +56,9 @@ public class UICatalog
|
|||||||
{
|
{
|
||||||
private static string? _forceDriver;
|
private static string? _forceDriver;
|
||||||
private static string? _uiCatalogDriver;
|
private static string? _uiCatalogDriver;
|
||||||
|
#if DEBUG_IDISPOSABLE
|
||||||
private static string? _scenarioDriver;
|
private static string? _scenarioDriver;
|
||||||
|
#endif
|
||||||
public static string LogFilePath { get; set; } = string.Empty;
|
public static string LogFilePath { get; set; } = string.Empty;
|
||||||
public static LoggingLevelSwitch LogLevelSwitch { get; } = new ();
|
public static LoggingLevelSwitch LogLevelSwitch { get; } = new ();
|
||||||
public const string LOGFILE_LOCATION = "logs";
|
public const string LOGFILE_LOCATION = "logs";
|
||||||
@@ -90,13 +90,14 @@ public class UICatalog
|
|||||||
|
|
||||||
// Add validator separately (not chained)
|
// Add validator separately (not chained)
|
||||||
driverOption.AddValidator (result =>
|
driverOption.AddValidator (result =>
|
||||||
{
|
{
|
||||||
var value = result.GetValueOrDefault<string> ();
|
var value = result.GetValueOrDefault<string> ();
|
||||||
if (result.Tokens.Count > 0 && !allowedDrivers.Contains (value))
|
|
||||||
{
|
if (result.Tokens.Count > 0 && !allowedDrivers.Contains (value))
|
||||||
result.ErrorMessage = $"Invalid driver name '{value}'. Allowed values: {string.Join (", ", allowedDrivers)}";
|
{
|
||||||
}
|
result.ErrorMessage = $"Invalid driver name '{value}'. Allowed values: {string.Join (", ", allowedDrivers)}";
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Configuration Management
|
// Configuration Management
|
||||||
Option<bool> disableConfigManagement = new (
|
Option<bool> disableConfigManagement = new (
|
||||||
@@ -137,8 +138,8 @@ public class UICatalog
|
|||||||
getDefaultValue: () => "none"
|
getDefaultValue: () => "none"
|
||||||
).FromAmong (
|
).FromAmong (
|
||||||
UICatalogRunnable.CachedScenarios.Select (s => s.GetName ())
|
UICatalogRunnable.CachedScenarios.Select (s => s.GetName ())
|
||||||
.Append ("none")
|
.Append ("none")
|
||||||
.ToArray ()
|
.ToArray ()
|
||||||
);
|
);
|
||||||
|
|
||||||
var rootCommand = new RootCommand ("A comprehensive sample library and test app for Terminal.Gui")
|
var rootCommand = new RootCommand ("A comprehensive sample library and test app for Terminal.Gui")
|
||||||
@@ -146,8 +147,7 @@ public class UICatalog
|
|||||||
scenarioArgument, debugLogLevel, benchmarkFlag, benchmarkTimeout, resultsFile, driverOption, disableConfigManagement
|
scenarioArgument, debugLogLevel, benchmarkFlag, benchmarkTimeout, resultsFile, driverOption, disableConfigManagement
|
||||||
};
|
};
|
||||||
|
|
||||||
rootCommand.SetHandler (
|
rootCommand.SetHandler (context =>
|
||||||
context =>
|
|
||||||
{
|
{
|
||||||
var options = new UICatalogCommandLineOptions
|
var options = new UICatalogCommandLineOptions
|
||||||
{
|
{
|
||||||
@@ -179,14 +179,15 @@ public class UICatalog
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
var parseResult = parser.Parse (args);
|
ParseResult parseResult = parser.Parse (args);
|
||||||
|
|
||||||
if (parseResult.Errors.Count > 0)
|
if (parseResult.Errors.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (var error in parseResult.Errors)
|
foreach (ParseError error in parseResult.Errors)
|
||||||
{
|
{
|
||||||
Console.Error.WriteLine (error.Message);
|
Console.Error.WriteLine (error.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1; // Non-zero exit code for error
|
return 1; // Non-zero exit code for error
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,16 +205,16 @@ public class UICatalog
|
|||||||
public static LogEventLevel LogLevelToLogEventLevel (LogLevel logLevel)
|
public static LogEventLevel LogLevelToLogEventLevel (LogLevel logLevel)
|
||||||
{
|
{
|
||||||
return logLevel switch
|
return logLevel switch
|
||||||
{
|
{
|
||||||
LogLevel.Trace => LogEventLevel.Verbose,
|
LogLevel.Trace => LogEventLevel.Verbose,
|
||||||
LogLevel.Debug => LogEventLevel.Debug,
|
LogLevel.Debug => LogEventLevel.Debug,
|
||||||
LogLevel.Information => LogEventLevel.Information,
|
LogLevel.Information => LogEventLevel.Information,
|
||||||
LogLevel.Warning => LogEventLevel.Warning,
|
LogLevel.Warning => LogEventLevel.Warning,
|
||||||
LogLevel.Error => LogEventLevel.Error,
|
LogLevel.Error => LogEventLevel.Error,
|
||||||
LogLevel.Critical => LogEventLevel.Fatal,
|
LogLevel.Critical => LogEventLevel.Fatal,
|
||||||
LogLevel.None => LogEventLevel.Fatal, // Default to Fatal if None is specified
|
LogLevel.None => LogEventLevel.Fatal, // Default to Fatal if None is specified
|
||||||
_ => LogEventLevel.Fatal // Default to Information for any unspecified LogLevel
|
_ => LogEventLevel.Fatal // Default to Information for any unspecified LogLevel
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ILogger CreateLogger ()
|
private static ILogger CreateLogger ()
|
||||||
@@ -232,8 +233,7 @@ public class UICatalog
|
|||||||
.CreateLogger ();
|
.CreateLogger ();
|
||||||
|
|
||||||
// Create a logger factory compatible with Microsoft.Extensions.Logging
|
// Create a logger factory compatible with Microsoft.Extensions.Logging
|
||||||
using ILoggerFactory loggerFactory = LoggerFactory.Create (
|
using ILoggerFactory loggerFactory = LoggerFactory.Create (builder =>
|
||||||
builder =>
|
|
||||||
{
|
{
|
||||||
builder
|
builder
|
||||||
.AddSerilog (dispose: true) // Integrate Serilog with ILogger
|
.AddSerilog (dispose: true) // Integrate Serilog with ILogger
|
||||||
@@ -246,7 +246,8 @@ public class UICatalog
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shows the UI Catalog selection UI. When the user selects a Scenario to run, the UI Catalog main app UI is
|
/// Shows the UI Catalog selection UI. When the user selects a Scenario to run, the UI Catalog main app UI is
|
||||||
/// killed and the Scenario is run as though it were Application.TopRunnable. When the Scenario exits, this function exits.
|
/// killed and the Scenario is run as though it were Application.TopRunnable. When the Scenario exits, this function
|
||||||
|
/// exits.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private static Scenario RunUICatalogRunnable ()
|
private static Scenario RunUICatalogRunnable ()
|
||||||
@@ -257,7 +258,7 @@ public class UICatalog
|
|||||||
// If the user specified a driver on the command line then use it,
|
// If the user specified a driver on the command line then use it,
|
||||||
// ignoring Config files.
|
// ignoring Config files.
|
||||||
|
|
||||||
Application.Init (driverName: _forceDriver);
|
Application.Init (_forceDriver);
|
||||||
|
|
||||||
_uiCatalogDriver = Application.Driver!.GetName ();
|
_uiCatalogDriver = Application.Driver!.GetName ();
|
||||||
|
|
||||||
@@ -326,10 +327,7 @@ public class UICatalog
|
|||||||
ThemeManager.ThemeChanged += ThemeManagerOnThemeChanged;
|
ThemeManager.ThemeChanged += ThemeManagerOnThemeChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ThemeManagerOnThemeChanged (object? sender, EventArgs<string> e)
|
private static void ThemeManagerOnThemeChanged (object? sender, EventArgs<string> e) { CM.Apply (); }
|
||||||
{
|
|
||||||
CM.Apply ();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void StopConfigWatcher ()
|
private static void StopConfigWatcher ()
|
||||||
{
|
{
|
||||||
@@ -372,11 +370,10 @@ public class UICatalog
|
|||||||
}
|
}
|
||||||
|
|
||||||
int item = UICatalogRunnable.CachedScenarios!.IndexOf (
|
int item = UICatalogRunnable.CachedScenarios!.IndexOf (
|
||||||
UICatalogRunnable.CachedScenarios!.FirstOrDefault (
|
UICatalogRunnable.CachedScenarios!.FirstOrDefault (s =>
|
||||||
s =>
|
s.GetName ()
|
||||||
s.GetName ()
|
.Equals (options.Scenario, StringComparison.OrdinalIgnoreCase)
|
||||||
.Equals (options.Scenario, StringComparison.OrdinalIgnoreCase)
|
)!);
|
||||||
)!);
|
|
||||||
UICatalogRunnable.CachedSelectedScenario = (Scenario)Activator.CreateInstance (UICatalogRunnable.CachedScenarios [item].GetType ())!;
|
UICatalogRunnable.CachedSelectedScenario = (Scenario)Activator.CreateInstance (UICatalogRunnable.CachedScenarios [item].GetType ())!;
|
||||||
|
|
||||||
BenchmarkResults? results = RunScenario (UICatalogRunnable.CachedSelectedScenario, options.Benchmark);
|
BenchmarkResults? results = RunScenario (UICatalogRunnable.CachedSelectedScenario, options.Benchmark);
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ public class UICatalogRunnable : Runnable
|
|||||||
"_About...",
|
"_About...",
|
||||||
"About UI Catalog",
|
"About UI Catalog",
|
||||||
() => MessageBox.Query (
|
() => MessageBox.Query (
|
||||||
App,
|
App!,
|
||||||
"",
|
"",
|
||||||
GetAboutBoxMessage (),
|
GetAboutBoxMessage (),
|
||||||
wrapMessage: false,
|
wrapMessage: false,
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace Terminal.Gui.App;
|
|||||||
/// This base class provides:
|
/// This base class provides:
|
||||||
/// </para>
|
/// </para>
|
||||||
/// <list type="bullet">
|
/// <list type="bullet">
|
||||||
/// <item>Fills the screen by default (<see cref="View.Width"/> = <see cref="Dim.Fill"/>, <see cref="View.Height"/> = <see cref="Dim.Fill"/>).</item>
|
/// <item>Fills the screen by default (<see cref="View.Width"/> = <see cref="Dim.Fill()"/>, <see cref="View.Height"/> = <see cref="Dim.Fill()"/>).</item>
|
||||||
/// <item>Transparent viewport settings for proper mouse event handling.</item>
|
/// <item>Transparent viewport settings for proper mouse event handling.</item>
|
||||||
/// <item>Automatic layout when becoming visible.</item>
|
/// <item>Automatic layout when becoming visible.</item>
|
||||||
/// <item>Focus restoration when hidden.</item>
|
/// <item>Focus restoration when hidden.</item>
|
||||||
@@ -44,7 +44,7 @@ public abstract class PopoverBaseImpl : View, IPopover
|
|||||||
/// Sets up default popover behavior:
|
/// Sets up default popover behavior:
|
||||||
/// </para>
|
/// </para>
|
||||||
/// <list type="bullet">
|
/// <list type="bullet">
|
||||||
/// <item>Fills the screen (<see cref="View.Width"/> = <see cref="Dim.Fill"/>, <see cref="View.Height"/> = <see cref="Dim.Fill"/>).</item>
|
/// <item>Fills the screen (<see cref="View.Width"/> = <see cref="Dim.Fill()"/>, <see cref="View.Height"/> = <see cref="Dim.Fill()"/>).</item>
|
||||||
/// <item>Sets <see cref="View.CanFocus"/> to <see langword="true"/>.</item>
|
/// <item>Sets <see cref="View.CanFocus"/> to <see langword="true"/>.</item>
|
||||||
/// <item>Configures <see cref="View.ViewportSettings"/> with <see cref="ViewportSettingsFlags.Transparent"/> and <see cref="ViewportSettingsFlags.TransparentMouse"/>.</item>
|
/// <item>Configures <see cref="View.ViewportSettings"/> with <see cref="ViewportSettingsFlags.Transparent"/> and <see cref="ViewportSettingsFlags.TransparentMouse"/>.</item>
|
||||||
/// <item>Adds <see cref="Command.Quit"/> bound to <see cref="Application.QuitKey"/> which hides the popover when invoked.</item>
|
/// <item>Adds <see cref="Command.Quit"/> bound to <see cref="Application.QuitKey"/> which hides the popover when invoked.</item>
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public class Margin : Adornment
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// INTERNAL API - Draws the transparent margins for the specified views. This is called from <see cref="View.Draw"/> on each
|
/// INTERNAL API - Draws the transparent margins for the specified views. This is called from <see cref="View.Draw(DrawContext)"/> on each
|
||||||
/// iteration of the main loop after all Views have been drawn.
|
/// iteration of the main loop after all Views have been drawn.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
|
|||||||
@@ -591,7 +591,7 @@ public class MenuBar : Menu, IDesignable
|
|||||||
{
|
{
|
||||||
Title = "_File Settings...",
|
Title = "_File Settings...",
|
||||||
HelpText = "More file settings",
|
HelpText = "More file settings",
|
||||||
Action = () => MessageBox.Query (App,
|
Action = () => MessageBox.Query (App!,
|
||||||
"File Settings",
|
"File Settings",
|
||||||
"This is the File Settings Dialog\n",
|
"This is the File Settings Dialog\n",
|
||||||
"_Ok",
|
"_Ok",
|
||||||
@@ -665,12 +665,12 @@ public class MenuBar : Menu, IDesignable
|
|||||||
new MenuItem
|
new MenuItem
|
||||||
{
|
{
|
||||||
Title = "_Online Help...",
|
Title = "_Online Help...",
|
||||||
Action = () => MessageBox.Query (App, "Online Help", "https://gui-cs.github.io/Terminal.Gui", "Ok")
|
Action = () => MessageBox.Query (App!, "Online Help", "https://gui-cs.github.io/Terminal.Gui", "Ok")
|
||||||
},
|
},
|
||||||
new MenuItem
|
new MenuItem
|
||||||
{
|
{
|
||||||
Title = "About...",
|
Title = "About...",
|
||||||
Action = () => MessageBox.Query (App, "About", "Something About Mary.", "Ok")
|
Action = () => MessageBox.Query (App!, "About", "Something About Mary.", "Ok")
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@@ -734,7 +734,7 @@ public class MenuBar : Menu, IDesignable
|
|||||||
{
|
{
|
||||||
Title = "_Deeper Detail",
|
Title = "_Deeper Detail",
|
||||||
Text = "Deeper Detail",
|
Text = "Deeper Detail",
|
||||||
Action = () => { MessageBox.Query (App, "Deeper Detail", "Lots of details", "_Ok"); }
|
Action = () => { MessageBox.Query (App!, "Deeper Detail", "Lots of details", "_Ok"); }
|
||||||
};
|
};
|
||||||
|
|
||||||
var belowLineDetail = new MenuItem
|
var belowLineDetail = new MenuItem
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ public class StatusBar : Bar, IDesignable
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
void OnButtonClicked (object? sender, EventArgs? e) { MessageBox.Query (App, "Hi", $"You clicked {sender}"); }
|
void OnButtonClicked (object? sender, EventArgs? e) { MessageBox.Query (App!, "Hi", $"You clicked {sender}"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -331,9 +331,12 @@ public class ApplicationPopoverTests
|
|||||||
public List<Key> HandledKeys { get; } = [];
|
public List<Key> HandledKeys { get; } = [];
|
||||||
public int NewCommandInvokeCount { get; private set; }
|
public int NewCommandInvokeCount { get; private set; }
|
||||||
|
|
||||||
|
#if DEBUG_IDISPOSABLE
|
||||||
// NOTE: Hides the base DisposedCount property
|
// NOTE: Hides the base DisposedCount property
|
||||||
public new int DisposedCount { get; private set; }
|
public new int DisposedCount { get; private set; }
|
||||||
|
#else
|
||||||
|
public int DisposedCount { get; private set; }
|
||||||
|
#endif
|
||||||
public PopoverTestClass ()
|
public PopoverTestClass ()
|
||||||
{
|
{
|
||||||
CanFocus = true;
|
CanFocus = true;
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ public class ShadowTests (ITestOutputHelper output)
|
|||||||
└──┘🍎
|
└──┘🍎
|
||||||
<EFBFBD> 🍎🍎
|
<EFBFBD> 🍎🍎
|
||||||
""",
|
""",
|
||||||
output,
|
_output,
|
||||||
app.Driver);
|
app.Driver);
|
||||||
|
|
||||||
view.Margin!.ShadowSize = new (1, 2);
|
view.Margin!.ShadowSize = new (1, 2);
|
||||||
@@ -243,7 +243,7 @@ public class ShadowTests (ITestOutputHelper output)
|
|||||||
<EFBFBD> 🍎🍎
|
<EFBFBD> 🍎🍎
|
||||||
<EFBFBD> 🍎🍎
|
<EFBFBD> 🍎🍎
|
||||||
""",
|
""",
|
||||||
output,
|
_output,
|
||||||
app.Driver);
|
app.Driver);
|
||||||
|
|
||||||
view.Width = Dim.Fill (1);
|
view.Width = Dim.Fill (1);
|
||||||
@@ -259,7 +259,7 @@ public class ShadowTests (ITestOutputHelper output)
|
|||||||
<EFBFBD> 🍎<EFBFBD>
|
<EFBFBD> 🍎<EFBFBD>
|
||||||
<EFBFBD> 🍎<EFBFBD>
|
<EFBFBD> 🍎<EFBFBD>
|
||||||
""",
|
""",
|
||||||
output,
|
_output,
|
||||||
app.Driver);
|
app.Driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,7 +282,7 @@ public class ShadowTests (ITestOutputHelper output)
|
|||||||
| Hi |▖
|
| Hi |▖
|
||||||
▝▀▀▀▀▀▘
|
▝▀▀▀▀▀▘
|
||||||
""",
|
""",
|
||||||
output,
|
_output,
|
||||||
app.Driver);
|
app.Driver);
|
||||||
|
|
||||||
app.Mouse.RaiseMouseEvent (new () { ScreenPosition = new (2, 0), Flags = MouseFlags.Button1Pressed });
|
app.Mouse.RaiseMouseEvent (new () { ScreenPosition = new (2, 0), Flags = MouseFlags.Button1Pressed });
|
||||||
@@ -292,7 +292,7 @@ public class ShadowTests (ITestOutputHelper output)
|
|||||||
"""
|
"""
|
||||||
| Hi |
|
| Hi |
|
||||||
""",
|
""",
|
||||||
output,
|
_output,
|
||||||
app.Driver);
|
app.Driver);
|
||||||
|
|
||||||
app.Mouse.RaiseMouseEvent (new () { ScreenPosition = new (2, 0), Flags = MouseFlags.Button1Released });
|
app.Mouse.RaiseMouseEvent (new () { ScreenPosition = new (2, 0), Flags = MouseFlags.Button1Released });
|
||||||
@@ -303,7 +303,7 @@ public class ShadowTests (ITestOutputHelper output)
|
|||||||
| Hi |▖
|
| Hi |▖
|
||||||
▝▀▀▀▀▀▘
|
▝▀▀▀▀▀▘
|
||||||
""",
|
""",
|
||||||
output,
|
_output,
|
||||||
app.Driver);
|
app.Driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -457,7 +457,7 @@ public class ShadowTests (ITestOutputHelper output)
|
|||||||
🍎🍎🍎🍎🍎
|
🍎🍎🍎🍎🍎
|
||||||
🍎🍎🍎🍎🍎
|
🍎🍎🍎🍎🍎
|
||||||
""",
|
""",
|
||||||
output,
|
_output,
|
||||||
app.Driver);
|
app.Driver);
|
||||||
|
|
||||||
Runnable modalSuperview = new () { Y = 1, Width = Dim.Fill (), Height = 4, BorderStyle = LineStyle.Single };
|
Runnable modalSuperview = new () { Y = 1, Width = Dim.Fill (), Height = 4, BorderStyle = LineStyle.Single };
|
||||||
@@ -476,7 +476,7 @@ public class ShadowTests (ITestOutputHelper output)
|
|||||||
│▝▀▀▀▀▀▀▘│
|
│▝▀▀▀▀▀▀▘│
|
||||||
└────────┘
|
└────────┘
|
||||||
""",
|
""",
|
||||||
output,
|
_output,
|
||||||
app.Driver);
|
app.Driver);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user