mirror of
https://github.com/bitwarden/mobile
synced 2025-12-27 05:33:23 +00:00
27 lines
733 B
C#
27 lines
733 B
C#
using System;
|
|
using Xamarin.Forms;
|
|
|
|
namespace Bit.App.Controls
|
|
{
|
|
public class DismissModalToolBarItem : ToolbarItem
|
|
{
|
|
private readonly ContentPage _page;
|
|
private readonly Action _cancelClickedAction;
|
|
|
|
public DismissModalToolBarItem(ContentPage page, string text = null, Action cancelClickedAction = null)
|
|
{
|
|
_cancelClickedAction = cancelClickedAction;
|
|
_page = page;
|
|
Text = text ?? "Close";
|
|
Clicked += ClickedItem;
|
|
Priority = -1;
|
|
}
|
|
|
|
private async void ClickedItem(object sender, EventArgs e)
|
|
{
|
|
_cancelClickedAction?.Invoke();
|
|
await _page.Navigation.PopModalAsync();
|
|
}
|
|
}
|
|
}
|