mirror of
https://github.com/bitwarden/android.git
synced 2024-11-01 15:45:42 +03:00
26 lines
733 B
C#
26 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();
|
|
}
|
|
}
|
|
}
|