-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplicationPopoverExtensions.cs
More file actions
34 lines (31 loc) · 1.45 KB
/
Copy pathApplicationPopoverExtensions.cs
File metadata and controls
34 lines (31 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using Terminal.Gui.App;
namespace TerminalGui.Extensions.Extensions;
/// <summary>
/// Extension methods for <see cref="ApplicationPopover" />.
/// </summary>
public static class ApplicationPopoverExtensions
{
extension(ApplicationPopover popover)
{
/// <summary>
/// Subscribes to the <see cref="ApplicationPopover.PopoverRegistered" /> event.
/// </summary>
/// <param name="callback">The callback to invoke with the <see cref="EventArgs{T}" /> containing the registered <see cref="IPopoverView" />.</param>
/// <returns>The <see cref="ApplicationPopover" /> instance.</returns>
public ApplicationPopover OnPopoverRegistered(Action<EventArgs<IPopoverView>> callback)
{
popover.PopoverRegistered += (_, e) => callback(e);
return popover;
}
/// <summary>
/// Subscribes to the <see cref="ApplicationPopover.PopoverDeRegistered" /> event.
/// </summary>
/// <param name="callback">The callback to invoke with the <see cref="EventArgs{T}" /> containing the de-registered <see cref="IPopoverView" />.</param>
/// <returns>The <see cref="ApplicationPopover" /> instance.</returns>
public ApplicationPopover OnPopoverUnregistered(Action<EventArgs<IPopoverView>> callback)
{
popover.PopoverDeRegistered += (_, e) => callback(e);
return popover;
}
}
}