private void BindGridData()
        {
            int StoreId = 0;

            if (StoreName == "Wall Store")
            {
                StoreId = 1;
            }
            else if (StoreName == "Point Pleasant Store")
            {
                StoreId = 2;
            }
            else
            {
                StoreId = 3;
            }
            try
            {
                int              userId = Convert.ToInt32(CurrentUser.getUserId());
                ServiceWrapper   sw     = new ServiceWrapper();
                ItemListResponse output = sw.GetItemList(StoreId, userId).Result;

                List <Item> myArr = output.ItemList.ToList();
                LoggingClass.LogInfo("entered into " + StoreName, screenid);
                var gridview = FindViewById <GridView>(Resource.Id.gridview);
                adapter = new GridViewAdapter(this, myArr, StoreId);
                LoggingClass.LogInfoEx("Entered into Grid View Adapter", screenid);
                gridview.SetNumColumns(2);
                gridview.Adapter = adapter;

                gridview.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
                {
                    WineBarcode = myArr[args.Position].Barcode;
                    // ProgressIndicator.Show(this);
                    AndHUD.Shared.Show(this, "Loading...", Convert.ToInt32(MaskType.Clear));
                    var intent = new Intent(this, typeof(DetailViewActivity));
                    LoggingClass.LogInfo("Clicked on " + myArr[args.Position].Barcode + " to enter into wine details", screenid);
                    intent.PutExtra("WineBarcode", WineBarcode);
                    intent.PutExtra("storeid", StoreId);
                    StartActivity(intent);
                };
                //TokenModel devInfo = new TokenModel();
                //var activityManager = (ActivityManager)this.GetSystemService(Context.ActivityService);

                //ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo();
                //activityManager.GetMemoryInfo(memInfo);

                //System.Diagnostics.Debug.WriteLine("GetDeviceInfo - Avail {0} - {1} MB", memInfo.AvailMem, memInfo.AvailMem / 1024 / 1024);
                //System.Diagnostics.Debug.WriteLine("GetDeviceInfo - Low {0}", memInfo.LowMemory);
                //System.Diagnostics.Debug.WriteLine("GetDeviceInfo - Total {0} - {1} MB", memInfo.TotalMem, memInfo.TotalMem / 1024 / 1024);

                //devInfo.AvailableMainMemory = memInfo.AvailMem;
                //devInfo.IsLowMainMemory = memInfo.LowMemory;
                //devInfo.TotalMainMemory = memInfo.TotalMem;
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
            }
        }
Beispiel #2
0
        private void BindGridData()
        {
            int StoreId = 0;

            if (StoreName == AppConstants.WallStore)
            {
                StoreId = 1;
            }
            else if (StoreName == AppConstants.PointPleasantStore)
            {
                StoreId = 2;
            }
            else if (StoreName == AppConstants.SecaucusStore)
            {
                StoreId = 3;
            }
            try
            {
                int              userId = Convert.ToInt32(CurrentUser.getUserId());
                ServiceWrapper   sw     = new ServiceWrapper();
                ItemListResponse output = sw.GetItemList(StoreId, userId).Result;

                List <Item> myArr = output.ItemList.ToList();
                if (myArr.Count == 0)
                {
                    AlertDialog.Builder aler = new AlertDialog.Builder(this);
                    aler.SetTitle("Secaucus Store");
                    aler.SetMessage("Coming Soon!");
                    aler.SetNegativeButton("Ok", delegate {
                        var intent = new Intent(this, typeof(Login));
                        StartActivity(intent);
                    });
                    LoggingClass.LogInfo("Clicked on Secaucus", screenid);
                    Dialog dialog = aler.Create();
                    dialog.Show();
                }
                LoggingClass.LogInfo("entered into " + StoreName, screenid);
                var gridview = FindViewById <GridView>(Resource.Id.gridview);
                adapter = new GridViewAdapter(this, myArr, StoreId);
                LoggingClass.LogInfoEx("Entered into Grid View Adapter", screenid);
                gridview.SetNumColumns(2);
                gridview.Adapter    = adapter;
                gridview.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
                {
                    WineBarcode = myArr[args.Position].Barcode;
                    ProgressIndicator.Show(this);
                    var intent = new Intent(this, typeof(DetailViewActivity));
                    LoggingClass.LogInfo("Clicked on " + myArr[args.Position].Barcode + " to enter into wine details", screenid);
                    intent.PutExtra("WineBarcode", WineBarcode);
                    StartActivity(intent);
                };
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
            }
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            this.Title = Intent.GetStringExtra("MyData") ?? "Data not available";
            SetContentView(Resource.Layout.Main);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            //var listview = FindViewById<ListView>(Resource.Id.gridview);
            List <Wine> myArr;

            myArr = SampleData();
            int x;

            var gridview = FindViewById <GridView>(Resource.Id.gridview);

            myArr = SampleData();

            GridViewAdapter adapter = new GridViewAdapter(this, myArr);

            gridview.Adapter = adapter;
            //gridview.SetColumnWidth(1);
            gridview.SetNumColumns(2);
            gridview.SetVerticalSpacing(2);
            gridview.SetHorizontalSpacing(1);

            gridview.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
            {
                //Toast.MakeText(this, args.Position.ToString(), ToastLength.Short).Show();
                x = args.Position;

                if (x == 0 || x == 1 || x == 2 || x == 3)
                {
                    var intent = new Intent(this, typeof(detailViewActivity));
                    StartActivity(intent);
                }
            };
        }
