bitwarden-android/src/App/Controls/DismissModalToolBarItem.cs

28 lines
774 B
C#
Raw Normal View History

2016-11-26 01:11:28 +03:00
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();
2016-11-26 01:11:28 +03:00
Text = text ?? AppResources.Close;
Priority = -1;
}
protected async override void ClickedItem(object sender, EventArgs e)
{
base.ClickedItem(sender, e);
await _page.Navigation.PopModalAsync();
}
}
}