Files
android/src/App/Pages/Generator/GeneratorHistoryPage.xaml.cs
2019-06-14 17:21:17 -04:00

64 lines
1.6 KiB
C#

using Bit.App.Resources;
using System;
using Xamarin.Forms;
namespace Bit.App.Pages
{
public partial class GeneratorHistoryPage : BaseContentPage
{
private GeneratorHistoryPageViewModel _vm;
public GeneratorHistoryPage()
{
InitializeComponent();
SetActivityIndicator();
_vm = BindingContext as GeneratorHistoryPageViewModel;
_vm.Page = this;
if(Device.RuntimePlatform == Device.iOS)
{
ToolbarItems.Add(_closeItem);
ToolbarItems.Add(_moreItem);
}
else
{
ToolbarItems.Add(_clearItem);
}
}
protected override async void OnAppearing()
{
base.OnAppearing();
await LoadOnAppearedAsync(_mainLayout, true, async () => {
await _vm.InitAsync();
});
}
private async void Clear_Clicked(object sender, EventArgs e)
{
await _vm.ClearAsync();
}
private async void Close_Clicked(object sender, System.EventArgs e)
{
if(DoOnce())
{
await Navigation.PopModalAsync();
}
}
private async void More_Clicked(object sender, EventArgs e)
{
if(!DoOnce())
{
return;
}
var selection = await DisplayActionSheet(AppResources.Options, AppResources.Cancel,
null, AppResources.Clear);
if(selection == AppResources.Clear)
{
await _vm.ClearAsync();
}
}
}
}