Exemplo n.º 1
0
        public DetailsPage()
        {
            InitializeComponent();

            var nameEntry = new Entry();

            nameEntry.SetBinding(Entry.TextProperty, "AccountName");
            nameEntry.HorizontalOptions = LayoutOptions.CenterAndExpand;
            nameEntry.WidthRequest      = 330;


            var passEntry = new Entry();

            passEntry.SetBinding(Entry.TextProperty, "Password");
            passEntry.HorizontalOptions = LayoutOptions.CenterAndExpand;
            passEntry.WidthRequest      = 330;
            passEntry.IsPassword        = true;

            var showButton = new Button {
                Text              = "Show Password",
                HeightRequest     = 50,
                WidthRequest      = 330,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };

            showButton.Clicked += async(sender, e) =>
            {
                passEntry.IsPassword = false;
            };

            var padding = new Label
            {
            };

            var padding2 = new Label
            {
            };

            var padding3 = new Label
            {
            };

            var padding4 = new Label
            {
            };

            var padding5 = new Label
            {
                HeightRequest = 32,
            };

            var acv = new AddControlView
            {
                HeightRequest   = 50,
                WidthRequest    = 360,
                VerticalOptions = LayoutOptions.End
            };

            var editSwitch = new Switch();

            editSwitch.SetBinding(Switch.IsToggledProperty, "Edit");


            var saveButton = new Button {
                Text = "Save",
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                WidthRequest      = 330
            };

            saveButton.Clicked += async(sender, e) =>
            {
                if (nameEntry.Text == null || passEntry.Text == null)
                {
                    await DisplayAlert("Oops", "Please enter an account name", "OK");
                }
                else
                {
                    DependencyService.Get <IAdMobInterstitial>().Show("ca-app-pub-5855889298757956/4582376251");
                    var application = (User)BindingContext;
                    await App.Database.SaveApplicationAsync(application);

                    await Navigation.PopAsync();
                }
            };

            var deleteButton = new Button {
                Text = "Delete",
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                WidthRequest      = 330
            };

            deleteButton.Clicked += async(sender, e) =>
            {
                {
                    var result =
                        await DisplayAlert("Confirmation", "Are you sure? This cannot be undone",
                                           "Yes", "Cancel");

                    if (result == true)
                    {
                        var application = (User)BindingContext;
                        await App.Database.DeleteItemAsync(application);

                        await Navigation.PopAsync();
                    }
                }
            };

            var cancelButton = new Button {
                Text = "Cancel",
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                WidthRequest      = 330
            };

            cancelButton.Clicked += async(sender, e) =>
            {
                await Navigation.PopAsync();
            };


            Content = new StackLayout
            {
                //Margin = new Thickness(20),
                VerticalOptions = LayoutOptions.StartAndExpand,
                Children        =
                {
                    new Label {
                        Text = "AccountName"
                    },
                    nameEntry,
                    new Label {
                        Text = "Password"
                    },
                    passEntry,
                    showButton,
                    //new Label { Text = "Edit" },

                    //editSwitch,
                    saveButton,
                    deleteButton,
                    cancelButton,
                    padding,
                    padding2,
                    padding3,
                    padding4,
                    padding5,
                    acv,
                }
            };

            //if (editSwitch.IsToggled == false)
            //{
            //    passEntry.IsEnabled = false;
            //    nameEntry.IsEnabled = false;
            //}
            if (editSwitch.IsToggled == true)
            {
                passEntry.IsEnabled = true;
                nameEntry.IsEnabled = true;
            }
        }
