mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
* touching publish.yml * Moved Examples into ./Examples * Moved Benchmarks into ./Tests * Moved Benchmarks into ./Tests * Moved UICatalog into ./Examples * Moved UICatalog into ./Examples 2 * Moved tests into ./Tests * Updated nuget
25 lines
719 B
C#
25 lines
719 B
C#
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);
|
|
}
|
|
}
|