浏览代码

Add documentation on ISupportInitialize/ISupportInitializeNotification (#286)

Daniel Cazzulino 5 年之前
父节点
当前提交
20d87ae815
共有 1 个文件被更改,包括 13 次插入0 次删除
  1. 13 0
      Terminal.Gui/Core.cs

+ 13 - 0
Terminal.Gui/Core.cs

@@ -1283,6 +1283,19 @@ namespace Terminal.Gui {
 	///     toplevel and then invoke <see cref="M:Terminal.Gui.Application.Run"/> with the
 	///     new toplevel.
 	///   </para>
+	///   <para>
+	///     TopLevels can also opt-in to more sophisticated initialization 
+	///     by implementing <see cref="ISupportInitialize"/>. When they do 
+	///     so, the <see cref="ISupportInitialize.BeginInit"/> and 
+	///     <see cref="ISupportInitialize.EndInit"/> methods will be called 
+	///     before running the view.
+	///     If first-run-only initialization is preferred, the <see cref="ISupportInitializeNotification"/> 
+	///     can be implemented too, in which case the <see cref="ISupportInitialize"/> 
+	///     methods will only be called if <see cref="ISupportInitializeNotification.IsInitialized"/> 
+	///     is <see langword="false"/>. This allows proper View inheritance hierarchies 
+	///     to override base class layout code optimally by doing so only on first run, 
+	///     instead of on every run.
+	///   </para>
 	/// </remarks>
 	public class Toplevel : View {
 		/// <summary>