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:
@@ -78,7 +78,7 @@ public class AnimationScenario : Scenario
|
||||
if (!f.Exists)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ public class ConfigurationEditor : Scenario
|
||||
continue;
|
||||
}
|
||||
|
||||
int? result = MessageBox.Query (editor?.App,
|
||||
int? result = MessageBox.Query (editor?.App!,
|
||||
"Save Changes",
|
||||
$"Save changes to {editor?.FileInfo!.Name}",
|
||||
"_Yes",
|
||||
|
||||
@@ -129,7 +129,7 @@ public class ContextMenus : Scenario
|
||||
{
|
||||
Title = "_Configuration...",
|
||||
HelpText = "Show configuration",
|
||||
Action = () => MessageBox.Query (app,
|
||||
Action = () => MessageBox.Query (app!,
|
||||
50,
|
||||
10,
|
||||
"Configuration",
|
||||
@@ -147,7 +147,7 @@ public class ContextMenus : Scenario
|
||||
Title = "_Setup...",
|
||||
HelpText = "Perform setup",
|
||||
Action = () => MessageBox
|
||||
.Query (app,
|
||||
.Query (app!,
|
||||
50,
|
||||
10,
|
||||
"Setup",
|
||||
@@ -161,7 +161,7 @@ public class ContextMenus : Scenario
|
||||
Title = "_Maintenance...",
|
||||
HelpText = "Maintenance mode",
|
||||
Action = () => MessageBox
|
||||
.Query (app,
|
||||
.Query (app!,
|
||||
50,
|
||||
10,
|
||||
"Maintenance",
|
||||
|
||||
@@ -160,7 +160,7 @@ public class DimEditor : EditorBase
|
||||
}
|
||||
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)
|
||||
{
|
||||
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);
|
||||
Application.Popover.Register (ContextMenu);
|
||||
Application.Popover?.Register (ContextMenu);
|
||||
|
||||
ContextMenu.Visible = false;
|
||||
|
||||
|
||||
@@ -566,6 +566,6 @@ public class Shortcuts : Scenario
|
||||
{
|
||||
e.Handled = true;
|
||||
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 ()
|
||||
{
|
||||
int? n = MessageBox.Query (App,
|
||||
int? n = MessageBox.Query (App!,
|
||||
50,
|
||||
7,
|
||||
"Close Window.",
|
||||
|
||||
@@ -1032,7 +1032,7 @@ public class TableEditor : Scenario
|
||||
}
|
||||
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 ();
|
||||
@@ -1171,7 +1171,7 @@ public class TableEditor : Scenario
|
||||
}
|
||||
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;
|
||||
@@ -1235,7 +1235,7 @@ public class TableEditor : Scenario
|
||||
}
|
||||
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 ();
|
||||
|
||||
@@ -47,7 +47,7 @@ public sealed class Transparent : Scenario
|
||||
};
|
||||
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;
|
||||
};
|
||||
appWindow.Add (appButton);
|
||||
@@ -112,7 +112,7 @@ public sealed class Transparent : Scenario
|
||||
};
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ public sealed class WideGlyphs : Scenario
|
||||
};
|
||||
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);
|
||||
|
||||
|
||||
@@ -83,13 +83,13 @@ public class WizardAsView : Scenario
|
||||
wizard.Finished += (s, args) =>
|
||||
{
|
||||
//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 ();
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
if (btn == 0)
|
||||
@@ -126,7 +126,7 @@ public class WizardAsView : Scenario
|
||||
{
|
||||
secondStep.Title = "2nd Step";
|
||||
|
||||
MessageBox.Query ((s as View)?.App,
|
||||
MessageBox.Query ((s as View)?.App!,
|
||||
"Wizard Scenario",
|
||||
"This Wizard Step's title was changed to '2nd Step'",
|
||||
"Ok"
|
||||
|
||||
Reference in New Issue
Block a user