コード例 #1
0
        public void myIteamClickMethod(object sender, AdapterView.ItemClickEventArgs e)
        {
            System.Console.WriteLine("I am clicking on the list item \n\n");
            var indexValue = e.Position;
            //var myValue = movieArray[indexValue];
            // System.Console.WriteLine("Value is \n\n " + myValue);
            string name = myUsersList3[indexValue].name;

            myDB = new DBHelperclass(this);
            myDB.deleteitem(name);
            myUsersList3.RemoveAt(indexValue);
            float price = 0;

            //calculating total price of items in list
            foreach (UserObject myObject in myUsersList3)
            {
                // Do something nifty here
                myDB.InsertValue(myObject.image, myObject.name, "0", myObject.age, "0");
                price += float.Parse(myObject.age);
            }
            totalprice.Text = "$" + price.ToString("0.00");

            MyCustomAdapter myAdapter = new MyCustomAdapter(this, myUsersList3);

            listView.Adapter       = myAdapter;
            removed_msg.Visibility = Android.Views.ViewStates.Visible;
        }
コード例 #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Userlistlayout);
            // Create your application here
            listView = FindViewById <ListView>(Resource.Id.List);
            mySearch = FindViewById <SearchView>(Resource.Id.searchID);
            vdb      = new DBHelperclass(this);



            //get cursor values

            // c_result.Add(new UserObject("lIST 1", "MENU", Resource.Drawable.user));
            // c_result.Add(new UserObject("lIST 2", "MENU", Resource.Drawable.user));
            //c_result.Add(new UserObject("lIST 3", "MENU", Resource.Drawable.user));


            // c_result.AddRange(newlist);
            //c_result.Add(new UserObject("Mike", "24" , Resource.Drawable.fb));


            myAdapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, arraymovie);

            listView.Adapter = myAdapter;



            listView.Adapter          = myAdapter;
            listView.ItemClick       += List_ItemClick;
            mySearch.QueryTextChange += MySearch_QueryTextChange;
        }
コード例 #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            // Set our view from the "main" layout resource
            RequestWindowFeature(Android.Views.WindowFeatures.ActionBar);
            //enable navigation mode to support tab layout
            this.ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;

            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.favlist);
            //get data from database fro the list

            dbcn = new DBHelperclass(this);

            ICursor myresut1 = dbcn.selectmovienames();

            var nameValue1 = "";

            //get cursor values
            if (myresut1.Count > 0)
            {
                while (myresut1.MoveToNext())
                {
                    nameValue1 = myresut1.GetString(myresut1.GetColumnIndexOrThrow("names"));
                    System.Console.WriteLine("Name from Database: " + nameValue1);

                    movieArray.Add(nameValue1);
                }
            }
            //databse code ends here
            ICursor myresut2 = dbcn.selectwatchlaternames();

            var nameValue2 = "";

            //get cursor values
            if (myresut2.Count > 0)
            {
                while (myresut2.MoveToNext())
                {
                    nameValue2 = myresut2.GetString(myresut1.GetColumnIndexOrThrow("names"));
                    System.Console.WriteLine("Name from Database: " + nameValue2);

                    movieArray2.Add(nameValue2);
                }
            }
            //databse code ends here

            _fragmentsArray = new Fragment[]
            {
                new Fragment1(this, movieArray),
                new Fragment2(this, movieArray2),
            };


            AddTabToActionBar("Favorites");   //First Tab
            AddTabToActionBar("Watch Later"); //First Tab
        }
コード例 #4
0
        void MyItemSelectedMethod(object sender, AdapterView.ItemSelectedEventArgs e)
        {
            var index = e.Position;

            var value = myCategory[index];

            System.Console.WriteLine("value is of spinner " + value);

            dbcn = new DBHelperclass(this);
            if (value.Equals("Add To Favorite List"))
            {
                Intent newScreen4 = new Intent(this, typeof(favlist));

                dbcn.InsertValue(500, moviename, "0", "0", "0");
                StartActivity(newScreen4);
            }
            if (value.Equals("Add to Watch Later"))
            {
                Intent newScreen4 = new Intent(this, typeof(favlist));

                dbcn.InsertValue(501, moviename, "0", "0", "0");
                StartActivity(newScreen4);
            }
        }
