コード例 #1
0
            public FieldViewCell(VaultViewLoginPage page, VaultViewLoginPageModel.Field field, bool?a, bool?b)
                : base(field.Name, field.MaskedValue, string.Empty, AppResources.Copy)
            {
                Value.FontFamily = Helpers.OnPlatform(iOS: "Menlo-Regular",
                                                      Android: "monospace", WinPhone: "Courier");
                if (Device.RuntimePlatform == Device.iOS)
                {
                    Button1.Margin = new Thickness(10, 0);
                }

                Button1.WidthRequest = 40;
                Button1.Image        = "eye";
                Button1.Command      = new Command(() =>
                {
                    field.Revealed = !field.Revealed;
                    if (field.Revealed)
                    {
                        Button1.Image = "eye_slash";
                        Value.Text    = field.Value;
                    }
                    else
                    {
                        Button1.Image = "eye";
                        Value.Text    = field.MaskedValue;
                    }
                });

                Init(page, field, Button2);
            }
コード例 #2
0
 public EditLoginToolBarItem(VaultViewLoginPage page, string loginId)
 {
     _page       = page;
     _loginId    = loginId;
     Text        = AppResources.Edit;
     ClickAction = async() => await ClickedItem();
 }
コード例 #3
0
 public EditLoginToolBarItem(VaultViewLoginPage page, string loginId)
 {
     _page    = page;
     _loginId = loginId;
     Text     = AppResources.Edit;
     Clicked += ClickedItem;
 }
コード例 #4
0
 private void Init(VaultViewLoginPage page, VaultViewLoginPageModel.Field field, ExtendedButton copyButton)
 {
     Value.LineBreakMode = LineBreakMode.WordWrap;
     if (copyButton != null)
     {
         copyButton.Command      = new Command(() => page.Copy(field.Value, field.Name));
         copyButton.WidthRequest = 59;
     }
 }
コード例 #5
0
        private async void MoreClickedAsync(VaultListPageModel.Login login)
        {
            var buttons = new List <string> {
                AppResources.View, AppResources.Edit
            };

            if (!string.IsNullOrWhiteSpace(login.Password.Value))
            {
                buttons.Add(AppResources.CopyPassword);
            }
            if (!string.IsNullOrWhiteSpace(login.Username))
            {
                buttons.Add(AppResources.CopyUsername);
            }
            if (!string.IsNullOrWhiteSpace(login.Uri.Value) && (login.Uri.Value.StartsWith("http://") ||
                                                                login.Uri.Value.StartsWith("https://")))
            {
                buttons.Add(AppResources.GoToWebsite);
            }

            var selection = await DisplayActionSheet(login.Name, AppResources.Cancel, null, buttons.ToArray());

            if (selection == AppResources.View)
            {
                var page = new VaultViewLoginPage(login.Id);
                await Navigation.PushForDeviceAsync(page);
            }
            else if (selection == AppResources.Edit)
            {
                var page = new VaultEditLoginPage(login.Id);
                await Navigation.PushForDeviceAsync(page);
            }
            else if (selection == AppResources.CopyPassword)
            {
                Copy(login.Password.Value, AppResources.Password);
            }
            else if (selection == AppResources.CopyUsername)
            {
                Copy(login.Username, AppResources.Username);
            }
            else if (selection == AppResources.GoToWebsite)
            {
                Device.OpenUri(new Uri(login.Uri.Value));
            }
        }
コード例 #6
0
        private async void LoginSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var login = e.SelectedItem as VaultListPageModel.Login;

            if (login == null)
            {
                return;
            }

            string selection = null;

            if (!string.IsNullOrWhiteSpace(Uri))
            {
                selection = await DisplayActionSheet(AppResources.AutofillOrView, AppResources.Cancel, null,
                                                     AppResources.Autofill, AppResources.View);
            }

            if (selection == AppResources.View || string.IsNullOrWhiteSpace(Uri))
            {
                var page = new VaultViewLoginPage(login.Id);
                await Navigation.PushForDeviceAsync(page);
            }
            else if (selection == AppResources.Autofill)
            {
                if (_deviceInfoService.Version < 21)
                {
                    MoreClickedAsync(login);
                }
                else
                {
                    _googleAnalyticsService.TrackExtensionEvent("AutoFilled", Uri.StartsWith("http") ? "Website" : "App");
                    MessagingCenter.Send(Application.Current, "Autofill", login);
                }
            }

            ((ListView)sender).SelectedItem = null;
        }
コード例 #7
0
 private async void LoginSelected(object sender, SelectedItemChangedEventArgs e)
 {
     var login = e.SelectedItem as VaultListPageModel.Login;
     var page  = new VaultViewLoginPage(login.Id);
     await Navigation.PushForDeviceAsync(page);
 }
コード例 #8
0
 public FieldViewCell(VaultViewLoginPage page, VaultViewLoginPageModel.Field field, bool?a)
     : base(field.Name, field.Value, AppResources.Copy)
 {
     Init(page, field, Button1);
 }
コード例 #9
0
 public FieldViewCell(VaultViewLoginPage page, VaultViewLoginPageModel.Field field)
     : base(field.Name, field.Value == "true" ? "✓" : "-")
 {
     Init(page, field, null);
 }