internal void MoveInfo(TableView TableView) { TableRoot Root = TableView.Root; Root.Insert(Root.Count - 1, this.GeneralInformation); Root.Insert(Root.Count - 1, this.QrCodeSection); Root.Insert(Root.Count - 1, this.Roles); Root.Insert(Root.Count - 1, this.Parts); Root.Insert(Root.Count - 1, this.Parameters); Root.Insert(Root.Count - 1, this.HumanReadableSection); Root.Insert(Root.Count - 1, this.MachineReadableSection); Root.Insert(Root.Count - 1, this.ClientSignatures); Root.Insert(Root.Count - 1, this.ServerSignature); }
protected override void Init() { var root = new TableRoot(); var section1 = new TableSection("1") { new TextCell { Text = "CHANGE THE SECOND CELL", Command = new Command(() => { root.Remove(_selectionOne); root.Remove(_selectionTwo); if (!_state) { root.Insert(1, _selectionOne); } else { root.Insert(1, _selectionTwo); } _state = !_state; }) } }; root.Add(section1); _selectionOne = new TableSection("2") { new EntryCell { Label = "Numeric Keyboard", Placeholder = "Tap here", Keyboard = Keyboard.Numeric } }; _selectionTwo = new TableSection("2") { new EntryCell { Label = "Plain Keyboard", Placeholder = "Tap here", Keyboard = Keyboard.Plain, } }; Content = new StackLayout { Padding = new Thickness(0, 50), Children = { new Label { Margin = new Thickness(15, 0), Text = "1) Tap 'CHANGE THE SECOND CELL' and make sure, that the second cell has numeric keyboard" + "\n2) Tap 'CHANGE THE SECOND CELL' again and make sure, that the second cel has plain keyboard" }, new TableView { Intent = TableIntent.Form, Root = root } } }; }
private void InitTable() { AttachmentsCell = new ExtendedTextCell { Text = AppResources.Attachments, ShowDisclousure = true }; // Sections TopSection = new TableSection(AppResources.ItemInformation) { NameCell }; MiddleSection = new TableSection(Helpers.GetEmptyTableSectionTitle()) { FolderCell, FavoriteCell, AttachmentsCell }; // Types if (Cipher.Type == CipherType.Login) { LoginTotpCell = new FormEntryCell(AppResources.AuthenticatorKey, button1: _deviceInfo.HasCamera ? "camera.png" : null); LoginTotpCell.Entry.Text = Cipher.Login?.Totp?.Decrypt(Cipher.OrganizationId); LoginTotpCell.Entry.DisableAutocapitalize = true; LoginTotpCell.Entry.Autocorrect = false; LoginTotpCell.Entry.FontFamily = Helpers.OnPlatform(iOS: "Menlo-Regular", Android: "monospace", Windows: "Courier"); LoginPasswordCell = new FormEntryCell(AppResources.Password, isPassword: true, nextElement: LoginTotpCell.Entry, button1: "eye.png", button2: "refresh_alt.png"); LoginPasswordCell.Entry.Text = Cipher.Login?.Password?.Decrypt(Cipher.OrganizationId); LoginPasswordCell.Entry.DisableAutocapitalize = true; LoginPasswordCell.Entry.Autocorrect = false; LoginPasswordCell.Entry.FontFamily = Helpers.OnPlatform(iOS: "Menlo-Regular", Android: "monospace", Windows: "Courier"); LoginUsernameCell = new FormEntryCell(AppResources.Username, nextElement: LoginPasswordCell.Entry); LoginUsernameCell.Entry.Text = Cipher.Login?.Username?.Decrypt(Cipher.OrganizationId); LoginUsernameCell.Entry.DisableAutocapitalize = true; LoginUsernameCell.Entry.Autocorrect = false; // Name NameCell.NextElement = LoginUsernameCell.Entry; // Build sections TopSection.Add(LoginUsernameCell); TopSection.Add(LoginPasswordCell); TopSection.Add(LoginTotpCell); // Uris UrisSection = new TableSection(Helpers.GetEmptyTableSectionTitle()); AddUriCell = new ExtendedTextCell { Text = $"+ {AppResources.NewUri}", TextColor = Colors.Primary }; UrisSection.Add(AddUriCell); if (Cipher.Login?.Uris != null) { foreach (var uri in Cipher.Login.Uris) { var value = uri.Uri?.Decrypt(Cipher.OrganizationId); UrisSection.Insert(UrisSection.Count - 1, Helpers.MakeUriCell(value, uri.Match, UrisSection, this)); } } } else if (Cipher.Type == CipherType.Card) { CardCodeCell = new FormEntryCell(AppResources.SecurityCode, Keyboard.Numeric, isPassword: true, nextElement: NotesCell.Editor, button1: "eye.png"); CardCodeCell.Entry.Text = Cipher.Card.Code?.Decrypt(Cipher.OrganizationId); CardCodeCell.Entry.FontFamily = Helpers.OnPlatform(iOS: "Menlo-Regular", Android: "monospace", Windows: "Courier"); CardExpYearCell = new FormEntryCell(AppResources.ExpirationYear, Keyboard.Numeric, nextElement: CardCodeCell.Entry); CardExpYearCell.Entry.Text = Cipher.Card.ExpYear?.Decrypt(Cipher.OrganizationId); var month = Cipher.Card.ExpMonth?.Decrypt(Cipher.OrganizationId); CardExpMonthCell = new FormPickerCell(AppResources.ExpirationMonth, new string[] { "--", AppResources.January, AppResources.February, AppResources.March, AppResources.April, AppResources.May, AppResources.June, AppResources.July, AppResources.August, AppResources.September, AppResources.October, AppResources.November, AppResources.December }); if (!string.IsNullOrWhiteSpace(month) && int.TryParse(month, out int monthIndex)) { CardExpMonthCell.Picker.SelectedIndex = monthIndex; } else { CardExpMonthCell.Picker.SelectedIndex = 0; } var brandOptions = new string[] { "--", "Visa", "Mastercard", "American Express", "Discover", "Diners Club", "JCB", "Maestro", "UnionPay", AppResources.Other }; var brand = Cipher.Card.Brand?.Decrypt(Cipher.OrganizationId); CardBrandCell = new FormPickerCell(AppResources.Brand, brandOptions); CardBrandCell.Picker.SelectedIndex = 0; if (!string.IsNullOrWhiteSpace(brand)) { var i = 0; foreach (var o in brandOptions) { var option = o; if (option == AppResources.Other) { option = "Other"; } if (option == brand) { CardBrandCell.Picker.SelectedIndex = i; break; } i++; } } CardNumberCell = new FormEntryCell(AppResources.Number, Keyboard.Numeric); CardNumberCell.Entry.Text = Cipher.Card.Number?.Decrypt(Cipher.OrganizationId); CardNameCell = new FormEntryCell(AppResources.CardholderName, nextElement: CardNumberCell.Entry); CardNameCell.Entry.Text = Cipher.Card.CardholderName?.Decrypt(Cipher.OrganizationId); // Name NameCell.NextElement = CardNameCell.Entry; // Build sections TopSection.Add(CardNameCell); TopSection.Add(CardNumberCell); TopSection.Add(CardBrandCell); TopSection.Add(CardExpMonthCell); TopSection.Add(CardExpYearCell); TopSection.Add(CardCodeCell); } else if (Cipher.Type == CipherType.Identity) { IdCountryCell = new FormEntryCell(AppResources.Country, nextElement: NotesCell.Editor); IdCountryCell.Entry.Text = Cipher.Identity.Country?.Decrypt(Cipher.OrganizationId); IdPostalCodeCell = new FormEntryCell(AppResources.ZipPostalCode, nextElement: IdCountryCell.Entry); IdPostalCodeCell.Entry.Text = Cipher.Identity.PostalCode?.Decrypt(Cipher.OrganizationId); IdPostalCodeCell.Entry.DisableAutocapitalize = true; IdPostalCodeCell.Entry.Autocorrect = false; IdStateCell = new FormEntryCell(AppResources.StateProvince, nextElement: IdPostalCodeCell.Entry); IdStateCell.Entry.Text = Cipher.Identity.State?.Decrypt(Cipher.OrganizationId); IdCityCell = new FormEntryCell(AppResources.CityTown, nextElement: IdStateCell.Entry); IdCityCell.Entry.Text = Cipher.Identity.City?.Decrypt(Cipher.OrganizationId); IdAddress3Cell = new FormEntryCell(AppResources.Address3, nextElement: IdCityCell.Entry); IdAddress3Cell.Entry.Text = Cipher.Identity.Address3?.Decrypt(Cipher.OrganizationId); IdAddress2Cell = new FormEntryCell(AppResources.Address2, nextElement: IdAddress3Cell.Entry); IdAddress2Cell.Entry.Text = Cipher.Identity.Address2?.Decrypt(Cipher.OrganizationId); IdAddress1Cell = new FormEntryCell(AppResources.Address1, nextElement: IdAddress2Cell.Entry); IdAddress1Cell.Entry.Text = Cipher.Identity.Address1?.Decrypt(Cipher.OrganizationId); IdPhoneCell = new FormEntryCell(AppResources.Phone, nextElement: IdAddress1Cell.Entry); IdPhoneCell.Entry.Text = Cipher.Identity.Phone?.Decrypt(Cipher.OrganizationId); IdPhoneCell.Entry.DisableAutocapitalize = true; IdPhoneCell.Entry.Autocorrect = false; IdEmailCell = new FormEntryCell(AppResources.Email, Keyboard.Email, nextElement: IdPhoneCell.Entry); IdEmailCell.Entry.Text = Cipher.Identity.Email?.Decrypt(Cipher.OrganizationId); IdEmailCell.Entry.DisableAutocapitalize = true; IdEmailCell.Entry.Autocorrect = false; IdLicenseNumberCell = new FormEntryCell(AppResources.LicenseNumber, nextElement: IdEmailCell.Entry); IdLicenseNumberCell.Entry.Text = Cipher.Identity.LicenseNumber?.Decrypt(Cipher.OrganizationId); IdLicenseNumberCell.Entry.DisableAutocapitalize = true; IdLicenseNumberCell.Entry.Autocorrect = false; IdPassportNumberCell = new FormEntryCell(AppResources.PassportNumber, nextElement: IdLicenseNumberCell.Entry); IdPassportNumberCell.Entry.Text = Cipher.Identity.PassportNumber?.Decrypt(Cipher.OrganizationId); IdPassportNumberCell.Entry.DisableAutocapitalize = true; IdPassportNumberCell.Entry.Autocorrect = false; IdSsnCell = new FormEntryCell(AppResources.SSN, nextElement: IdPassportNumberCell.Entry); IdSsnCell.Entry.Text = Cipher.Identity.SSN?.Decrypt(Cipher.OrganizationId); IdSsnCell.Entry.DisableAutocapitalize = true; IdSsnCell.Entry.Autocorrect = false; IdCompanyCell = new FormEntryCell(AppResources.Company, nextElement: IdSsnCell.Entry); IdCompanyCell.Entry.Text = Cipher.Identity.Company?.Decrypt(Cipher.OrganizationId); IdUsernameCell = new FormEntryCell(AppResources.Username, nextElement: IdCompanyCell.Entry); IdUsernameCell.Entry.Text = Cipher.Identity.Username?.Decrypt(Cipher.OrganizationId); IdUsernameCell.Entry.DisableAutocapitalize = true; IdUsernameCell.Entry.Autocorrect = false; IdLastNameCell = new FormEntryCell(AppResources.LastName, nextElement: IdUsernameCell.Entry); IdLastNameCell.Entry.Text = Cipher.Identity.LastName?.Decrypt(Cipher.OrganizationId); IdMiddleNameCell = new FormEntryCell(AppResources.MiddleName, nextElement: IdLastNameCell.Entry); IdMiddleNameCell.Entry.Text = Cipher.Identity.MiddleName?.Decrypt(Cipher.OrganizationId); IdFirstNameCell = new FormEntryCell(AppResources.FirstName, nextElement: IdMiddleNameCell.Entry); IdFirstNameCell.Entry.Text = Cipher.Identity.FirstName?.Decrypt(Cipher.OrganizationId); var titleOptions = new string[] { "--", AppResources.Mr, AppResources.Mrs, AppResources.Ms, AppResources.Dr }; IdTitleCell = new FormPickerCell(AppResources.Title, titleOptions); var title = Cipher.Identity.Title?.Decrypt(Cipher.OrganizationId); IdTitleCell.Picker.SelectedIndex = 0; if (!string.IsNullOrWhiteSpace(title)) { var i = 0; foreach (var o in titleOptions) { i++; if (o == title) { IdTitleCell.Picker.SelectedIndex = i; break; } } } // Name NameCell.NextElement = IdFirstNameCell.Entry; // Build sections TopSection.Add(IdTitleCell); TopSection.Add(IdFirstNameCell); TopSection.Add(IdMiddleNameCell); TopSection.Add(IdLastNameCell); TopSection.Add(IdUsernameCell); TopSection.Add(IdCompanyCell); TopSection.Add(IdSsnCell); TopSection.Add(IdPassportNumberCell); TopSection.Add(IdLicenseNumberCell); TopSection.Add(IdEmailCell); TopSection.Add(IdPhoneCell); TopSection.Add(IdAddress1Cell); TopSection.Add(IdAddress2Cell); TopSection.Add(IdAddress3Cell); TopSection.Add(IdCityCell); TopSection.Add(IdStateCell); TopSection.Add(IdPostalCodeCell); TopSection.Add(IdCountryCell); } else if (Cipher.Type == CipherType.SecureNote) { // Name NameCell.NextElement = NotesCell.Editor; } FieldsSection = new TableSection(AppResources.CustomFields); if (Cipher.Fields != null) { foreach (var field in Cipher.Fields) { var label = field.Name?.Decrypt(Cipher.OrganizationId) ?? string.Empty; var value = field.Value?.Decrypt(Cipher.OrganizationId); var cell = Helpers.MakeFieldCell(field.Type, label, value, FieldsSection, this); if (cell != null) { FieldsSection.Add(cell); } } } AddFieldCell = new ExtendedTextCell { Text = $"+ {AppResources.NewCustomField}", TextColor = Colors.Primary }; FieldsSection.Add(AddFieldCell); // Make table TableRoot = new TableRoot { TopSection, MiddleSection, new TableSection(AppResources.Notes) { NotesCell }, FieldsSection, new TableSection(Helpers.GetEmptyTableSectionTitle()) { DeleteCell } }; if (UrisSection != null) { TableRoot.Insert(1, UrisSection); } Table = new ExtendedTableView { Intent = TableIntent.Settings, EnableScrolling = true, HasUnevenRows = true, Root = TableRoot }; if (Device.RuntimePlatform == Device.iOS) { Table.RowHeight = -1; Table.EstimatedRowHeight = 70; } else if (Device.RuntimePlatform == Device.Android) { Table.BottomPadding = 50; } }
private void InitTable() { // Sections TopSection = new TableSection(AppResources.ItemInformation) { NameCell }; MiddleSection = new TableSection(Helpers.GetEmptyTableSectionTitle()) { FolderCell, FavoriteCell }; if (_type == CipherType.Login) { LoginTotpCell = new FormEntryCell(AppResources.AuthenticatorKey, button1: _deviceInfo.HasCamera ? "camera.png" : null); LoginTotpCell.Entry.DisableAutocapitalize = true; LoginTotpCell.Entry.Autocorrect = false; LoginTotpCell.Entry.FontFamily = Helpers.OnPlatform(iOS: "Menlo-Regular", Android: "monospace", Windows: "Courier"); LoginPasswordCell = new FormEntryCell(AppResources.Password, isPassword: true, nextElement: LoginTotpCell.Entry, button1: "eye.png", button2: "refresh_alt.png"); LoginPasswordCell.Entry.DisableAutocapitalize = true; LoginPasswordCell.Entry.Autocorrect = false; LoginPasswordCell.Entry.FontFamily = Helpers.OnPlatform(iOS: "Menlo-Regular", Android: "monospace", Windows: "Courier"); if (!string.IsNullOrWhiteSpace(_defaultPassword)) { LoginPasswordCell.Entry.Text = _defaultPassword; } LoginUsernameCell = new FormEntryCell(AppResources.Username, nextElement: LoginPasswordCell.Entry); LoginUsernameCell.Entry.DisableAutocapitalize = true; LoginUsernameCell.Entry.Autocorrect = false; if (!string.IsNullOrWhiteSpace(_defaultUsername)) { LoginUsernameCell.Entry.Text = _defaultUsername; } NameCell.NextElement = LoginUsernameCell.Entry; // Build sections TopSection.Add(LoginUsernameCell); TopSection.Add(LoginPasswordCell); TopSection.Add(LoginTotpCell); // Uris UrisSection = new TableSection(Helpers.GetEmptyTableSectionTitle()); AddUriCell = new ExtendedTextCell { Text = AppResources.NewUri, TextColor = Colors.Primary }; UrisSection.Add(AddUriCell); UrisSection.Insert(0, Helpers.MakeUriCell(string.Empty, null, UrisSection, this)); } else if (_type == CipherType.Card) { CardCodeCell = new FormEntryCell(AppResources.SecurityCode, Keyboard.Numeric, nextElement: NotesCell.Editor); if (!string.IsNullOrWhiteSpace(_defaultCardCode)) { CardCodeCell.Entry.Text = _defaultCardCode; } CardExpYearCell = new FormEntryCell(AppResources.ExpirationYear, Keyboard.Numeric, nextElement: CardCodeCell.Entry); if (!string.IsNullOrWhiteSpace(_defaultCardExpYear)) { CardExpYearCell.Entry.Text = _defaultCardExpYear; } CardExpMonthCell = new FormPickerCell(AppResources.ExpirationMonth, new string[] { "--", AppResources.January, AppResources.February, AppResources.March, AppResources.April, AppResources.May, AppResources.June, AppResources.July, AppResources.August, AppResources.September, AppResources.October, AppResources.November, AppResources.December }); if (_defaultCardExpMonth.HasValue) { CardExpMonthCell.Picker.SelectedIndex = _defaultCardExpMonth.Value; } CardBrandCell = new FormPickerCell(AppResources.Brand, new string[] { "--", "Visa", "Mastercard", "American Express", "Discover", "Diners Club", "JCB", "Maestro", "UnionPay", AppResources.Other }); CardNumberCell = new FormEntryCell(AppResources.Number, Keyboard.Numeric); if (!string.IsNullOrWhiteSpace(_defaultCardNumber)) { CardNumberCell.Entry.Text = _defaultCardNumber; } CardNameCell = new FormEntryCell(AppResources.CardholderName, nextElement: CardNumberCell.Entry); if (!string.IsNullOrWhiteSpace(_defaultCardName)) { CardNameCell.Entry.Text = _defaultCardName; } NameCell.NextElement = CardNameCell.Entry; // Build sections TopSection.Add(CardNameCell); TopSection.Add(CardNumberCell); TopSection.Add(CardBrandCell); TopSection.Add(CardExpMonthCell); TopSection.Add(CardExpYearCell); TopSection.Add(CardCodeCell); } else if (_type == CipherType.Identity) { IdCountryCell = new FormEntryCell(AppResources.Country, nextElement: NotesCell.Editor); IdPostalCodeCell = new FormEntryCell(AppResources.ZipPostalCode, nextElement: IdCountryCell.Entry); IdPostalCodeCell.Entry.DisableAutocapitalize = true; IdPostalCodeCell.Entry.Autocorrect = false; IdStateCell = new FormEntryCell(AppResources.StateProvince, nextElement: IdPostalCodeCell.Entry); IdCityCell = new FormEntryCell(AppResources.CityTown, nextElement: IdStateCell.Entry); IdAddress3Cell = new FormEntryCell(AppResources.Address3, nextElement: IdCityCell.Entry); IdAddress2Cell = new FormEntryCell(AppResources.Address2, nextElement: IdAddress3Cell.Entry); IdAddress1Cell = new FormEntryCell(AppResources.Address1, nextElement: IdAddress2Cell.Entry); IdPhoneCell = new FormEntryCell(AppResources.Phone, nextElement: IdAddress1Cell.Entry); IdPhoneCell.Entry.DisableAutocapitalize = true; IdPhoneCell.Entry.Autocorrect = false; IdEmailCell = new FormEntryCell(AppResources.Email, Keyboard.Email, nextElement: IdPhoneCell.Entry); IdEmailCell.Entry.DisableAutocapitalize = true; IdEmailCell.Entry.Autocorrect = false; IdLicenseNumberCell = new FormEntryCell(AppResources.LicenseNumber, nextElement: IdEmailCell.Entry); IdLicenseNumberCell.Entry.DisableAutocapitalize = true; IdLicenseNumberCell.Entry.Autocorrect = false; IdPassportNumberCell = new FormEntryCell(AppResources.PassportNumber, nextElement: IdLicenseNumberCell.Entry); IdPassportNumberCell.Entry.DisableAutocapitalize = true; IdPassportNumberCell.Entry.Autocorrect = false; IdSsnCell = new FormEntryCell(AppResources.SSN, nextElement: IdPassportNumberCell.Entry); IdSsnCell.Entry.DisableAutocapitalize = true; IdSsnCell.Entry.Autocorrect = false; IdCompanyCell = new FormEntryCell(AppResources.Company, nextElement: IdSsnCell.Entry); IdUsernameCell = new FormEntryCell(AppResources.Username, nextElement: IdCompanyCell.Entry); IdUsernameCell.Entry.DisableAutocapitalize = true; IdUsernameCell.Entry.Autocorrect = false; IdLastNameCell = new FormEntryCell(AppResources.LastName, nextElement: IdUsernameCell.Entry); IdMiddleNameCell = new FormEntryCell(AppResources.MiddleName, nextElement: IdLastNameCell.Entry); IdFirstNameCell = new FormEntryCell(AppResources.FirstName, nextElement: IdMiddleNameCell.Entry); IdTitleCell = new FormPickerCell(AppResources.Title, new string[] { "--", AppResources.Mr, AppResources.Mrs, AppResources.Ms, AppResources.Dr }); // Name NameCell.NextElement = IdFirstNameCell.Entry; // Build sections TopSection.Add(IdTitleCell); TopSection.Add(IdFirstNameCell); TopSection.Add(IdMiddleNameCell); TopSection.Add(IdLastNameCell); TopSection.Add(IdUsernameCell); TopSection.Add(IdCompanyCell); TopSection.Add(IdSsnCell); TopSection.Add(IdPassportNumberCell); TopSection.Add(IdLicenseNumberCell); TopSection.Add(IdEmailCell); TopSection.Add(IdPhoneCell); TopSection.Add(IdAddress1Cell); TopSection.Add(IdAddress2Cell); TopSection.Add(IdAddress3Cell); TopSection.Add(IdCityCell); TopSection.Add(IdStateCell); TopSection.Add(IdPostalCodeCell); TopSection.Add(IdCountryCell); } else if (_type == CipherType.SecureNote) { // Name NameCell.NextElement = NotesCell.Editor; } FieldsSection = new TableSection(AppResources.CustomFields); AddFieldCell = new ExtendedTextCell { Text = AppResources.NewCustomField, TextColor = Colors.Primary }; FieldsSection.Add(AddFieldCell); // Make table TableRoot = new TableRoot { TopSection, MiddleSection, new TableSection(AppResources.Notes) { NotesCell }, FieldsSection }; if (UrisSection != null) { TableRoot.Insert(1, UrisSection); } Table = new ExtendedTableView { Intent = TableIntent.Settings, EnableScrolling = true, HasUnevenRows = true, Root = TableRoot }; if (Device.RuntimePlatform == Device.iOS) { Table.RowHeight = -1; Table.EstimatedRowHeight = 70; } else if (Device.RuntimePlatform == Device.Android) { Table.BottomPadding = 50; } }