Beispiel #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="bundle"></param>
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            try
            {
                if (StoreName == "")
                {
                    StoreName = Intent.GetStringExtra("MyData");
                }
                this.Title = StoreName;
                this.ActionBar.SetHomeButtonEnabled(true);
                this.ActionBar.SetDisplayShowTitleEnabled(true);//  ToolbartItems.Add(new ToolbarItem { Text = "BTN 1", Icon = "myicon.png" });

                int StoreId = 0;
                if (StoreName == "Wall Store")
                {
                    StoreId = 1;
                }
                else if (StoreName == "Point Pleasant Store")
                {
                    StoreId = 2;
                }
                else
                {
                    StoreId = 3;
                }

                int              userId = Convert.ToInt32(CurrentUser.getUserId());
                ServiceWrapper   sw     = new ServiceWrapper();
                ItemListResponse output = new ItemListResponse();

                output = sw.GetItemList(StoreId, userId).Result;

                SetContentView(Resource.Layout.Main);
                ActionBar.SetHomeButtonEnabled(true);
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                //var listview = FindViewById<ListView>(Resource.Id.gridview);
                List <Item> myArr;
                //myArr = SampleData();
                myArr = output.ItemList.ToList();

                var gridview = FindViewById <GridView>(Resource.Id.gridview);
                //myArr = SampleData();

                GridViewAdapter adapter = new GridViewAdapter(this, myArr);
                gridview.SetNumColumns(2);
                gridview.Adapter = adapter;

                gridview.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
                {
                    WineID = myArr[args.Position].WineId;
                    //detailViewActivity dva = new detailViewActivity();
                    //dva.downloadAsync(sender, args, WineID);
                    ProgressIndicator.Show(this);
                    var intent = new Intent(this, typeof(detailViewActivity));
                    intent.PutExtra("WineID", WineID);
                    StartActivity(intent);
                    //    ProgressDialog progressdialog = ProgressDialog.Show(this, "Please Wait", "We are loading it");
                    //    new Thread(new ThreadStart(delegate
                    //{
                    //        RunOnUiThread(() => progressdialog.Show());
                    //    Thread.Sleep(10000);


                    //    RunOnUiThread(() => progressdialog.Dismiss());
                    //        //RunOnUiThread(() => progressDialog.Wait(1000));
                    //        //RunOnUiThread(() => progressDialog.Hide());
                    //    })).Start();
                };
                ProgressIndicator.Hide();
            }
            catch (Exception ex)
            {
                AlertDialog.Builder aler = new AlertDialog.Builder(this);
                aler.SetTitle("Sorry");
                aler.SetMessage("We're under maintainence");
                aler.SetNegativeButton("Ok", delegate { });
                Dialog dialog = aler.Create();
                dialog.Show();
            }
        }