Ejemplo n.º 1
0
        private void Getcode_Click(object sender, EventArgs e)
        {
            if (!switcher)  //for GETCODE button
            {
                if (checkValidPhoneNumber(getphone.Text))
                {
                    changeType(); //change state of the BUTTON
                    code = connector.GetData <GetCode>(APIConnection.CodeByTelephone, phone);
                }
            }
            else //for CONFIRM button
            {
                int compare = code.Expiration_time.CompareTo(DateTime.Now); //get TIME NOW
                if (compare >= 0) //input confirm code ontime
                {
                    confirm = getphone.Text;
                    if (confirm == code.Verified_code)//correct
                    {
                        check = connector.GetData <checkTelephone>(APIConnection.UserByTelephone, phone);
                        if (check.IsNew) //newbie
                        {
                            Intent initial3 = new Intent(this, typeof(initial3Activity));
                            initial3.PutExtra("user_id", check.User_id);
                            StartActivity(initial3);
                        }
                        else //pro
                        {
                            //Bundle bunlde = new Bundle();
                            //bunlde.PutString("user_id", check.User_id);
                            //HomeFragment home = new HomeFragment();
                            //home.Arguments = bunlde;

                            Intent mainActivity = new Intent(this, typeof(MainActivity));
                            mainActivity.PutExtra("user_id", check.User_id);
                            StartActivity(mainActivity);
                        }
                        editor.PutString("user_id", check.User_id);
                        editor.Apply();
                    }
                    else
                    {
                        alertMes("Sorry", "You have input an incorrect code. Try again!", "OK");
                    }
                }
                else
                {
                    alertMes("Sorry", "The code is expired. You will received another one!", "OK");
                    code = connector.GetData <GetCode>(APIConnection.CodeByTelephone, getphone.Text);
                }
            }
        }
Ejemplo n.º 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.EditSolution);


            backButton = FindViewById <ImageButton>(Resource.Id.button_back);
            saveButton = FindViewById <ImageButton>(Resource.Id.button_save);
            listView   = FindViewById <ListView>(Resource.Id.list);

            // Get Data using APIConnection
            List <SolutionModel> listSolution = new List <SolutionModel>();
            APIConnection        connector    = new APIConnection();

            listSolution = connector.GetData <List <SolutionModel> >(APIConnection.Solutions);

            listView.Adapter = new EditSolutionAdapter(this, listSolution);

            backButton.Click += delegate
            {
                this.OnBackPressed();
            };
            saveButton.Click += delegate
            {
                this.OnBackPressed();
                this.Finish();
            };
        }
Ejemplo n.º 3
0
        // Get
        private void TestData()
        {
            // Get Data using APIConnection

            list = new List <LandModel>();
            APIConnection connector = new APIConnection();

            list = connector.GetData <List <LandModel> >(APIConnection.LandsByUserId, userId);

            adapter = new LandAdapter(list, this.Activity);
            //Activity.RunOnUiThread(() => { adapter.refreshEvents(list); });
            listView.Adapter = adapter;
            adapter.NotifyDataSetChanged();
            GetListViewSize(listView);

            if (list == null)
            {
                listView.Visibility = ViewStates.Gone;
                textView.Visibility = ViewStates.Visible;
            }
            else
            {
                listView.Visibility = ViewStates.Visible;
                textView.Visibility = ViewStates.Gone;
            }
        }
Ejemplo n.º 4
0
        private void TestData()
        {
            list = new List <AddPlantModel>();
            APIConnection connector = new APIConnection();

            list = connector.GetData <List <AddPlantModel> >(APIConnection.Plants);

            adapter                    = new PlantAdapter(this.Activity, list);
            listView.Adapter           = adapter;
            listView.TextFilterEnabled = true;
        }
Ejemplo n.º 5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            string user_id = Intent.GetStringExtra("user_id");

            userInfo = connector.GetData <UserInfo>(APIConnection.UserById, user_id);
            SetContentView(Resource.Layout.initial3);
            name     = FindViewById <EditText>(Resource.Id.fullname);
            location = FindViewById <EditText>(Resource.Id.location);
            email    = FindViewById <EditText>(Resource.Id.email);
            later    = FindViewById <Button>(Resource.Id.later);
            ok       = FindViewById <Button>(Resource.Id.ok);

            ok.Click    += Ok_Click;
            later.Click += Later_Click;
            // Create your application here
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Solutions);


            LayoutInflater inflater   = Window.LayoutInflater;
            View           footerView = ((LayoutInflater)inflater.Context.GetSystemService(Context.LayoutInflaterService))
                                        .Inflate(Resource.Layout.FooterView, null, false);


            backButton = FindViewById <ImageButton>(Resource.Id.button_back);
            rateButton = FindViewById <ImageButton>(Resource.Id.button_rate);
            editButton = FindViewById <ImageButton>(Resource.Id.button_edit);
            listView   = FindViewById <ListView>(Resource.Id.list);
            listView.AddFooterView(footerView);

            addButton = FindViewById <ImageView>(Resource.Id.add_button);

            // Get Data using APIConnection
            List <SolutionModel> listSolution = new List <SolutionModel>();
            APIConnection        connector    = new APIConnection();

            listSolution = connector.GetData <List <SolutionModel> >(APIConnection.Solutions);

            listView.Adapter = new SolutionsAdapter(this, listSolution);

            addButton.Click += delegate
            {
                StartActivity(typeof(AddSolutionsActivity));
            };
            backButton.Click += delegate
            {
                this.OnBackPressed();
            };
            editButton.Click += delegate
            {
                Intent editSolutionActivity = new Intent(this, typeof(EditSolutionActivity));
                StartActivity(editSolutionActivity);
            };
        }
        public override void OnActivityCreated(Bundle savedInstanceState)
        {
            base.OnActivityCreated(savedInstanceState);
            FindViews();
            leftArrow.Click += LeftArrow_Click;
            btSave.Click    += BtSave_Click;
            btCancel.Click  += BtCancel_Click;

            if (userId != null)
            {
                if (index >= 0)
                {
                    list = connector.GetData <List <LandModel> >(APIConnection.LandsByUserId, userId);
                    var item   = list[index];
                    var bitmap = BitmapHelper.GetImageBitmapFromUrl(item.Land_image);
                    imageButton.SetImageBitmap(bitmap);
                    editTextName.Text = item.Land_name;
                    editTextDes.Text  = item.Land_address;
                }
            }
        }