コード例 #1
0
        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());
            }
        }
コード例 #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());
            }
        }
コード例 #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Landscape);
            HorizontalScrollView hsw = FindViewById <HorizontalScrollView>(Resource.Id.HorizontalScrollView1);
            int            StoreId   = 2;
            int            userId    = Convert.ToInt32(CurrentUser.getUserId());
            List <Item>    myArr;
            ServiceWrapper sw     = new ServiceWrapper();
            var            output = sw.GetItemList(StoreId, userId).Result;

            myArr = output.ItemList.ToList();
            var gridview = FindViewById <GridView>(Resource.Id.gridview);
            HorizontalViewAdapter adapter = new HorizontalViewAdapter(this, myArr);

            gridview.SetNumColumns(myArr.Count);
            gridview.Adapter = adapter;
            //ListView lv = FindViewById<ListView>(Resource.Id.listView1);
            //lv.Adapter=adapter;
        }
コード例 #4
0
        protected override void OnCreate(Bundle bundle)
        {
            if (StoreName == "")
            {
                StoreName = Intent.GetStringExtra("MyData");
            }
            this.Title = StoreName;

            int StoreId = 1;
            //if (StoreName == "Wall Store")
            //    StoreId = 1;
            //else if (StoreName == "Point Pleasent Store")
            //    StoreId = 2;
            //else
            //    StoreId = 3;
            int            userId = Convert.ToInt32(CurrentUser.getUserId());
            ServiceWrapper sw     = new ServiceWrapper();
            var            output = sw.GetItemList(StoreId, userId).Result;

            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Potrait);
            ActionBar.SetHomeButtonEnabled(true);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            List <Item> myArr;

            myArr = output.ItemList.ToList();
            ListView       wineList = FindViewById <ListView>(Resource.Id.listView1);
            PotraitAdapter adapter  = new PotraitAdapter(this, myArr);

            wineList.Adapter    = adapter;
            wineList.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
            {
                var intent = new Intent(this, typeof(detailViewActivity));
                StartActivity(intent);
            };
        }
コード例 #5
0
ファイル: BlobWrapper.cs プロジェクト: sammy58492/MyProjects
        public static void DownloadImages(int userid)
        {
            ServiceWrapper sw = new ServiceWrapper();

            //    ProfilePicturePickDialog pppd = new ProfilePicturePickDialog();

            App._dir = new Java.IO.File(Android.OS.Environment.GetExternalStoragePublicDirectory("WineHangouts"), "winehangouts/wineimages");

            if (!App._dir.Exists())
            {
                App._dir.Mkdirs();
            }
            string path = App._dir.ToString();
            //ProfilePicturePickDialog pppd = new ProfilePicturePickDialog();
            //string path = pppd.CreateDirectoryForPictures();
            //string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            int           storeid = 3;
            DirectoryInfo di      = new DirectoryInfo(path);

            bool isthere = di.GetFiles(userid + ".jpg").Any();

            if (!isthere)
            {
                var    uri = new Uri(ServiceURL + "profileimages/" + userid + ".jpg");
                Bitmap bm  = GetImageBitmapFromUrl(uri.ToString());
                try
                {
                    var filePath = System.IO.Path.Combine(path + "/" + userid + ".jpg");
                    var stream   = new FileStream(filePath, FileMode.Create);
                    bm.Compress(Bitmap.CompressFormat.Jpeg, 100, stream);
                    stream.Close();
                }
                catch (Exception e)
                {
                    string Exe = e.ToString();
                }
            }

            for (int j = 1; j < storeid; j++)
            {
                var         output = sw.GetItemList(j, userid).Result;
                List <Item> x      = output.ItemList.ToList();
                int         y      = x.Count;
                for (int i = 0; i < y; i++)
                {
                    bool ispresent = di.GetFiles(x[i].WineId + ".").Any();
                    if (!ispresent)
                    {
                        var    uri = new Uri(ServiceURL + "bottleimages/" + x[i].WineId + ".jpg");
                        Bitmap bm  = GetImageBitmapFromUrl(uri.ToString());
                        try
                        {
                            var filePath = System.IO.Path.Combine(path + "/" + x[i].WineId + ".jpg");
                            var stream   = new FileStream(filePath, FileMode.Create);
                            bm.Compress(Bitmap.CompressFormat.Webp, 100, stream);
                            stream.Close();
                        }
                        catch (Exception e)
                        {
                            string Exe = e.ToString();
                        }
                    }
                }
            }
        }
コード例 #6
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();
            }
        }