예제 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Create your application here
            SetContentView(Resource.Layout.Boxgames);
            Bitmap monopoly = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.monopoly);
            Bitmap taki     = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.taki);
            Bitmap guesswho = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.guesswho);


            // int guesswho = Resource.Drawable.guesswho;
            //Bitmap football = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.football);
            // Bitmap tenis = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.ball);//
            //   Bitmap basketball = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.basketball);//

            Boxgames St1 = new Boxgames("7", "monopoly", 100, Helper.BitmapToBase64(monopoly), 6, 1, 4);
            Boxgames St2 = new Boxgames("8", "taki", 75, Helper.BitmapToBase64(taki), 6, 1, 8);
            Boxgames St3 = new Boxgames("9", "guesswho", 50, Helper.BitmapToBase64(guesswho), 3, 1, 10);

            //phase 2 - add to array list
            boxgamesList = new System.Collections.Generic.List <Boxgames>();
            boxgamesList.Add(St1);
            boxgamesList.Add(St2);
            boxgamesList.Add(St3);
            //phase 3 - create adapter
            boxgamesAdapter = new BoxgamesAdapter(this, boxgamesList);
            //phase 4 reference to listview
            iv = FindViewById <ImageView>(Resource.Id.iv);

            lv                         = FindViewById <ListView>(Resource.Id.lv);
            lv.Adapter                 = boxgamesAdapter;
            lv.OnItemClickListener     = this; //update
            lv.OnItemLongClickListener = this; //delete
        }
예제 #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.updateamount);
            // Create your application here
            ivProduct      = FindViewById <ImageView>(Resource.Id.ivProduct);
            tvTitle        = FindViewById <TextView>(Resource.Id.tvTitle);
            tvAge          = FindViewById <TextView>(Resource.Id.tvprudactid);
            tvPrice        = FindViewById <TextView>(Resource.Id.tvPrice);
            tvpayment      = FindViewById <TextView>(Resource.Id.tvpayment);
            etamount       = FindViewById <EditText>(Resource.Id.etamount);
            btnaddtomylist = FindViewById <Button>(Resource.Id.btnaddtomylist);
            btnaddtomylist.SetOnClickListener(this);
            btncalculate = FindViewById <Button>(Resource.Id.btncalculate);
            btncalculate.SetOnClickListener(this);
            btncancle = FindViewById <Button>(Resource.Id.btncancle);
            btncancle.SetOnClickListener(this);
            pos  = Intent.GetIntExtra("pos", -1);
            pos1 = Intent.GetIntExtra("pos1", -1);
            pos2 = Intent.GetIntExtra("pos2", -1);
            if (pos != -1)
            {
                temp = SportToyActivity.SporttoyList[pos];
                pw   = temp.GetPic();
                // ivProduct.SetImageBitmap(Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, temp.GetPic()));
                tvAge.Text     = temp.GetAge().ToString();
                tvTitle.Text   = temp.GetName();
                tvPrice.Text   = temp.GetPrice().ToString();
                tvpayment.Text = "0";
            }
            else if (pos1 != -1)
            {
                temp1 = WarToyActivity.WarToyList[pos1];
                pw    = temp1.GetPic();
                // ivProduct.SetImageBitmap(Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, temp1.GetPic()));
                tvAge.Text     = temp1.GetAge().ToString();
                tvTitle.Text   = temp1.GetName();
                tvPrice.Text   = temp1.GetPrice().ToString();
                tvpayment.Text = "0";
            }
            else if (pos2 != -1)
            {
                temp2 = BoxGamesActivity.boxgamesList[pos2];
                pw1   = temp2.GetPic();
                //  ivProduct = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Helper.Base64ToBitmap(pw1));
                tvAge.Text     = temp2.GetAge().ToString();
                tvTitle.Text   = temp2.GetName();
                tvPrice.Text   = temp2.GetPrice().ToString();
                tvpayment.Text = "0";
            }

            /*pw = temp.GetPic();
             * ivProduct.SetImageBitmap(Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, temp.GetPic()));
             * tvAge.Text = temp.GetAge().ToString();
             * tvTitle.Text = temp.GetName();
             * tvPrice.Text = temp.GetPrice().ToString();
             * tvpayment.Text = "0";*/
        }
예제 #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Create your application here
            SetContentView(Resource.Layout.Boxgames);
            //שמירת התמונות במשתנים
            Bitmap monopoly = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.monopoly);
            Bitmap taki     = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.taki);
            Bitmap guesswho = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.guesswho);
            Bitmap poker    = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.poker);
            Bitmap rps      = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.rps);
            Bitmap chesss   = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.chess);
            //יצירת עצמים
            Boxgames St1 = new Boxgames("7", "monopoly", 100, Helper.BitmapToBase64(monopoly), 6, 1, 1);
            Boxgames St2 = new Boxgames("8", "taki", 75, Helper.BitmapToBase64(taki), 6, 1, 8);
            Boxgames St3 = new Boxgames("9", "guesswho", 50, Helper.BitmapToBase64(guesswho), 3, 1, 1);
            Boxgames St4 = new Boxgames("30", "poker", 100, Helper.BitmapToBase64(poker), 16, 1, 1);
            Boxgames St5 = new Boxgames("31", "rps", 10, Helper.BitmapToBase64(rps), 3, 1, 1);
            Boxgames St6 = new Boxgames("32", "chess", 50, Helper.BitmapToBase64(chesss), 5, 1, 1);

            //phase 2 - add to array list
            boxgamesList = new System.Collections.Generic.List <Boxgames>();
            boxgamesList.Add(St1);
            boxgamesList.Add(St2);
            boxgamesList.Add(St3);
            boxgamesList.Add(St4);
            boxgamesList.Add(St5);
            boxgamesList.Add(St6);
            //phase 3 - create adapter
            boxgamesAdapter = new BoxgamesAdapter(this, boxgamesList);
            //phase 4 reference to listview
            iv = FindViewById <ImageView>(Resource.Id.iv);

            lv                     = FindViewById <ListView>(Resource.Id.lv);
            lv.Adapter             = boxgamesAdapter; //קישור לאדפטר
            lv.OnItemClickListener = this;            //update
        }