Exemple #1
0
        //Uncomment if using the ListView

        /*protected override async void OnAppearing()
         * {
         *  base.OnAppearing();
         *  listView.ItemsSource = await App.Database.GetUsersAsync();
         * }*/

        private async void OnSignUpButtonClicked(object sender, EventArgs e)
        {
            //checking if it is a real email and is a .edu email
            Regex regex = new Regex(@"^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.(edu)$", RegexOptions.IgnoreCase);

            //Check if content is filled in correctly
            if (!string.IsNullOrWhiteSpace(usernameEntry.Text) &&
                !string.IsNullOrWhiteSpace(passwordEntry.Text) &&
                regex.IsMatch(emailEntry.Text) &&
                (passwordEntry.Text == RepasswordEntry.Text)
                )
            {
                //data for filling new user signup
                var newUser = new RegisterUserTable
                {
                    Username = usernameEntry.Text,
                    Password = passwordEntry.Text,
                    Email    = emailEntry.Text
                };



                /*listView.ItemsSource = await App.Database.GetUsersAsync();*/

                /*string mystring = $"{App.currentUser.UserId}\n{App.currentUser.Username}\n{App.currentUser.Email}\n{App.currentUser.Password}";
                 * await DisplayAlert("user", mystring, "Ok");*/


                var rootPage = Navigation.NavigationStack.FirstOrDefault();
                if (rootPage != null)
                {
                    App.IsUserLoggedIn = true;
                    //Pass in user so it can be updated and created in database
                    await Navigation.PushAsync(new SignUpInfo(newUser));
                }
            }
            else
            {
                await DisplayAlert("Error", "Sign up failed", "OK");
            }
        }
Exemple #2
0
        public SignUpInfo(RegisterUserTable Newuser)
        {
            InitializeComponent();

            // _connection = DependencyService.Get<ISQLiteDb>().GetConnection();
            NewUser = Newuser;


            foreach (var method in GetMajorMethod())
            {
                Major.Items.Add(method.MajorSel);
            }
            foreach (var method in GetResearchMethod())
            {
                ResearchInterests.Items.Add(method.ResearchSel);
            }
            foreach (var method in GetSelectionMethod())
            {
                Year.Items.Add(method.YearSel);
            }
        }
Exemple #3
0
        public SignUpPic(RegisterUserTable Newuser)
        {
            InitializeComponent();
            NewUser = Newuser;


            //Grabbing the photo and displaying it on Phone
            pickPhoto.Clicked += async(sender, args) =>
            {
                if (!CrossMedia.Current.IsPickPhotoSupported)
                {
                    await DisplayAlert("Photos Not Supported", ":( Permission not granted to photos.", "OK");

                    return;
                }
                var file = await Plugin.Media.CrossMedia.Current.PickPhotoAsync(new Plugin.Media.Abstractions.PickMediaOptions
                {
                    PhotoSize = Plugin.Media.Abstractions.PhotoSize.Medium,
                });

                if (file == null)
                {
                    return;
                }

                //Grabbing photo and adding it to the newUser by converting it into bytes
                var memoryStream = new MemoryStream();
                file.GetStream().CopyTo(memoryStream);
                Newuser.ImageBytes = memoryStream.ToArray();

                image.Source = ImageSource.FromStream(() =>
                {
                    var stream = file.GetStream();
                    file.Dispose();
                    return(stream);
                });
            };
        }
 public ConnectProfilePage(RegisterUserTable user)
 {
     InitializeComponent();
     ClickedUser = user;
     //NavigationPage.SetHasNavigationBar(this, false);
 }
Exemple #5
0
 //Add user to database after completion or creation
 public Task <int> SaveUserAsync(RegisterUserTable user)
 {
     return(_database.InsertAsync(user));
 }