コード例 #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.orderlist);
            listView               = FindViewById <ListView>(Resource.Id.myListView3);
            totalprice             = FindViewById <TextView>(Resource.Id.price1);
            removed_msg            = FindViewById <TextView>(Resource.Id.removed);
            removed_msg.Visibility = Android.Views.ViewStates.Gone;
            //get orderlist data from database
            myDB     = new DBHelperclass(this);
            myresut3 = myDB.orderList();
            var   myId1 = 1; var nameValue1 = ""; var emailValue1 = ""; var ageValue1 = ""; var passValue1 = "";
            float price = 0;

            //get cursor values
            if (myresut3.Count > 0)
            {
                while (myresut3.MoveToNext())
                {
                    myId1 = myresut3.GetInt(myresut3.GetColumnIndexOrThrow("id"));
                    System.Console.WriteLine("ID from Database: " + myId1);


                    nameValue1 = myresut3.GetString(myresut3.GetColumnIndexOrThrow("names"));
                    System.Console.WriteLine("Name from Database: " + nameValue1);

                    emailValue1 = myresut3.GetString(myresut3.GetColumnIndexOrThrow("email"));
                    System.Console.WriteLine("Email from Database: " + emailValue1);

                    ageValue1 = myresut3.GetString(myresut3.GetColumnIndexOrThrow("age"));
                    System.Console.WriteLine("Age from Database: " + ageValue1);

                    passValue1 = myresut3.GetString(myresut3.GetColumnIndexOrThrow("password"));
                    System.Console.WriteLine("Password from Database: " + passValue1);

                    //adding data in userlist
                    myUsersList3.Add(new UserObject(nameValue1, ageValue1, myId1));

                    price += float.Parse(ageValue1);
                }
            }
            else
            {
                Console.WriteLine("There is data in order list!");
            }



            MyCustomAdapter myAdapter = new MyCustomAdapter(this, myUsersList3);

            listView.Adapter    = myAdapter;
            totalprice.Text     = "$" + price.ToString("0.00");
            listView.ItemClick += myIteamClickMethod;

            /*
             * myAdapter = new ArrayAdapter
             *  (this, Android.Resource.Layout.SimpleListItem1, movieArray);
             * myList.Adapter = myAdapter;
             * myList.ItemClick += myIteamClickMethod;
             *
             * mySearch = FindViewById<SearchView>(Resource.Id.searchID);
             * //Search Events
             * mySearch.QueryTextChange += mySearchMethod;
             */

            //adding menu in orderlist
            spinnerView = FindViewById <Spinner>(Resource.Id.spinner1);

            spinnerView.Adapter = new ArrayAdapter
                                      (this, Android.Resource.Layout.SimpleListItem1, myCategory);


            spinnerView.ItemSelected += MyItemSelectedMethod;
        }
