Exemplo n.º 1
0
 public SignIn_Page()
 {
     InitializeComponent();
     //this.BackgroundImage = "background.jpg";
     this.BackgroundColor = Color.FromHex("#61bafe");
     EntryUserName.Focus();
 }
Exemplo n.º 2
0
        public MainPage()
        {
            InitializeComponent();

            Task.Delay(2000).ContinueWith((arg) =>
            {
                Debug.WriteLine(EntryUserName.GetAbsoluteLocation().ToString());
                Debug.WriteLine(EntryPassword.GetAbsoluteLocation().ToString());
            });
        }
Exemplo n.º 3
0
 public RegisterPage()
 {
     InitializeComponent();
     NavigationPage.SetHasBackButton(this, false);
     EntryEmail.ReturnCommand        = new Command(() => EntryUserName.Focus());
     EntryUserName.ReturnCommand     = new Command(() => EntryUserPassword.Focus());
     EntryUserPassword.ReturnCommand = new Command(() => EntryUserPConfirm.Focus());
     if (App.originalStyle)
     {
         Resources["currentStyle"] = Resources["lightTheme"];
     }
     else
     {
         Resources["currentStyle"] = Resources["darkTheme"];
     }
 }
Exemplo n.º 4
0
        private async void Button_Clicked(object sender, EventArgs e)
        {
            if (EntryUserName.Text == null)
            {
                //await this.DisplayAlert(null, "กรุณาระบุชื่อผู้ใช้งาน", null, "ตกลง");
                EntryUserName.PlaceholderColor = Color.FromHex("#ffb3ba");
                EntryUserName.Placeholder      = "กรุณาระบุชื่อผู้ใช้งาน";
                EntryUserName.Focus();
                return;
            }

            if (EntryUserPassword.Text == null)
            {
                //await this.DisplayAlert(null, "กรุณาระบุรหัสผ่าน", null, "ตกลง");
                EntryUserPassword.PlaceholderColor = Color.FromHex("#ffb3ba");
                EntryUserPassword.Placeholder      = "กรุณาระบุรหัสผ่าน";
                EntryUserPassword.Focus();
                return;
            }

            if (EntryUserEmail.Text == null)
            {
                //await this.DisplayAlert(null, "กรุณาระบุรหัสผ่าน", null, "ตกลง");
                EntryUserEmail.PlaceholderColor = Color.FromHex("#ffb3ba");
                EntryUserEmail.Placeholder      = "กรุณาระบุอีเมล์";
                EntryUserEmail.Focus();
                return;
            }

            if (EntryUserPhoneNumber.Text == null)
            {
                //await this.DisplayAlert(null, "กรุณาระบุรหัสผ่าน", null, "ตกลง");
                EntryUserPhoneNumber.PlaceholderColor = Color.FromHex("#ffb3ba");
                EntryUserPhoneNumber.Placeholder      = "กรุณาระบุเบอร์โทรศัพท์";
                EntryUserPhoneNumber.Focus();
                return;
            }

            Device.BeginInvokeOnMainThread(async() => {
                //Register data to firebase also
                var isExist = await apiRequestHelper.RequestCheckUserExistAsync(EntryUserName.Text);
                if (isExist == "true")
                {
                    Toast.MakeText(this.context, "ชื่อผู้ใช้งานซ้ำ", ToastLength.Short).Show();
                    EntryUserName.PlaceholderColor = Color.FromHex("#ffb3ba");
                    EntryUserName.Placeholder      = "กรุณาระบุชื่อผู้ใช้งานใหม่";
                    EntryUserName.Focus();
                    return;
                }

                var dbpath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "UserDatabase.db");
                var db     = new SQLiteConnection(dbpath);
                db.CreateTable <RegUserTable>();

                var item = new RegUserTable()
                {
                    UserName    = EntryUserName.Text,
                    Password    = EntryUserPassword.Text,
                    Email       = EntryUserEmail.Text,
                    PhoneNumber = EntryUserPhoneNumber.Text,
                };

                db.Insert(item);

                var profile = new ProfileTable()
                {
                    UserName    = EntryUserName.Text,
                    Email       = EntryUserEmail.Text,
                    PhoneNumber = EntryUserPhoneNumber.Text,
                };
                db.CreateTable <ProfileTable>();
                db.Insert(profile);


                //Register data to firebase also
                await apiRequestHelper.RequestRegisterUserAsync(EntryUserName.Text, EntryUserPassword.Text, EntryUserEmail.Text, EntryUserPhoneNumber.Text);
                ProfileJson json = new ProfileJson();
                json.UserName    = EntryUserName.Text;
                json.Email       = EntryUserEmail.Text;
                json.PhoneNumber = EntryUserPhoneNumber.Text;
                json.CreateDate  = DateTime.Now.ToString("dd/MM/yyyy hh:mm tt");
                await apiRequestHelper.RequestAddProfileAsync(json);


                var result = await this.DisplayAlert(null, "สมัครสมาชิกสำเร็จ!", null, "ตกลง");

                if (!result)
                {
                    await Navigation.PushAsync(new LoginPage());
                }
            });
        }
Exemplo n.º 5
0
 public LoginView()
 {
     InitializeComponent();
     EntryUserName.Focus();
 }
Exemplo n.º 6
0
 protected override void OnAppearing()
 {
     base.OnAppearing();
     EntryUserName.Focus();
 }