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

30 lines
868 B
C#
Raw Normal View History

2016-11-26 01:11:28 +03:00
using Bit.App.Resources;
using Bit.App.Utilities;
2016-11-26 01:11:28 +03:00
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;
Icon = Helpers.ToolbarImage("ion_chevron_left.png");
Priority = -1;
}
protected async override void ClickedItem(object sender, EventArgs e)
{
base.ClickedItem(sender, e);
await _page.Navigation.PopForDeviceAsync();
}
}
}