2016-11-26 01:11:28 +03:00
|
|
|
|
using Bit.App.Resources;
|
|
|
|
|
using System;
|
2016-05-13 07:11:32 +03:00
|
|
|
|
using Xamarin.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Bit.App.Controls
|
|
|
|
|
{
|
2017-02-17 08:16:09 +03:00
|
|
|
|
public class DismissModalToolBarItem : ExtendedToolbarItem, IDisposable
|
2016-05-13 07:11:32 +03:00
|
|
|
|
{
|
|
|
|
|
private readonly ContentPage _page;
|
|
|
|
|
|
2016-07-23 22:32:11 +03:00
|
|
|
|
public DismissModalToolBarItem(ContentPage page, string text = null, Action cancelClickedAction = null)
|
2017-02-17 08:16:09 +03:00
|
|
|
|
: base(cancelClickedAction)
|
2016-05-13 07:11:32 +03:00
|
|
|
|
{
|
|
|
|
|
_page = page;
|
2017-02-15 08:28:05 +03:00
|
|
|
|
// TODO: init and dispose events from pages
|
|
|
|
|
InitEvents();
|
2016-11-26 01:11:28 +03:00
|
|
|
|
Text = text ?? AppResources.Close;
|
2016-05-13 07:11:32 +03:00
|
|
|
|
Priority = -1;
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-17 08:16:09 +03:00
|
|
|
|
protected async override void ClickedItem(object sender, EventArgs e)
|
2016-05-13 07:11:32 +03:00
|
|
|
|
{
|
2017-02-17 08:16:09 +03:00
|
|
|
|
base.ClickedItem(sender, e);
|
2016-05-13 07:11:32 +03:00
|
|
|
|
await _page.Navigation.PopModalAsync();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|