コード例 #6
0
        protected override void OnCreate(Bundle savedInstanceState)

        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource

            SetContentView(Resource.Layout.activity_main);

            //fatching information from login page

            myUserName = FindViewById <EditText>(Resource.Id.userNameID);

            myPass = FindViewById <EditText>(Resource.Id.pass);

            myLoginbtn = FindViewById <Button>(Resource.Id.button1);

            signupBtn = FindViewById <Button>(Resource.Id.signup);



            alert = new Android.App.AlertDialog.Builder(this);

            myDB = new DBHelperclass(this); //create constructor



            signupBtn.Click += delegate

            {
                SetContentView(Resource.Layout.signup);

                // Intent newScreen = new Intent(this, typeof(DBHelperClass));



                // StartActivity(newScreen);
                //fatching information from signup page

                s_username = FindViewById <EditText>(Resource.Id.s_userNameID);

                s_email = FindViewById <EditText>(Resource.Id.s_email);

                s_age = FindViewById <EditText>(Resource.Id.s_age);

                s_pass = FindViewById <EditText>(Resource.Id.s_pass);

                s_signupBtn = FindViewById <Button>(Resource.Id.s_button1);

                s_signupBtn.Click += delegate

                {
                    var value5 = s_username.Text;

                    var value6 = s_email.Text;

                    var value7 = s_age.Text;

                    var value8 = s_pass.Text;

                    if (value5.Trim().Equals("") || value5.Length < 0 || value6.Trim().Equals("") ||

                        value6.Length < 0 || value7.Trim().Equals("") ||

                        value7.Length < 0 || value8.Trim().Equals("") ||

                        value8.Length < 0)

                    {
                        //show alert dialog button

                        alert.SetTitle("Error");

                        alert.SetMessage("Please Enter Valid Data");

                        alert.SetPositiveButton("OK", alertOKButton);

                        alert.SetNegativeButton("Cancel", alertOKButton);

                        Dialog myDialog = alert.Create();

                        myDialog.Show();
                    }

                    else

                    {
                        //insert in database here

                        //order to insert (int id, string value_username, string value_email, string value_age, string value_pass)



                        myDB.InsertValue(1, value5, value6, value7, value8);

                        //System.Console.WriteLine(value,value2, value3, value4);

                        myDB.SelectMydata();



                        //SetContentView(Resource.Layout.activity_main);
                        Intent newScreen = new Intent(this, typeof(MainActivity));



                        StartActivity(newScreen);
                    }
                };
            };



            myLoginbtn.Click += delegate

            {
                var value = myUserName.Text;

                var value2 = myPass.Text;



                System.Console.WriteLine("Username: ---- > " + value);

                System.Console.WriteLine("Password: ---- > " + value2);

                if (value.Trim().Equals("") || value.Length < 0 || value2.Trim().Equals("") || value2.Length < 0)

                {
                    alert.SetTitle("Error");

                    alert.SetMessage("Please Enter Valid Data");

                    alert.SetPositiveButton("OK", alertOKButton);

                    alert.SetNegativeButton("Cancel", alertOKButton);

                    Dialog myDialog = alert.Create();

                    myDialog.Show();
                }

                else

                {  // some value
                   //myDB.insertValue(1, value);



                    //myDB.SelectMydata();

                    Intent newScreen1 = new Intent(this, typeof(WelcomeNew));
                    newScreen1.PutExtra("usernameLogin", value);
                    newScreen1.PutExtra("passwordLogin", value2);


                    StartActivity(newScreen1);
                }
            };
        }
コード例 #7
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.welcomeLayout);
            // Create your application here

            valueFromLoginUser = Intent.GetStringExtra("usernameLogin");
            passwordFromLogin  = Intent.GetStringExtra("passwordLogin");
            name      = FindViewById <EditText>(Resource.Id.display_name);
            email     = FindViewById <EditText>(Resource.Id.display_email);
            age       = FindViewById <EditText>(Resource.Id.display_age);
            password  = FindViewById <EditText>(Resource.Id.display_password);
            editBtn   = FindViewById <Button>(Resource.Id.editBtn);
            deleteBtn = FindViewById <Button>(Resource.Id.DeleteBtn);
            userList  = FindViewById <Button>(Resource.Id.userlist);
            alert     = new Android.App.AlertDialog.Builder(this);

            //assign value
            name.Text = valueFromLoginUser;
            //Read Only
            name.Enabled = false;
            ICursor myresut1;

            /// ???
            dbcn     = new DBHelperclass(this);
            myresut1 = dbcn.SelectUserdata(valueFromLoginUser, passwordFromLogin);

            var myId1 = 1; var nameValue1 = ""; var emailValue1 = ""; var ageValue1 = ""; var passValue1 = "";

            //get cursor values
            if (myresut1.Count > 0)
            {
                while (myresut1.MoveToNext())
                {
                    myId1 = myresut1.GetInt(myresut1.GetColumnIndexOrThrow("id"));
                    System.Console.WriteLine("ID from Database: " + myId1);


                    nameValue1 = myresut1.GetString(myresut1.GetColumnIndexOrThrow("names"));
                    System.Console.WriteLine("Name from Database: " + nameValue1);

                    emailValue1 = myresut1.GetString(myresut1.GetColumnIndexOrThrow("email"));
                    System.Console.WriteLine("Email from Database: " + emailValue1);

                    ageValue1 = myresut1.GetString(myresut1.GetColumnIndexOrThrow("age"));
                    System.Console.WriteLine("Age from Database: " + ageValue1);

                    passValue1 = myresut1.GetString(myresut1.GetColumnIndexOrThrow("password"));
                    System.Console.WriteLine("Password from Database: " + passValue1);
                }
                //assign value
                email.Text = emailValue1;
                //Read Only
                email.Enabled = false;
                //assign value
                age.Text = ageValue1;
                //Read Only
                age.Enabled = false;
                //assign value
                password.Text = passValue1;
                //Read Only
                password.Enabled = false;
                System.Console.WriteLine("Name from Login ---> " + valueFromLoginUser);
                System.Console.WriteLine("Pasword from Login ---> " + passwordFromLogin);


                editBtn.Click   += editBtnClicEvent;
                deleteBtn.Click += editBtnClicEvent2;
                userList.Click  += delegate
                {
                    Intent newScreen = new Intent(this, typeof(Userlistactivity));



                    StartActivity(newScreen);
                };
            }
            else
            {
                Console.WriteLine("User doesnt exitst!");
                alert.SetTitle("Error");

                alert.SetMessage("USER DOESN'T EXIST");

                alert.SetPositiveButton("OK", alertOKButton);

                alert.SetNegativeButton("Cancel", alertOKButton);

                Dialog myDialog = alert.Create();

                myDialog.Show();

                Intent newScreen1 = new Intent(this, typeof(MainActivity));
                StartActivity(newScreen1);
            }
        }
