浏览代码

Incorporated feedback

Tig 1 年之前
父节点
当前提交
710bd7f371

+ 4 - 2
Terminal.Gui/Application/Application.cs

@@ -352,13 +352,15 @@ public static partial class Application
         InitializedChanged?.Invoke (null, new (in _initialized));
         InitializedChanged?.Invoke (null, new (in _initialized));
     }
     }
 
 
+#nullable enable
     /// <summary>
     /// <summary>
-    ///     This event is fired after the <see cref="Init"/> and <see cref="Shutdown"/> methods have been called.
+    ///     This event is raised after the <see cref="Init"/> and <see cref="Shutdown"/> methods have been called.
     /// </summary>
     /// </summary>
     /// <remarks>
     /// <remarks>
     ///     Intended to support unit tests that need to know when the application has been initialized.
     ///     Intended to support unit tests that need to know when the application has been initialized.
     /// </remarks>
     /// </remarks>
-    public static event EventHandler<EventArgs<bool>> InitializedChanged;
+    public static event EventHandler<EventArgs<bool>>? InitializedChanged;
+#nullable restore
 
 
     #endregion Initialization (Init/Shutdown)
     #endregion Initialization (Init/Shutdown)
 
 

+ 3 - 3
Terminal.Gui/View/View.cs

@@ -147,12 +147,12 @@ public partial class View : Responder, ISupportInitializeNotification
     }
     }
 
 
     /// <summary>
     /// <summary>
-    ///     Called when the <see cref="Command.Accept"/> command is invoked. Fires the <see cref="Accept"/>
+    ///     Called when the <see cref="Command.Accept"/> command is invoked. Raises <see cref="Accept"/>
     ///     event.
     ///     event.
     /// </summary>
     /// </summary>
     /// <returns>
     /// <returns>
-    ///     If <see langword="true"/> the event was canceled. If <see langword="false"/> the event was fired but not canceled.
-    ///     If <see langword="null"/> no event was fired.
+    ///     If <see langword="true"/> the event was canceled. If <see langword="false"/> the event was raised but not canceled.
+    ///     If <see langword="null"/> no event was raised.
     /// </returns>
     /// </returns>
     protected bool? OnAccept ()
     protected bool? OnAccept ()
     {
     {

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

@@ -422,7 +422,7 @@ public class ComboBox : View
 
 
             if (SelectedItem > -1 && _listview.Source?.Count > 0)
             if (SelectedItem > -1 && _listview.Source?.Count > 0)
             {
             {
-                Text = _listview.Source.ToList () [SelectedItem].ToString ();
+                Text = _listview.Source.ToList () [SelectedItem]?.ToString ();
             }
             }
         }
         }
         else if (!ReadOnly)
         else if (!ReadOnly)

+ 2 - 2
Terminal.Gui/Views/RadioGroup.cs

@@ -84,7 +84,7 @@ public class RadioGroup : View
                     {
                     {
                         SelectedItem = _cursor;
                         SelectedItem = _cursor;
 
 
-                        return OnAccept () != false;
+                        return OnAccept () is true or null;
                     }
                     }
                    );
                    );
 
 
@@ -97,7 +97,7 @@ public class RadioGroup : View
                         {
                         {
                             SelectedItem = (int)ctx.KeyBinding?.Context!;
                             SelectedItem = (int)ctx.KeyBinding?.Context!;
 
 
-                            return OnAccept () != false;
+                            return OnAccept () is true or null;
                         }
                         }
 
 
                         return true;
                         return true;