using System; using Terminal.Gui; namespace ReactiveExample; public static class ViewExtensions { public static (Window MainView, TOut LastControl) AddControl (this Window view, Action action) where TOut : View, new() { TOut result = new (); action (result); view.Add (result); return (view, result); } public static (Window MainView, TOut LastControl) AddControlAfter (this (Window MainView, View LastControl) view, Action action) where TOut : View, new() { TOut result = new (); action (view.LastControl, result); view.MainView.Add (result); return (view.MainView, result); } }