Exemplo n.º 2
0
        public HelpPage()
        {
            InitializeComponent();

            Label header = new Label
            {
                Text              = "How to use eSecurePass",
                Font              = Font.SystemFontOfSize(40),
                FontAttributes    = FontAttributes.Bold,
                TextColor         = Color.Black,
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            Label passButton = new Label
            {
                Text              = "Generate Password Button",
                FontSize          = 20,
                TextColor         = Color.Black,
                HorizontalOptions = LayoutOptions.Center
            };

            Label passButtonText = new Label
            {
                Text              = "Click the Generate Password button to generate a new random password",
                TextColor         = Color.Black,
                HorizontalOptions = LayoutOptions.Center
            };

            Label copyButton = new Label
            {
                Text              = "Copy Password Button",
                FontSize          = 20,
                TextColor         = Color.Black,
                HorizontalOptions = LayoutOptions.Center
            };

            Label copyButtonText = new Label
            {
                Text              = "Click the Copy Password button to navigate to the Account creation page where the generated password will be autofilled.",
                TextColor         = Color.Black,
                HorizontalOptions = LayoutOptions.Center
            };

            Label accountCreation = new Label
            {
                Text              = "Account Creation Page",
                FontSize          = 20,
                TextColor         = Color.Black,
                HorizontalOptions = LayoutOptions.Center
            };

            Label accountCreationText = new Label
            {
                Text              = "On this page you can store your generated passwords (or any password you come up with) and assign them with an associated Account.",
                TextColor         = Color.Black,
                HorizontalOptions = LayoutOptions.Center
            };

            Label view = new Label
            {
                Text              = "View Stored Accounts/Passwords",
                FontSize          = 20,
                TextColor         = Color.Black,
                HorizontalOptions = LayoutOptions.Center
            };

            Label viewText = new Label
            {
                Text              = "Tap the menu icon on the top left of the app. Select the View Stored Passwords button to see all stored Accounts. Click on any existing Account to view the password for that account. You can add new Accounts by tapping the Add button on the top right of the app. ",
                TextColor         = Color.Black,
                HorizontalOptions = LayoutOptions.Center
            };

            var acv = new AddControlView
            {
                HeightRequest   = 50,
                WidthRequest    = 320,
                VerticalOptions = LayoutOptions.EndAndExpand
            };

            // Build the page.
            this.Content = new StackLayout
            {
                Children =
                {
                    header,
                    passButton,
                    passButtonText,
                    copyButton,
                    copyButtonText,
                    accountCreation,
                    accountCreationText,

                    acv
                }
            };
        }
Exemplo n.º 3
0
        public SecurePass()
        {
            InitializeComponent();
            Label header = new Label
            {
                Text              = "eSecurePass",
                Font              = Font.SystemFontOfSize(50),
                FontAttributes    = FontAttributes.Bold,
                TextColor         = Color.Black,
                HorizontalOptions = LayoutOptions.Center
            };

            ToolbarItems.Add(new ToolbarItem()
            {
                Icon     = "help.png",
                Order    = ToolbarItemOrder.Primary,
                Priority = 0,
                Command  = new Command(() => Navigation.PushAsync(new HelpPage()))
            });

            var generateButton = new Button {
                Text = "Generate Password",
                HorizontalOptions = LayoutOptions.Center
            };

            generateButton.Clicked += OnButtonClicked;

            var copyButton = new Button {
                Text = "Copy Password",
                HorizontalOptions = LayoutOptions.Center
            };

            copyButton.Clicked += CopyPassword;

            //step = 1.0;
            //Slider slider = new Slider
            //{
            //    Minimum = 0,
            //    Maximum = 50,
            //    Value = 0,
            //    VerticalOptions = LayoutOptions.CenterAndExpand
            //};
            //slider.ValueChanged += Slider_ValueChanged;

            var acv = new AddControlView {
                HeightRequest   = 50,
                WidthRequest    = 320,
                VerticalOptions = LayoutOptions.EndAndExpand
            };

            valueLabel = new Label
            {
                FontSize          = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.CenterAndExpand
            };

            //label = new Label
            //{
            //    Text = "Password length is 0",
            //    FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
            //    HorizontalOptions = LayoutOptions.Center,
            //    VerticalOptions = LayoutOptions.CenterAndExpand,

            // Build the page.
            this.Content = new StackLayout
            {
                Children =
                {
                    header,
                    //label,
                    //slider,
                    generateButton,
                    valueLabel,
                    copyButton,
                    acv
                }
            };
        }