コード例 #8
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.iteminfo);
            itemid = Intent.GetIntExtra("item_id", 0);
            Console.WriteLine("item id: " + itemid);
            itemDetails          = FindViewById <TextView>(Resource.Id.t1);
            itemPrice            = FindViewById <TextView>(Resource.Id.t2);
            itemimg              = FindViewById <ImageView>(Resource.Id.image1);
            itemOrder            = FindViewById <Button>(Resource.Id.add_button);
            openorder            = FindViewById <Button>(Resource.Id.show_button);
            openorder.Visibility = Android.Views.ViewStates.Gone;
            small = FindViewById <Button>(Resource.Id.s);
            med   = FindViewById <Button>(Resource.Id.m);
            large = FindViewById <Button>(Resource.Id.l);

            //creating database object to access database
            DBHelperclass myDB;

            myDB = new DBHelperclass(this);

            //select small size by default, and disable button
            small.Enabled = false;
            int size = 1;

            //initializing price variables for small size coffee
            Double p0 = 1.99, p1 = 2.99, p2 = 2.99, p3 = 2.00, p4 = 1.99, p5 = 2.99, p6 = 2.99, p7 = 2.00;

            /*
             * on clicking medium size button
             * disable medium button and enable rest of buttons,
             * change price accordingly
             * and setting itemprize on page
             */
            med.Click += delegate
            {
                small.Enabled = true;
                med.Enabled   = false;
                large.Enabled = true;
                size          = 2;
                p0            = 2.99; p1 = 3.99; p2 = 3.99; p3 = 3.00; p4 = 2.99; p5 = 3.99; p6 = 3.99; p7 = 3.00;

                if (itemid == 0)
                {
                    itemPrice.Text = "$" + p0.ToString();
                }
                else if (itemid == 1)
                {
                    itemPrice.Text = "$" + p1.ToString();
                }
                else if (itemid == 2)
                {
                    itemPrice.Text = "$" + p2.ToString();
                }
                else if (itemid == 3)
                {
                    itemPrice.Text = "$" + p3.ToString();
                }
                else if (itemid == 4)
                {
                    itemPrice.Text = "$" + p4.ToString();
                }
                else if (itemid == 5)
                {
                    itemPrice.Text = "$" + p5.ToString();
                }
                else if (itemid == 6)
                {
                    itemPrice.Text = "$" + p6.ToString();
                }
                else if (itemid == 7)
                {
                    itemPrice.Text = "$" + p7.ToString();
                }
            };
            small.Click += delegate
            {
                small.Enabled = false;
                med.Enabled   = true;
                large.Enabled = true;
                size          = 1;
                p0            = 1.99; p1 = 2.99; p2 = 2.99; p3 = 2.00; p4 = 1.99; p5 = 2.99; p6 = 2.99; p7 = 2.00;
                if (itemid == 0)
                {
                    itemPrice.Text = "$" + p0.ToString();
                }
                else if (itemid == 1)
                {
                    itemPrice.Text = "$" + p1.ToString();
                }
                else if (itemid == 2)
                {
                    itemPrice.Text = "$" + p2.ToString();
                }
                else if (itemid == 3)
                {
                    itemPrice.Text = "$" + p3.ToString();
                }
                else if (itemid == 4)
                {
                    itemPrice.Text = "$" + p4.ToString();
                }
                else if (itemid == 5)
                {
                    itemPrice.Text = "$" + p5.ToString();
                }
                else if (itemid == 6)
                {
                    itemPrice.Text = "$" + p6.ToString();
                }
                else if (itemid == 7)
                {
                    itemPrice.Text = "$" + p7.ToString();
                }
            };
            large.Click += delegate
            {
                small.Enabled = true;
                med.Enabled   = true;
                large.Enabled = false;
                size          = 3;
                p0            = 3.99; p1 = 4.99; p2 = 4.99; p3 = 4.00; p4 = 3.99; p5 = 4.99; p6 = 4.99; p7 = 4.00;

                if (itemid == 0)
                {
                    itemPrice.Text = "$" + p0.ToString();
                }
                else if (itemid == 1)
                {
                    itemPrice.Text = "$" + p1.ToString();
                }
                else if (itemid == 2)
                {
                    itemPrice.Text = "$" + p2.ToString();
                }
                else if (itemid == 3)
                {
                    itemPrice.Text = "$" + p3.ToString();
                }
                else if (itemid == 4)
                {
                    itemPrice.Text = "$" + p4.ToString();
                }
                else if (itemid == 5)
                {
                    itemPrice.Text = "$" + p5.ToString();
                }
                else if (itemid == 6)
                {
                    itemPrice.Text = "$" + p6.ToString();
                }
                else if (itemid == 7)
                {
                    itemPrice.Text = "$" + p7.ToString();
                }
            };

            //open order list
            openorder.Click += delegate
            {
                myDB.SelectMydata();

                //pass details or order to next page via database
                //SetContentView(Resource.Layout.activity_main);
                Intent newScreen = new Intent(this, typeof(orderlist));


                StartActivity(newScreen);
            };
            if (itemid == 0)
            {
                int resourceId = (int)typeof(Resource.Drawable).GetField("drink1").GetValue(null); //getting image id
                itemimg.SetImageResource(resourceId);
                itemDetails.Text = "A medium roast blend, expertly roasted with care to deliver a perfect balance and the unique Tim Hortons taste that has made it Canada's Favourite Coffee.";
                itemPrice.Text   = "$" + p0.ToString();
            }
            else if (itemid == 1)
            {
                int resourceId = (int)typeof(Resource.Drawable).GetField("drink2").GetValue(null);
                itemimg.SetImageResource(resourceId);
                itemDetails.Text = "Our premium 100% Arabica beans are roasted to deliver a darker, richer and smooth flavour that all dark roast coffee lovers can enjoy.";
                itemPrice.Text   = "$" + p1.ToString();
            }
            else if (itemid == 2)
            {
                int resourceId = (int)typeof(Resource.Drawable).GetField("drink3").GetValue(null);
                itemimg.SetImageResource(resourceId);
                itemDetails.Text = "A refreshing frozen drink blended with real lemon, sweetened and served ice cold, this tangy crowd pleaser comes in Original or Raspberry Flavour. ";
                itemPrice.Text   = "$" + p2.ToString();
            }
            else if (itemid == 3)
            {
                int resourceId = (int)typeof(Resource.Drawable).GetField("drink4").GetValue(null);
                itemimg.SetImageResource(resourceId);
                itemDetails.Text = "A delicious combination of real cream and layers of chocolaty goodness. It’s the perfect summer treat that takes chocolaty to the next level";
                itemPrice.Text   = "$" + p3.ToString();
            }
            else if (itemid == 4)
            {
                int resourceId = (int)typeof(Resource.Drawable).GetField("snack1").GetValue(null);
                itemimg.SetImageResource(resourceId);
                itemDetails.Text = "The ultimate breakfast bagel, made fresh on the spot. Three pieces of crisp bacon, seasoned egg patty, fresh lettuce, ripe tomato and processed cheese, all stacked up on your choice of Always Fresh Bagel. ";
                itemPrice.Text   = "$" + p4.ToString();
            }
            else if (itemid == 5)
            {
                int resourceId = (int)typeof(Resource.Drawable).GetField("snack2").GetValue(null);
                itemimg.SetImageResource(resourceId);
                itemDetails.Text = "This is what “good morning” tastes like. Your choice of sausage, three pieces of crisp bacon, seasoned egg omelette and processed cheese on a Homestyle Biscuit, English Muffin or toasted Bagel. Not a meat lover? Hold the sausage, or bacon. ";
                itemPrice.Text   = "$" + p5.ToString();
            }
            else if (itemid == 6)
            {
                int resourceId = (int)typeof(Resource.Drawable).GetField("snack3").GetValue(null);
                itemimg.SetImageResource(resourceId);
                itemDetails.Text = "Available with our grilled seasoned chicken strips, bacon, tomato, lettuce and ranch sauce.";
                itemPrice.Text   = "$" + p6.ToString();
            }
            else if (itemid == 7)
            {
                int resourceId = (int)typeof(Resource.Drawable).GetField("snack4").GetValue(null);
                itemimg.SetImageResource(resourceId);
                itemDetails.Text = "Your choice of seasoned grilled chicken strips, cheddar cheese, lettuce, tomato and chipotle sauce wrapped in a tortilla and grilled to perfection.";
                itemPrice.Text   = "$" + p7.ToString();
            }


            itemOrder.Click += delegate
            {
                //open order list


                if (itemid == 0)
                {
                    int resourceId = (int)typeof(Resource.Drawable).GetField("drink1").GetValue(null);
                    itemimg.SetImageResource(resourceId);
                    myDB.InsertValue(resourceId, "Coffee", "0", p0.ToString(), "0");
                }
                else if (itemid == 1)
                {
                    int resourceId = (int)typeof(Resource.Drawable).GetField("drink2").GetValue(null);
                    itemimg.SetImageResource(resourceId);
                    myDB.InsertValue(resourceId, "Dark Roast", "0", p1.ToString(), "0");
                }
                else if (itemid == 2)
                {
                    int resourceId = (int)typeof(Resource.Drawable).GetField("drink3").GetValue(null);
                    itemimg.SetImageResource(resourceId);
                    myDB.InsertValue(resourceId, "Lemonade", "0", p2.ToString(), "0");
                }
                else if (itemid == 3)
                {
                    int resourceId = (int)typeof(Resource.Drawable).GetField("drink4").GetValue(null);
                    itemimg.SetImageResource(resourceId);
                    myDB.InsertValue(resourceId, "Choco Chips", "0", p3.ToString(), "0");
                }
                else if (itemid == 4)
                {
                    int resourceId = (int)typeof(Resource.Drawable).GetField("snack1").GetValue(null);
                    itemimg.SetImageResource(resourceId);
                    myDB.InsertValue(resourceId, "Bagel", "0", p4.ToString(), "0");
                }
                else if (itemid == 5)
                {
                    int resourceId = (int)typeof(Resource.Drawable).GetField("snack2").GetValue(null);
                    itemimg.SetImageResource(resourceId);
                    myDB.InsertValue(resourceId, "Sandwich", "0", p5.ToString(), "0");
                }
                else if (itemid == 6)
                {
                    int resourceId = (int)typeof(Resource.Drawable).GetField("snack3").GetValue(null);
                    itemimg.SetImageResource(resourceId);
                    myDB.InsertValue(resourceId, "Egg Wrap", "0", p6.ToString(), "0");
                }
                else if (itemid == 7)
                {
                    int resourceId = (int)typeof(Resource.Drawable).GetField("snack4").GetValue(null);
                    itemimg.SetImageResource(resourceId);
                    myDB.InsertValue(resourceId, "Chicken Wrap", "0", p7.ToString(), "0");
                }



                itemOrder.Visibility = Android.Views.ViewStates.Gone;    //hide button
                openorder.Visibility = Android.Views.ViewStates.Visible; //show button
            };
        }
