Update ReactiveUI Example

This commit is contained in:
Chris Pulman
2024-07-28 12:23:09 +01:00
parent e90213a126
commit a225b421c8
7 changed files with 188 additions and 246 deletions

View File

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