2019-05-08 17:42:55 +03:00
|
|
|
|
using Bit.Core.Enums;
|
|
|
|
|
using Xamarin.Forms;
|
2019-05-07 18:25:21 +03:00
|
|
|
|
|
|
|
|
|
namespace Bit.App.Pages
|
|
|
|
|
{
|
|
|
|
|
public partial class AddEditPage : BaseContentPage
|
|
|
|
|
{
|
|
|
|
|
private AddEditPageViewModel _vm;
|
|
|
|
|
|
2019-05-07 19:29:02 +03:00
|
|
|
|
public AddEditPage(
|
|
|
|
|
string cipherId = null,
|
2019-05-08 17:42:55 +03:00
|
|
|
|
CipherType? type = null,
|
2019-05-07 19:29:02 +03:00
|
|
|
|
string folderId = null,
|
|
|
|
|
string collectionId = null,
|
|
|
|
|
string organizationId = null)
|
2019-05-07 18:25:21 +03:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
_vm = BindingContext as AddEditPageViewModel;
|
|
|
|
|
_vm.Page = this;
|
|
|
|
|
_vm.CipherId = cipherId;
|
2019-05-07 19:29:02 +03:00
|
|
|
|
_vm.FolderId = folderId;
|
|
|
|
|
_vm.OrganizationId = organizationId;
|
2019-05-08 17:42:55 +03:00
|
|
|
|
_vm.Type = type;
|
2019-05-07 19:29:02 +03:00
|
|
|
|
_vm.Init();
|
2019-05-07 18:25:21 +03:00
|
|
|
|
SetActivityIndicator();
|
2019-05-08 06:22:55 +03:00
|
|
|
|
|
2019-05-08 21:37:12 +03:00
|
|
|
|
_typePicker.ItemDisplayBinding = new Binding("Key");
|
2019-05-08 06:22:55 +03:00
|
|
|
|
_cardBrandPicker.ItemDisplayBinding = new Binding("Key");
|
|
|
|
|
_cardExpMonthPicker.ItemDisplayBinding = new Binding("Key");
|
|
|
|
|
_identityTitlePicker.ItemDisplayBinding = new Binding("Key");
|
2019-05-09 19:18:23 +03:00
|
|
|
|
_folderPicker.ItemDisplayBinding = new Binding("Key");
|
2019-05-07 18:25:21 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override async void OnAppearing()
|
|
|
|
|
{
|
|
|
|
|
base.OnAppearing();
|
|
|
|
|
await LoadOnAppearedAsync(_scrollView, true, () => _vm.LoadAsync());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnDisappearing()
|
|
|
|
|
{
|
|
|
|
|
base.OnDisappearing();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async void PasswordHistory_Tapped(object sender, System.EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if(DoOnce())
|
|
|
|
|
{
|
|
|
|
|
await Navigation.PushModalAsync(new NavigationPage(new PasswordHistoryPage(_vm.CipherId)));
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-05-07 19:29:02 +03:00
|
|
|
|
|
|
|
|
|
private async void Save_Clicked(object sender, System.EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if(DoOnce())
|
|
|
|
|
{
|
|
|
|
|
await _vm.SubmitAsync();
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-05-08 23:49:32 +03:00
|
|
|
|
|
|
|
|
|
private void NewUri_Clicked(object sender, System.EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
_vm.AddUri();
|
|
|
|
|
}
|
2019-05-09 06:13:10 +03:00
|
|
|
|
|
|
|
|
|
private void NewField_Clicked(object sender, System.EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
_vm.AddField();
|
|
|
|
|
}
|
2019-05-07 18:25:21 +03:00
|
|
|
|
}
|
|
|
|
|
}
|