コード例 #9
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.welcomeLayout);
            // Create your application here

            valueFromLoginUser = Intent.GetStringExtra("usernameLogin");
            passwordFromLogin  = Intent.GetStringExtra("passwordLogin");
            name      = FindViewById <EditText>(Resource.Id.display_name);
            email     = FindViewById <EditText>(Resource.Id.display_email);
            age       = FindViewById <EditText>(Resource.Id.display_age);
            password  = FindViewById <EditText>(Resource.Id.display_password);
            editBtn   = FindViewById <Button>(Resource.Id.editBtn);
            deleteBtn = FindViewById <Button>(Resource.Id.DeleteBtn);
            alert     = new Android.App.AlertDialog.Builder(this);
            myList    = FindViewById <ListView>(Resource.Id.myListView);
            greeting  = FindViewById <TextView>(Resource.Id.greetings);

            //assign value
            name.Text     = valueFromLoginUser;
            greeting.Text = valueFromLoginUser.ToUpper();
            //Read Only
            name.Visibility = Android.Views.ViewStates.Gone;
            ICursor myresut1;

            /// ???
            dbcn = new DBHelperclass(this);
            dbcn.clearorderlist();
            myresut1 = dbcn.SelectUserdata(valueFromLoginUser, passwordFromLogin);

            myAdapter = new ArrayAdapter
                            (this, Android.Resource.Layout.SimpleListItem1, locnArray);
            myList.Adapter    = myAdapter;
            myList.ItemClick += myIteamClickMethod;

            mySearch = FindViewById <SearchView>(Resource.Id.searchID);
            //Search Events
            mySearch.QueryTextChange += mySearchMethod;

            var myId1 = 1; var nameValue1 = ""; var emailValue1 = ""; var ageValue1 = ""; var passValue1 = "";

            //get cursor values
            if (myresut1.Count > 0)
            {
                while (myresut1.MoveToNext())
                {
                    myId1 = myresut1.GetInt(myresut1.GetColumnIndexOrThrow("id"));
                    System.Console.WriteLine("ID from Database: " + myId1);


                    nameValue1 = myresut1.GetString(myresut1.GetColumnIndexOrThrow("names"));
                    System.Console.WriteLine("Name from Database: " + nameValue1);

                    emailValue1 = myresut1.GetString(myresut1.GetColumnIndexOrThrow("email"));
                    System.Console.WriteLine("Email from Database: " + emailValue1);

                    ageValue1 = myresut1.GetString(myresut1.GetColumnIndexOrThrow("age"));
                    System.Console.WriteLine("Age from Database: " + ageValue1);

                    passValue1 = myresut1.GetString(myresut1.GetColumnIndexOrThrow("password"));
                    System.Console.WriteLine("Password from Database: " + passValue1);
                }
                //assign value
                email.Text = emailValue1;
                //Read Only
                email.Visibility = Android.Views.ViewStates.Gone;
                //assign value
                age.Text = ageValue1;
                //Read Only
                age.Visibility = Android.Views.ViewStates.Gone;
                //assign value
                password.Text = passValue1;
                //Read Only
                password.Visibility = Android.Views.ViewStates.Gone;
                System.Console.WriteLine("Name from Login ---> " + valueFromLoginUser);
                System.Console.WriteLine("Pasword from Login ---> " + passwordFromLogin);


                editBtn.Click   += editBtnClicEvent;
                deleteBtn.Click += editBtnClicEvent2;
            }
            else
            {
                Console.WriteLine("User doesnt exitst!");
                alert.SetTitle("Error");

                alert.SetMessage("USER DOESN'T EXIST");

                alert.SetPositiveButton("OK", alertOKButton);

                alert.SetNegativeButton("Cancel", alertOKButton);

                Dialog myDialog = alert.Create();

                myDialog.Show();

                Intent newScreen1 = new Intent(this, typeof(MainActivity));
                StartActivity(newScreen1);
            }
        }