2019-05-15 00:25:58 +03:00
|
|
|
|
using Bit.Core.Models.View;
|
|
|
|
|
using System;
|
2019-05-15 00:02:24 +03:00
|
|
|
|
using Xamarin.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Bit.App.Pages
|
|
|
|
|
{
|
|
|
|
|
public partial class FoldersPage : BaseContentPage
|
|
|
|
|
{
|
|
|
|
|
private FoldersPageViewModel _vm;
|
|
|
|
|
|
|
|
|
|
public FoldersPage()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
SetActivityIndicator(_mainContent);
|
|
|
|
|
_vm = BindingContext as FoldersPageViewModel;
|
|
|
|
|
_vm.Page = this;
|
|
|
|
|
|
|
|
|
|
if(Device.RuntimePlatform == Device.iOS)
|
|
|
|
|
{
|
|
|
|
|
_absLayout.Children.Remove(_fab);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_fab.Clicked = AddButton_Clicked;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override async void OnAppearing()
|
|
|
|
|
{
|
|
|
|
|
base.OnAppearing();
|
|
|
|
|
await LoadOnAppearedAsync(_mainLayout, true, async () =>
|
|
|
|
|
{
|
|
|
|
|
await _vm.InitAsync();
|
|
|
|
|
}, _mainContent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async void RowSelected(object sender, SelectedItemChangedEventArgs e)
|
|
|
|
|
{
|
2019-05-15 00:25:58 +03:00
|
|
|
|
((ListView)sender).SelectedItem = null;
|
|
|
|
|
if(!DoOnce())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(!(e.SelectedItem is FolderView folder))
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var page = new FolderAddEditPage(folder.Id);
|
|
|
|
|
await Navigation.PushModalAsync(new NavigationPage(page));
|
2019-05-15 00:02:24 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async void AddButton_Clicked(object sender, EventArgs e)
|
|
|
|
|
{
|
2019-05-15 00:25:58 +03:00
|
|
|
|
var page = new FolderAddEditPage();
|
|
|
|
|
await Navigation.PushModalAsync(new NavigationPage(page));
|
2019-05-15 00:02:24 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|