bitwarden-android/src/App/Controls/DismissModalToolBarItem.cs
2017-02-17 00:16:09 -05:00

27 lines
774 B
C#

using Bit.App.Resources;
using System;
using Xamarin.Forms;
namespace Bit.App.Controls
{
public class DismissModalToolBarItem : ExtendedToolbarItem, IDisposable
{
private readonly ContentPage _page;
public DismissModalToolBarItem(ContentPage page, string text = null, Action cancelClickedAction = null)
: base(cancelClickedAction)
{
_page = page;
// TODO: init and dispose events from pages
InitEvents();
Text = text ?? AppResources.Close;
Priority = -1;
}
protected async override void ClickedItem(object sender, EventArgs e)
{
base.ClickedItem(sender, e);
await _page.Navigation.PopModalAsync();
}
}
}