コード例 #1
0
        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);
            if (resultCode.ToString() == "Canceled")
            {
                LoggingClass.LogInfo("Cancelled from camera", screenid);
                Intent intent = new Intent(this, typeof(TabActivity));
                StartActivity(intent);
            }
            else
            {
                // Make it available in the gallery
                try
                {
                    Intent mediaScanIntent = new Intent(Intent.ActionMediaScannerScanFile);
                    Uri    contentUri      = Uri.FromFile(App._file);
                    mediaScanIntent.SetData(contentUri);
                    SendBroadcast(mediaScanIntent);
                }
                catch (Exception exe)
                {
                    LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                    Intent intent1 = new Intent(this, typeof(ProfileActivity));
                    StartActivity(intent1);
                }
                Resize();
                UploadProfilePic(path);
                Intent intent = new Intent(this, typeof(TabActivity));
                StartActivity(intent);
                GC.Collect();

                //LoggingClass.LogTime("profile  piccture ",st.Elapsed.TotalSeconds.ToString());
            }
        }
コード例 #2
0
        private void BindGridData()
        {
            try
            {
                ServiceWrapper svc = new ServiceWrapper();

                var MYtastings = svc.GetMyTastingsList(customerid).Result;
                myArr1 = MYtastings.TastingList.ToList();
                ListView wineList = FindViewById <ListView>(Resource.Id.MyTasting);
                wineList.Clickable = true;
                MyTastingAdapter adapter = new MyTastingAdapter(this, MYtastings.TastingList.ToList());
                wineList.Adapter    = adapter;
                wineList.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
                {
                    string WineBarcode = myArr1[args.Position].Barcode;
                    int    storeID     = myArr1[args.Position].PlantFinal;
                    LoggingClass.LogInfo("Clicked on " + myArr1[args.Position].Barcode + " to enter into wine from tasting  details", screenid);
                    ProgressIndicator.Show(this);
                    var intent = new Intent(this, typeof(DetailViewActivity));
                    intent.PutExtra("WineBarcode", WineBarcode);
                    intent.PutExtra("storeid", storeID);
                    StartActivity(intent);
                };
                ProgressIndicator.Hide();
                AndHUD.Shared.Dismiss();
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
            }
        }
コード例 #3
0
        public async void ShowInfo(CustomerResponse AuthServ)
        {
            int count = 0;
            int cou   = 0;

            AndHUD.Shared.Show(this, "Please Wait...", Convert.ToInt32(MaskType.Clear));
            try
            {
                if (AuthServ.customer.Email != "" && AuthServ.customer.Email != null)
                {
                    TxtScanresult.Text = AuthServ.ErrorDescription;    // " Hi " + AuthServ.customer.FirstName + authen.customer.LastName + ",\n We have sent an email at  " + authen.customer.Email + ".\n Please verify email to continue login. \n If you have not received email Click Resend Email.\n To get Email Id changed, contact store.";

                    TxtScanresult.SetTextColor(Android.Graphics.Color.Black);
                    BtnResend.Visibility      = ViewStates.Visible;
                    BtnLogin.Visibility       = ViewStates.Visible;
                    BtnContinue.Visibility    = ViewStates.Gone;
                    BtnUpdateEmail.Visibility = ViewStates.Gone;
                    BtnResend.Click          += async delegate
                    {
                        try
                        {
                            if (count == 0)
                            {
                                AndHUD.Shared.Show(this, "Sending verification email to " + AuthServ.customer.Email, Convert.ToInt32(MaskType.Clear));
                                count = 1;
                                LoggingClass.LogInfo("Resend email " + AuthServ.customer.Email, screenid);
                                await svc.ResendEMail(CurrentUser.GetCardNumber());

                                AndHUD.Shared.ShowSuccess(this, "Sent", MaskType.Clear, TimeSpan.FromSeconds(2));
                                AndHUD.Shared.Dismiss();
                            }
                        }
                        catch (Exception ex)
                        {
                        }
                    };
                    count           = 0;
                    BtnLogin.Click += delegate
                    {
                        LoggingClass.LogInfo("Clicked on Login " + AuthServ.customer.CardNumber, screenid);

                        AndHUD.Shared.Show(this, "Checking Email Verification", Convert.ToInt32(MaskType.Clear));
                        EmailVerification();
                    };
                }
                else
                {
                    TxtScanresult.Text = AuthServ.ErrorDescription;
                    TxtScanresult.SetTextColor(Android.Graphics.Color.Red);
                }
                AndHUD.Shared.Dismiss();
            }

            catch (Exception ex)
            {
                LoggingClass.LogError(ex.Message, screenid, ex.StackTrace);
            }

            AndHUD.Shared.Dismiss();
        }
コード例 #4
0
        public async Task <CustomerResponse> ContinueService(CustomerResponse customer)
        {
            sw.Start();

            CustomerResponse output = null;

            try
            {
                var    uri     = new Uri(ServiceURL + "ContinueClick/");
                var    content = JsonConvert.SerializeObject(customer);
                var    cont    = new StringContent(content, System.Text.Encoding.UTF8, "application/json");
                string Token   = CurrentUser.GetAuthToken();
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Token);
                var response = await client.PostAsync(uri, cont).ConfigureAwait(false);

                if (response.IsSuccessStatusCode)
                {
                    var tokenJson = await response.Content.ReadAsStringAsync();

                    output = JsonConvert.DeserializeObject <CustomerResponse>(tokenJson);
                }
                //var result = response.Content.ReadAsStringAsync().Result;
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screenid, ex.StackTrace);
            }
            sw.Stop();
            LoggingClass.LogServiceInfo("Service " + sw.Elapsed.TotalSeconds, "Continue Service");
            //Console.WriteLine("UpdateCustomer service Time Elapsed"+sw.Elapsed.TotalSeconds);
            return(output);
        }
コード例 #5
0
        //Stopwatch st;
        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            //st.Start();
            base.OnActivityResult(requestCode, resultCode, data);
            LoggingClass.LogInfo("Entered into ProfilePictureGallery", screenid);
            if (resultCode == Result.Ok)
            {
                string Path = GetRealPathFromURI(data.Data);
                try
                {
                    Bitmap propic = BitmapFactory.DecodeFile(Path);
                    ProfilePicturePickDialog pppd = new ProfilePicturePickDialog();
                    string dir_path = pppd.CreateDirectoryForPictures();
                    dir_path = dir_path + "/" + Convert.ToInt32(CurrentUser.getUserId()) + ".jpg";
                    ProfileActivity pa       = new ProfileActivity();
                    Bitmap          resized  = pa.Resize(propic, 400, 400);
                    var             filePath = System.IO.Path.Combine(dir_path);
                    var             stream   = new FileStream(filePath, FileMode.Create);
                    resized.Compress(Bitmap.CompressFormat.Jpeg, 100, stream);
                    stream.Close();
                    pppd.UploadProfilePic(filePath);
                    Intent intent = new Intent(this, typeof(TabActivity));
                    StartActivity(intent);
                }

                catch (Exception exe)
                {
                    LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                }
            }
            //st.Stop();
            //LoggingClass.LogTime("profile pic gall time", st.Elapsed.TotalSeconds.ToString());
        }
コード例 #6
0
        public async Task <int> UpdateCustomer(Customer customer)
        {
            sw.Start();
            try
            {
                LoggingClass.LogServiceInfo("service called", "UpdateCustomer");
                var    uri     = new Uri(ServiceURL + "UpdateCustomer/");
                var    content = JsonConvert.SerializeObject(customer);
                var    cont    = new StringContent(content, System.Text.Encoding.UTF8, "application/json");
                string Token   = CurrentUser.GetAuthToken();
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Token);
                var response = await client.PostAsync(uri, cont);                 // In debug mode it do not work, Else it works

                LoggingClass.LogServiceInfo("service responce", "UpdateCustomer");
                //var result = response.Content.ReadAsStringAsync().Result;
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
            }
            sw.Stop();

            LoggingClass.LogTime("The total time to  start and end the service UpdateCustomer", "The timer ran for " + sw.Elapsed.TotalSeconds);

            return(1);
        }
コード例 #7
0
        public async Task <CustomerResponse> UpdateMail(string email, string userid)
        {
            sw.Start();
            CustomerResponse output = null;

            try
            {
                var    uri     = new Uri(ServiceURL + "UpdateEmailAddress/" + email + "/user/" + userid);
                var    content = JsonConvert.SerializeObject(email);
                var    cont    = new StringContent(content, System.Text.Encoding.UTF8, "application/json");
                string Token   = CurrentUser.GetAuthToken();
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Token);
                var response = await client.GetStringAsync(uri).ConfigureAwait(false);

                output = JsonConvert.DeserializeObject <CustomerResponse>(response);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screenid, ex.StackTrace);
            }
            sw.Stop();
            LoggingClass.LogServiceInfo("Service " + sw.Elapsed.TotalSeconds, "Email Update Service");
            return(output);
        }
コード例 #8
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());
            }
        }
コード例 #9
0
        protected override void OnCreate(Bundle bundle)
        {
            Stopwatch st = new Stopwatch();

            st.Start();
            base.OnCreate(bundle);
            customerid = Convert.ToInt32(CurrentUser.getUserId());

            try
            {
                LoggingClass.LogInfo("Entered into My Tasting", screenid);
                this.ActionBar.SetHomeButtonEnabled(true);
                this.ActionBar.SetDisplayHomeAsUpEnabled(true);

                ServiceWrapper svc = new ServiceWrapper();

                var MYtastings = svc.GetMyTastingsList(customerid).Result;
                myArr1 = MYtastings.TastingList.ToList();
                if (MYtastings.TastingList.Count == 0)
                {
                    SetContentView(Resource.Layout.EmptyTaste);
                    TextView te = FindViewById <TextView>(Resource.Id.textView123a);
                }
                else
                {
                    SetContentView(Resource.Layout.MyTasting);

                    BindGridData();
                    SwipeRefreshLayout mSwipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.PullDownRefresh1);

                    //mSwipeRefreshLayout.Refresh += MSwipeRefreshLayout_Refresh;
                    //mSwipeRefreshLayout.SetColorScheme(Resource.Color.abc_background_cache_hint_selector_material_dark, Resource.Color.abc_background_cache_hint_selector_material_light);

                    mSwipeRefreshLayout.Refresh += async delegate {
                        //BindGridData();
                        LoggingClass.LogInfo("Refreshed My Tasting", screenid);
                        await SomeAsync();

                        mSwipeRefreshLayout.Refreshing = false;
                    };

                    ActionBar.SetHomeButtonEnabled(true);
                    ActionBar.SetDisplayHomeAsUpEnabled(true);
                }
                ProgressIndicator.Hide();
            }

            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                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();
            }
            st.Stop();
            LoggingClass.LogTime("Tastingactivity", st.Elapsed.TotalSeconds.ToString());
        }
コード例 #10
0
        public async void EmailVerification()
        {
            DeviceToken DO = new DeviceToken();

            try
            {
                DO = await sc.CheckMail(CurrentUser.getUserId());
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
            }
            if (DO.VerificationStatus == 1)
            {
                Intent intent = new Intent(this, typeof(TabActivity));
                StartActivity(intent);
            }
            else
            {
                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetTitle("Sorry");
                alert.SetMessage("Please verify your mail id");
                alert.SetNegativeButton("Ok", delegate { });
                Dialog dialog = alert.Create();
                dialog.Show();
            }
        }
コード例 #11
0
        public async Task <CustomerResponse> AuthencateUser(string Email, string CardId, string uid)
        {
            sw.Start();
            CustomerResponse output = null;

            LoggingClass.LogServiceInfo("Service Call", "AuthencateUser");
            try
            {
                var uri       = new Uri(ServiceURL + "AuthenticateUserBeta/" + CardId + "/email/" + Email + "/DeviceId/" + uid);
                var byteArray = new UTF8Encoding().GetBytes(CardId + ":password");
                client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
                client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                var response = await client.GetAsync(uri).ConfigureAwait(false);

                if (response.IsSuccessStatusCode)
                {
                    string Token = response.RequestMessage.Headers.Authorization.Parameter;
                    CurrentUser.SaveAuthToken(Token);
                    output = JsonConvert.DeserializeObject <CustomerResponse>(response.Content.ReadAsStringAsync().Result);
                    LoggingClass.LogServiceInfo("Service Response", "AuthencateUser");
                }
                else
                {
                    AlertActivity a = new AlertActivity();
                    a.UnAuthourised();
                }
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screenid, ex.StackTrace);
            }
            sw.Stop();
            LoggingClass.LogServiceInfo("Service responce " + sw.Elapsed.TotalSeconds, "AuthencateUser");
            return(output);
        }
コード例 #12
0
        public void EditPopup(object sender, EventArgs e)
        {
            try
            {
                Dialog editDialog = new Dialog(Parent);
                int    screenid   = 18;
                editDialog.SetContentView(Resource.Layout.EditReviewPopup);
                ServiceWrapper sw              = new ServiceWrapper();
                Review         review          = new Review();
                ImageButton    close           = editDialog.FindViewById <ImageButton>(Resource.Id.close);
                Button         btnSubmitReview = editDialog.FindViewById <Button>(Resource.Id.btnSubmitReview);
                TextView       Comments        = editDialog.FindViewById <TextView>(Resource.Id.txtReviewComments);
                RatingBar      custRating      = editDialog.FindViewById <RatingBar>(Resource.Id.rating);
                Comments.Text     = _editObj.RatingText;
                custRating.Rating = _editObj.RatingStars;
                LoggingClass.LogInfo("Entered into EditPopup", screenid);
                close.SetScaleType(ImageView.ScaleType.CenterCrop);
                editDialog.Window.SetBackgroundDrawable(new Android.Graphics.Drawables.ColorDrawable(Android.Graphics.Color.Transparent));
                editDialog.Show();
                editDialog.SetCanceledOnTouchOutside(false);

                close.Click += delegate
                {
                    LoggingClass.LogInfo("Closed PoPup", screenid);
                    editDialog.Dismiss();
                };
                btnSubmitReview.Click += async delegate
                {
                    AndHUD.Shared.Show(Parent, "Saving Review...", Convert.ToInt32(MaskType.Clear));
                    review.ReviewDate   = DateTime.Now;
                    review.ReviewUserId = Convert.ToInt32(CurrentUser.getUserId());
                    review.RatingText   = Comments.Text;
                    review.RatingStars  = Convert.ToInt32(custRating.Rating);
                    review.IsActive     = true;
                    review.PlantFinal   = storeid;
                    review.Barcode      = WineBarcode;
                    try
                    {
                        await sw.InsertUpdateReview(review);

                        LoggingClass.LogInfo("Edited Review-----> " + review.RatingText + "-----> " + review.RatingStars + "----->" + review.Barcode + "----->" + review.PlantFinal + "submitted", screenid);
                    }

                    catch (Exception exe)
                    {
                        LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                    }
                    ((IPopupParent)Parent).RefreshParent();
                    AndHUD.Shared.Dismiss();
                    AndHUD.Shared.ShowSuccess(Parent, "Sucessfully Saved", MaskType.Clear, TimeSpan.FromSeconds(2));
                    editDialog.Dismiss();
                };
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, ParentScreenId, exe.StackTrace.ToString());
            }
        }
コード例 #13
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            Intent intent = null;

            switch (item.ItemId)
            {
            case Resource.Id.action_settings:
                ProgressIndicator.Show(this);
                intent = new Intent(this, typeof(ProfileActivity));
                LoggingClass.LogInfo("Clicked on options menu Profile", screenid);
                break;

            case Resource.Id.action_settings1:
                //ProgressIndicator.Show(this);
                try
                { intent = new Intent(this, typeof(AboutActivity)); }
                catch (Exception ex)
                { }

                LoggingClass.LogInfo("Clicked on options menu About", screenid);
                break;

            case Resource.Id.action_settings2:
                MoveTaskToBack(true);
                LoggingClass.LogInfo("Exited from App", screenid);
                break;

            default:    //invalid option
                return(base.OnOptionsItemSelected(item));
            }
            if (intent != null)
            {
                StartActivity(intent);
            }
            try
            {
                //if (item.ItemId == Resource.Id.action_settings3)
                //{
                //    ProgressIndicator.Show(this);
                //    StartActivity(typeof(AutoCompleteTextActivity));
                //}
            }

            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                throw new Exception();
            }

            if (item.ItemId == Android.Resource.Id.Home)
            {
                Finish();
                LoggingClass.LogInfo("Clicked on Exit", screenid);
                return(false);
            }
            return(base.OnOptionsItemSelected(item));
        }
コード例 #14
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());
            }
        }
コード例 #15
0
        // SwipeRefreshLayout refresher1;



        protected override void OnCreate(Bundle bundle)
        {
            Stopwatch st = new Stopwatch();

            st.Start();
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            try
            {
                CheckInternetConnection();
                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" });

                BindGridData();

                SwipeRefreshLayout mSwipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.PullDownRefresh);

                //mSwipeRefreshLayout.Refresh += MSwipeRefreshLayout_Refresh;
                //mSwipeRefreshLayout.SetColorScheme(Resource.Color.abc_background_cache_hint_selector_material_dark, Resource.Color.abc_background_cache_hint_selector_material_light);

                mSwipeRefreshLayout.Refresh += async delegate {
                    //BindGridData();
                    LoggingClass.LogInfo("Refreshed grid view", screenid);
                    await SomeAsync();

                    mSwipeRefreshLayout.Refreshing = false;
                };

                ActionBar.SetHomeButtonEnabled(true);
                ActionBar.SetDisplayHomeAsUpEnabled(true);

                ProgressIndicator.Hide();
                LoggingClass.LogInfo("Entered into gridview activity", screenid);
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                ProgressIndicator.Hide();
                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();
            }

            st.Stop();
            LoggingClass.LogTime("Gridactivity", st.Elapsed.TotalSeconds.ToString());
        }
コード例 #16
0
        private void BindGridData()
        {
            try
            {
                ServiceWrapper svc = new ServiceWrapper();

                var MYtastings = svc.GetMyTastingsList(customerid).Result;
                myArr1 = MYtastings.TastingList.ToList();

                ListView wineList = FindViewById <ListView>(Resource.Id.MyTasting);
                wineList.Clickable = true;

                MyTastingAdapter adapter = new MyTastingAdapter(this, MYtastings.TastingList.ToList());
                wineList.Adapter    = adapter;
                wineList.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
                {
                    string WineBarcode = myArr1[args.Position].Barcode;
                    int    storeID     = myArr1[args.Position].PlantFinal;
                    LoggingClass.LogInfo("Clicked on " + myArr1[args.Position].Barcode + " to enter into wine from tasting  details", screenid);
                    // ProgressIndicator.Show(this);
                    AndHUD.Shared.Show(this, "Loading...", Convert.ToInt32(MaskType.Clear));
                    var intent = new Intent(this, typeof(DetailViewActivity));
                    intent.PutExtra("WineBarcode", WineBarcode);
                    intent.PutExtra("storeid", storeID);
                    StartActivity(intent);
                };
                ProgressIndicator.Hide();
                AndHUD.Shared.Dismiss();

                //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());
            }
        }
コード例 #17
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            Stopwatch st = new Stopwatch();

            st.Start();
            base.OnCreateView(inflater, container, savedInstanceState);
            var view = inflater.Inflate(Resource.Layout.DeleteReviewPop, container, false);

            LoggingClass.LogInfo("Entered into Delete review popup with" + WineBarcode, screenid);
            ServiceWrapper sw     = new ServiceWrapper();
            Review         review = new Review();
            Button         Delete = view.FindViewById <Button>(Resource.Id.button1);
            Button         Cancel = view.FindViewById <Button>(Resource.Id.button2);

            try
            {
                Delete.Click += async delegate
                {
                    AndHUD.Shared.Show(Parent, "Deleting  Review...", Convert.ToInt32(MaskType.Clear));
                    review.Barcode = WineBarcode;
                    // ProgressIndicator.Show(Parent);
                    review.ReviewUserId = Convert.ToInt32(CurrentUser.getUserId());

                    await sw.DeleteReview(review);

                    ((IPopupParent)Parent).RefreshParent();
                    ProgressIndicator.Hide();
                    myDialog.Dismiss();
                    AndHUD.Shared.Dismiss();
                    AndHUD.Shared.ShowSuccess(Parent, "Sucessfully Deleted", MaskType.Clear, TimeSpan.FromSeconds(2));

                    LoggingClass.LogInfoEx("User deleted winereview" + WineBarcode + "from " + review.PlantFinal + "st Store", screenid);
                };
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
            }
            Cancel.Click += delegate
            {
                LoggingClass.LogInfo("clicked on cancel" + WineBarcode + review.PlantFinal, screenid);
                myDialog.Dismiss();
            };
            st.Stop();
            LoggingClass.LogTime("Deletereview time", st.Elapsed.TotalSeconds.ToString());
            return(view);
        }
コード例 #18
0
        // Use Notification Builder to create and launch the notification:
        void SendNotification(string message, string WineBarcode)
        {
            try {
                Stopwatch st1 = new Stopwatch();
                Intent    intent;
                if (WineBarcode == "-1")
                {
                    intent = new Intent(this, typeof(Login));
                    intent.AddFlags(ActivityFlags.ClearTop);
                    intent.AddFlags(ActivityFlags.ClearTask);
                    intent.AddFlags(ActivityFlags.NewTask);
                }
                else
                {
                    intent = new Intent(this, typeof(DetailViewActivity));
                    intent.PutExtra("WineBarcode", WineBarcode);
                    string Back = "Back";
                    intent.PutExtra("Back", Back);
                    intent.AddFlags(ActivityFlags.ClearTop);
                    intent.AddFlags(ActivityFlags.ClearTask);
                    intent.AddFlags(ActivityFlags.NewTask);
                }
                //System.TimeSpan ts = new System.TimeSpan((System.Int64)10e12+3456789);
                st1.Start();
                int requestid = st1.Elapsed.Milliseconds;

                var pendingIntent = PendingIntent.GetActivity(this, requestid, intent, PendingIntentFlags.OneShot);
                LoggingClass.LogInfo("Notification Sent\n" + intent + "Notification Sent\n" + pendingIntent, 1);
                var notificationBuilder = new Notification.Builder(this)
                                          .SetSmallIcon(Resource.Drawable.logo5)
                                          .SetContentTitle("Wine Outlet")
                                          .SetContentText(message)
                                          .SetAutoCancel(false)
                                          .SetContentIntent(pendingIntent);
                notificationBuilder.SetAutoCancel(true);
                //int notificationId = new Random().NextInt();
                // System.TimeSpan ts = new System.TimeSpan((System.Int64)10e12 + 3456789);
                LoggingClass.LogInfo("Notification Sent" + WineBarcode, 1);
                int notificationId      = new Random().NextInt();
                var notificationManager = (NotificationManager)GetSystemService(Context.NotificationService);
                notificationManager.Notify(notificationId, notificationBuilder.Build());
            }catch (System.Exception ex) {
                LoggingClass.LogError(ex.Message, 1, ex.StackTrace);
            }
        }
コード例 #19
0
        public void Resize()
        {
            try
            {
                Bitmap          propic  = BitmapFactory.DecodeFile(path);
                ProfileActivity pa      = new ProfileActivity();
                Bitmap          resized = pa.ResizeAndRotate(propic, 400, 400);

                var filePath = System.IO.Path.Combine(path);
                var stream   = new FileStream(filePath, FileMode.Create);
                resized.Compress(Bitmap.CompressFormat.Jpeg, 100, stream);
                stream.Close();
                propic.Dispose();
                resized.Dispose();
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
            }
        }
コード例 #20
0
        public async Task <CustomerResponse> InsertUpdateGuest(string token)
        {
            sw.Start();
            CustomerResponse output = null;

            try
            {
                var uri      = new Uri(ServiceURL + "InsertUpdateGuests/" + token + "/token/1");
                var content  = JsonConvert.SerializeObject(token);
                var cont     = new StringContent(content, System.Text.Encoding.UTF8, "application/json");
                var response = await client.GetStringAsync(uri).ConfigureAwait(false);

                output = JsonConvert.DeserializeObject <CustomerResponse>(response);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screenid, ex.StackTrace);
            }
            sw.Stop();
            LoggingClass.LogServiceInfo("Service " + sw.Elapsed.TotalSeconds, "Guest Service");
            return(output);
        }
コード例 #21
0
        public async Task <int> ResendEMail(string CardNumber)
        {
            sw.Start();
            int output = 0;

            try
            {
                var uri = new Uri(ServiceURL + "ResendEmail/" + CardNumber);
                //var content = JsonConvert.SerializeObject(token);
                //var cont = new StringContent(content, System.Text.Encoding.UTF8, "application/json");
                var response = await client.GetStringAsync(uri).ConfigureAwait(false);

                output = JsonConvert.DeserializeObject <int>(response);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screenid, ex.StackTrace);
            }
            sw.Stop();
            LoggingClass.LogServiceInfo("Service " + sw.Elapsed.TotalSeconds, "Resend Email Service");
            return(output);
        }
コード例 #22
0
        public async Task <ItemListResponse> GetItemList(int storeId, int userId)
        {
            ItemListResponse output = null;

            sw.Start();
            LoggingClass.LogServiceInfo("Service called", "GetItemList");
            try
            {
                var uri      = new Uri(ServiceURL + "GetItemLists/" + storeId + "/user/" + userId);
                var response = await client.GetStringAsync(uri).ConfigureAwait(false);

                output = JsonConvert.DeserializeObject <ItemListResponse>(response);
                LoggingClass.LogServiceInfo("Service Response", "GetItemList");
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
            }
            sw.Stop();
            LoggingClass.LogTime("The total time to  start and end the service getItemList", "The timer ran for " + sw.Elapsed.TotalSeconds);
            return(output);
        }
コード例 #23
0
        public async Task <DeviceToken> CheckMail(string uid)
        {
            sw.Start();
            DeviceToken output = null;

            try
            {
                LoggingClass.LogServiceInfo("service called", "CheckMail");
                var uri      = new Uri(ServiceURL + "GetVerificationStatus/" + uid);
                var response = await client.GetStringAsync(uri).ConfigureAwait(false);

                output = JsonConvert.DeserializeObject <DeviceToken>(response);
                LoggingClass.LogServiceInfo("service response", "CheckMail");
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
            }
            sw.Stop();

            LoggingClass.LogTime("The total time to  start and end the service CheckMail", "The timer ran for " + sw.Elapsed.TotalSeconds);

            return(output);
        }
コード例 #24
0
        public async Task <CustomerResponse> AuthencateUser1(string email)
        {
            sw.Start();
            CustomerResponse output = null;

            try
            {
                LoggingClass.LogServiceInfo("service called", "AuthencateUser1");
                var uri      = new Uri(ServiceURL + "AuthenticateUser1/" + email);
                var response = await client.GetStringAsync(uri).ConfigureAwait(false);

                output = JsonConvert.DeserializeObject <CustomerResponse>(response);
                LoggingClass.LogServiceInfo("service response" + email, "AuthencateUser1");
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
            }
            sw.Stop();

            LoggingClass.LogTime("The total time to  start and end the service AuthencateUser1", "The timer ran for " + sw.Elapsed.TotalSeconds);

            return(output);
        }
コード例 #25
0
        public async void Preinfo(string CardNumber)
        {
            AndHUD.Shared.Show(this, "Please Wait...", Convert.ToInt32(MaskType.Clear));
            try
            {
                BtnLogin.Visibility  = ViewStates.Gone;
                BtnResend.Visibility = ViewStates.Gone;
                try
                {
                    //CurrentUser.
                    EmailVerification(false);
                }
                catch (Exception ex)
                {
                    LoggingClass.LogError(ex.Message, screenid, ex.StackTrace);
                }
                AuthServ = await svc.AuthencateUser("test", CardNumber, CurrentUser.GetDeviceID());

                CurrentUser.SaveInternalCustometID(AuthServ.customer.CustomerID.ToString());
                LoggingClass.LogInfo("User Tried to login with " + CardNumber, screenid);
                if (CardNumber != null)
                {
                    CurrentUser.SaveCardNumber(CardNumber);
                }
                if (AuthServ != null)
                {
                    CurrentUser.SaveUserName(AuthServ.customer.FirstName + AuthServ.customer.LastName, AuthServ.customer.CustomerID.ToString());
                    CurrentUser.SavePrefered(AuthServ.customer.PreferredStore);
                    if (AuthServ.customer.Email != "" && AuthServ.customer.Email != null)
                    {
                        SendRegistrationToAppServer(CurrentUser.getDeviceToken());
                        if (AuthServ.ErrorDescription != null || AuthServ.ErrorDescription == "")
                        {
                            TxtScanresult.Text = AuthServ.ErrorDescription;
                        }
                        else
                        {
                            TxtScanresult.Text = " Hi " + AuthServ.customer.FirstName + AuthServ.customer.LastName + ",\nWe are sending a verification email to " + AuthServ.customer.Email + "..To proceed press continue. To change your emailAddress click on Update.";
                        }
                        TxtScanresult.SetTextColor(Android.Graphics.Color.Black);
                        BtnContinue.Visibility    = ViewStates.Visible;
                        BtnUpdateEmail.Visibility = ViewStates.Invisible;
                        update.Visibility         = ViewStates.Visible;
                        BtnContinue.Click        += async delegate
                        {
                            {
                                AndHUD.Shared.Show(this, " Please Wait...", Convert.ToInt32(MaskType.Clear));
                                AuthServ = await svc.ContinueService(AuthServ);

                                ShowInfo(AuthServ);
                                AndHUD.Shared.Dismiss();
                            }
                        };
                        update.Click += delegate
                        {
                            TxtScanresult.Text        = "";
                            BtnContinue.Visibility    = ViewStates.Gone;
                            update.Visibility         = ViewStates.Gone;
                            txtmail.Visibility        = ViewStates.Visible;
                            Txtem.Visibility          = ViewStates.Visible;
                            BtnUpdateEmail.Visibility = ViewStates.Visible;
                        };
                        BtnUpdateEmail.Click += delegate
                        {
                            {
                                BtnUpdateEmail_Click("please enter your new e-mail id.");
                            }
                        };
                    }
                    else
                    {
                        if (AuthServ.ErrorDescription != null || AuthServ.ErrorDescription == "")
                        {
                            TxtScanresult.Text = AuthServ.ErrorDescription;
                        }
                        else
                        {
                            TxtScanresult.Text = "Hi " + AuthServ.customer.FirstName + AuthServ.customer.LastName + ", \nIt seems we do not have your email address! Please update it so we can send you a verification link that will activate your account.";
                        }
                        TxtScanresult.SetTextColor(Android.Graphics.Color.Red);
                        BtnContinue.Visibility    = ViewStates.Gone;
                        BtnUpdateEmail.Visibility = ViewStates.Visible;
                        txtmail.Visibility        = ViewStates.Visible;
                        Txtem.Visibility          = ViewStates.Visible;
                        BtnUpdateEmail.Click     += delegate
                        {
                            BtnUpdateEmail_Click("please enter your new e-mail id.");
                        };
                    }
                }
                else
                {
                    TxtScanresult.Text   = "Sorry. Your Card number is not matching our records.\n Please re-scan Or Try app as Guest Log In.";
                    BtnResend.Visibility = ViewStates.Invisible;
                    BtnLogin.Visibility  = ViewStates.Invisible;
                    TxtScanresult.SetTextColor(Android.Graphics.Color.Red);
                    AndHUD.Shared.Dismiss();
                }
                AndHUD.Shared.Dismiss();
            }
            catch (Exception exe)
            {
            }
        }
コード例 #26
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            CheckInternetConnection();
            Stopwatch st = new Stopwatch();

            st.Start();
            //for direct login
            //CurrentUser.SaveUserName("Sumanth","3");
            //Preinfo("8902519310330");
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.LoginView);
            var TaskA = new System.Threading.Tasks.Task(() =>
            {
                BlobWrapper.DownloadImages(Convert.ToInt32(CurrentUser.getUserId()));
            });

            TaskA.Start();
            //checking user id's exist or not.
            if ((CurrentUser.getUserId() != null || CurrentUser.getUserId() != "0") && (CurrentUser.getUserId() != null))
            {
                IntoApp();
            }
            else if (CurrentUser.GetGuestId() != null || CurrentUser.getUserId() == "0")
            {
                IntoApp();
            }
            else
            {
                //if (CurrentUser.GetCardNumber() != null)
                //{
                //    Preinfo(CurrentUser.GetCardNumber());
                //}
                ImageButton BtnScanner    = FindViewById <ImageButton>(Resource.Id.btnScanner);
                Button      BtnGuestLogin = FindViewById <Button>(Resource.Id.btnGuestLogin);
                LoggingClass.LogInfo("Opened the app", screenid);
                BtnScanner.Click += async delegate
                {
                    try
                    {
                        MobileBarcodeScanner.Initialize(Application);
                        var scanner = new ZXing.Mobile.MobileBarcodeScanner();
                        scanner.UseCustomOverlay = false;
                        var result = await scanner.Scan();// "8902519310330";// "900497354894";//await scanner.Scan();

                        if (result != null)
                        {
                            LoggingClass.LogInfo("User Tried to login with " + result, screenid);
                            Preinfo(result.Text);
                            CurrentUser.SaveCardNumber(result.Text);
                            txtmail.Visibility = ViewStates.Gone;
                            Txtem.Visibility   = ViewStates.Gone;
                        }
                    }
                    catch (Exception exe)
                    {
                        LoggingClass.LogError(exe.Message, screenid, exe.StackTrace);
                    }
                };

                BtnGuestLogin.Click += async delegate
                {
                    Intent intent = new Intent(this, typeof(Login));
                    ProgressIndicator.Show(this);
                    LoggingClass.LogInfo("User Tried to login with Guest Login ", screenid);
                    StartActivity(intent);
                    CustomerResponse csr = new CustomerResponse();
                    csr = await svc.InsertUpdateGuest("Didn't get the token");

                    CurrentUser.SaveGuestId(csr.customer.CustomerID.ToString());
                };
                TxtScanresult             = FindViewById <TextView>(Resource.Id.txtScanresult);
                Txtem                     = FindViewById <TextView>(Resource.Id.textV);
                BtnLogin                  = FindViewById <Button>(Resource.Id.btnLogin);
                txtmail                   = FindViewById <EditText>(Resource.Id.txtmail);
                BtnResend                 = FindViewById <Button>(Resource.Id.btnResend);
                update                    = FindViewById <Button>(Resource.Id.btnUpdateEmailclick);
                BtnContinue               = FindViewById <Button>(Resource.Id.btnContinue);
                BtnUpdateEmail            = FindViewById <Button>(Resource.Id.btnUpdateEmail);
                BtnResend.Visibility      = ViewStates.Gone;
                update.Visibility         = ViewStates.Gone;
                BtnLogin.Visibility       = ViewStates.Gone;
                BtnContinue.Visibility    = ViewStates.Gone;
                BtnUpdateEmail.Visibility = ViewStates.Gone;
                txtmail.Visibility        = ViewStates.Gone;
                Txtem.Visibility          = ViewStates.Gone;
                if (IsPlayServicesAvailable())
                {
                    var TaskB = new System.Threading.Tasks.Task(() =>
                    {
                        var intent = new Intent(this, typeof(RegistrationIntentService));
                        StartService(intent);
                    });
                    TaskB.Start();
                }
                var telephonyDeviceID             = string.Empty;
                var telephonySIMSerialNumber      = string.Empty;
                TelephonyManager telephonyManager = (TelephonyManager)this.ApplicationContext.GetSystemService(Context.TelephonyService);
                if (telephonyManager != null)
                {
                    if (!string.IsNullOrEmpty(telephonyManager.DeviceId))
                    {
                        telephonyDeviceID = telephonyManager.DeviceId;
                    }
                    if (!string.IsNullOrEmpty(telephonyManager.SimSerialNumber))
                    {
                        telephonySIMSerialNumber = telephonyManager.SimSerialNumber;
                    }
                }
                var androidID  = Android.Provider.Settings.Secure.GetString(this.ApplicationContext.ContentResolver, Android.Provider.Settings.Secure.AndroidId);
                var deviceUuid = new UUID(androidID.GetHashCode(), ((long)telephonyDeviceID.GetHashCode() << 32) | telephonySIMSerialNumber.GetHashCode());
                var DeviceID   = deviceUuid.ToString();
                CurrentUser.SaveDeviceID(DeviceID);
                BtnScanner.Dispose();
            }
        }
コード例 #27
0
        public void Internal_ViewDidLoad()
        {
            try
            {
                WineBarcode = Intent.GetStringExtra("WineBarcode");
                storeid     = Intent.GetIntExtra("storeid", 1);
                ActionBar.SetHomeButtonEnabled(true);
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                ServiceWrapper svc = new ServiceWrapper();
                myData = new ItemDetailsResponse();
                ItemReviewResponse SkuRating = new ItemReviewResponse();
                this.Title = "Wine Details";
                try
                {
                    DownloadAsync(this, System.EventArgs.Empty, WineBarcode);
                    myData      = svc.GetItemDetails(WineBarcode, storeid).Result;
                    SkuRating   = svc.GetItemReviewsByWineBarcode(WineBarcode).Result;
                    ReviewArray = SkuRating.Reviews.ToList();
                    var tempReview = SkuRating.Reviews.ToList().Find(x => x.ReviewUserId == Convert.ToInt32(CurrentUser.getUserId()));
                    if (tempReview != null)
                    {
                        editPopup._editObj.RatingText = tempReview.RatingText;
                    }
                    comments = new reviewAdapter(this, ReviewArray);
                    if (comments.Count == 0)
                    {
                        ErrorDescription.Visibility = ViewStates.Visible;
                        ErrorDescription.Text       = SkuRating.ErrorDescription;
                        ErrorDescription.SetTextColor(Android.Graphics.Color.Black);
                    }
                    else
                    {
                        commentsview.Adapter = comments;
                    }
                    setListViewHeightBasedOnChildren1(commentsview);
                    WineName.Text = myData.ItemDetails.Name;

                    WineName.InputType = Android.Text.InputTypes.TextFlagNoSuggestions;
                    Vintage.Text       = myData.ItemDetails.Vintage.ToString();
                    if (Vintage.Text == null || Vintage.Text == "0")
                    {
                        Vintage.Text = "";
                    }
                    else
                    {
                        Vintage.Text = myData.ItemDetails.Vintage.ToString();
                    }
                    if (myData.ItemDetails.Producer == null || myData.ItemDetails.Producer == "")
                    {
                        WineProducer.Text = "Not Available";
                    }
                    else
                    {
                        WineProducer.Text = myData.ItemDetails.Producer;
                    }
                    if (myData.ItemDetails.Description == null || myData.ItemDetails.Description == "")
                    {
                        WineDescription.Text = "Not Available";
                    }
                    else
                    {
                        WineDescription.Text = myData.ItemDetails.Description;
                    }
                    AvgRating.Rating = (float)myData.ItemDetails.AverageRating;

                    //ReviewPopup editPopup = new ReviewPopup(this, edit);
                    //RatingBar RatingInput = FindViewById<RatingBar>(Resource.Id.ratingInput);//Taking rating stars input
                    //RatingInput.RatingBarChange += editPopup.CreatePopup;

                    var metrics    = Resources.DisplayMetrics;
                    var widthInDp  = ConvertPixelsToDp(metrics.WidthPixels);
                    var heightInDp = ConvertPixelsToDp(metrics.HeightPixels);


                    HighImageWine = FindViewById <ImageView>(Resource.Id.WineImage);

                    BitmapFactory.Options options = new BitmapFactory.Options
                    {
                        InJustDecodeBounds = false,
                        OutHeight          = 75,
                        OutWidth           = 75
                    };
                    ProgressIndicator.Hide();
                    LoggingClass.LogInfo("Entered into detail view" + WineBarcode, screenid);
                    Bitmap result = BitmapFactory.DecodeResource(Resources, Resource.Drawable.placeholder_re, options);
                }
                catch (Exception exe)
                {
                    LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                    AlertDialog.Builder alert = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme);
                    alert.SetTitle("Sorry");
                    alert.SetMessage("We're under maintainence");
                    alert.SetNegativeButton("Ok", delegate { });
                    Dialog dialog = alert.Create();
                    dialog.Show();
                }
            }
            catch { }
        }
コード例 #28
0
        public async void DownloadAsync(object sender, System.EventArgs ea, string WineBarcode)
        {
            webClient = new WebClient();
            string url = null;

            if (storeid == 1)
            {
                url = "https://icsintegration.blob.core.windows.net/barcodeppdetail/" + WineBarcode + ".jpg";
                LoggingClass.LogInfo("Download Async image in detail view" + WineBarcode + +',' + storeid, screenid);
            }
            else if (storeid == 2)
            {
                url = "https://icsintegration.blob.core.windows.net/barcodeppdetail/" + WineBarcode + ".jpg";
                LoggingClass.LogInfo("Download Async image in detail view" + WineBarcode + +',' + storeid, screenid);
            }
            byte[] imageBytes = null;
            //progressLayout.Visibility = ViewStates.Visible;
            try
            {
                imageBytes = await webClient.DownloadDataTaskAsync(url);
            }


            catch (TaskCanceledException)
            {
                //this.progressLayout.Visibility = ViewStates.Gone;
                return;
            }
            catch (Exception exe)
            {
                LoggingClass.LogError("while downloading image of wine id" + WineBarcode + "  " + exe.Message, screenid, exe.StackTrace.ToString());
                //progressLayout.Visibility = ViewStates.Gone;
                //downloadButton.Click += downloadAsync;
                //downloadButton.Text = "Download Image";
                Bitmap imgWine = BlobWrapper.Bottleimages(WineBarcode, storeid);
                HighImageWine.SetImageBitmap(imgWine);
                if (imgWine == null)
                {
                    HighImageWine.SetImageResource(Resource.Drawable.bottle);
                }
                return;
            }

            try
            {
                string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
                string localFilename = "Wine.png";
                string localPath     = System.IO.Path.Combine(documentsPath, localFilename);

                FileStream fs = new FileStream(localPath, FileMode.OpenOrCreate);
                await fs.WriteAsync(imageBytes, 0, imageBytes.Length);

                fs.Close();

                BitmapFactory.Options options = new BitmapFactory.Options()
                {
                    InJustDecodeBounds = true
                };
                await BitmapFactory.DecodeFileAsync(localPath, options);

                Bitmap bitmap = await BitmapFactory.DecodeFileAsync(localPath);

                if (bitmap == null)
                {
                    HighImageWine.SetImageResource(Resource.Drawable.bottle);
                }
                HighImageWine.SetImageBitmap(bitmap);
            }
            catch (Exception exe)
            {
                LoggingClass.LogError("While setting High resulution image" + exe.Message, screenid, exe.StackTrace.ToString());
            }

            //progressLayout.Visibility = ViewStates.Gone;
            //downloadButton.Click += downloadAsync;
            //downloadButton.Enabled = false;
            HighImageWine.Dispose();
            //downloadButton.Text = "Download Image";
        }
コード例 #29
0
        public async void EmailVerification(Boolean Load)
        {
            if (Load == true)
            {
                AndHUD.Shared.Show(this, "Checking Email Verification", Convert.ToInt32(MaskType.Clear));
            }
            DeviceToken DO = new DeviceToken();

            try
            {
                //  DO = await svc.CheckMail(AuthServ.customer.CustomerID.ToString());
                DO = await svc.CheckMail(CurrentUser.GetInternalCustometID());

                if (DO.VerificationStatus == 1)
                {
                    //  if (AuthServ.customer != null && AuthServ.customer.CustomerID != 0)
                    if (CurrentUser.GetInternalCustometID() != null && Convert.ToInt32(CurrentUser.GetInternalCustometID()) != 0)
                    {
                        // LoggingClass.LogInfo("The User logged in with user id: " + CurrentUser.getUserId(), screenid);

                        SendRegistrationToAppServer(CurrentUser.getDeviceToken());
                        // CurrentUser.SavePrefered(AuthServ.customer.PreferredStore);
                        int storename = Convert.ToInt32(CurrentUser.GetPrefered());///AuthServ.customer.PreferredStore;
                        if (storename == 1)
                        {
                            Intent intent = new Intent(this, typeof(GridViewActivity));
                            intent.PutExtra("MyData", "Wall Store");
                            ProgressIndicator.Show(this);

                            StartActivity(intent);
                        }
                        else if (storename == 2)
                        {
                            Intent intent = new Intent(this, typeof(GridViewActivity));
                            intent.PutExtra("MyData", "Point Pleasant Store");

                            ProgressIndicator.Show(this);
                            StartActivity(intent);
                        }
                        else if (storename == 3)
                        {
                            Intent intent = new Intent(this, typeof(GridViewActivity));
                            intent.PutExtra("MyData", AppConstants.SecaucusStore);

                            ProgressIndicator.Show(this);
                            StartActivity(intent);
                        }
                        else
                        {
                            Intent intent = new Intent(this, typeof(Login));
                            ProgressIndicator.Show(this);
                            StartActivity(intent);
                        }
                        LoggingClass.LogInfoEx("User verified and Logging" + "---->" + CurrentUser.GetCardNumber(), screenid);
                        AndHUD.Shared.Dismiss();
                        AndHUD.Shared.ShowSuccess(Parent, "Success!", MaskType.Clear, TimeSpan.FromSeconds(2));
                    }
                    else
                    {
                        AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme);
                        aler.SetTitle("Sorry");
                        aler.SetMessage("You entered wrong details or authentication failed");
                        aler.SetNegativeButton("Ok", delegate { });
                        Dialog dialog1 = aler.Create();
                        dialog1.Show();
                    };
                }
                else
                {
                    AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme);
                    aler.SetMessage("Your email is not verified. please check email and verify.");
                    aler.SetNegativeButton("Ok", delegate { });
                    Dialog dialog = aler.Create();
                    dialog.Show();
                }
                AndHUD.Shared.Dismiss();
            }

            catch (Exception exe)
            {
                AndHUD.Shared.Dismiss();
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
            }
            AndHUD.Shared.Dismiss();
            //BtnLogin.Dispose();
            //BtnResend.Dispose();
            //BtnContinue.Dispose();
            //BtnUpdateEmail.Dispose();
            //update.Dispose();
        }
コード例 #30
0
        protected override void OnCreate(Bundle bundle)
        {
            Stopwatch st = new Stopwatch();

            st.Start();
            base.OnCreate(bundle);
            customerid = Convert.ToInt32(CurrentUser.getUserId());

            try
            {
                LoggingClass.LogInfo("Entered into My Tasting", screenid);
                ActionBar.SetHomeButtonEnabled(true);
                ActionBar.SetDisplayHomeAsUpEnabled(true);

                ServiceWrapper svc = new ServiceWrapper();

                var MYtastings = svc.GetMyTastingsList(customerid).Result;
                myArr1 = MYtastings.TastingList.ToList();
                if (MYtastings.TastingList.Count == 0)
                {
                    SetContentView(Resource.Layout.EmptyTaste);
                    TextView te = FindViewById <TextView>(Resource.Id.textView123a);
                    //AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme);
                    ////aler.SetTitle("No Reviews Avalilable");
                    //aler.SetMessage("Sorry you haven't Tasted our wines");
                    //LoggingClass.LogInfo("Sorry you haven't Tasted our wines alert", screenid);
                    //aler.SetNegativeButton("Ok", delegate { Finish(); });
                    //LoggingClass.LogInfo("Clicked on Secaucus", screenid);
                    //Dialog dialog = aler.Create();
                    //dialog.Show();
                }
                else
                {
                    SetContentView(Resource.Layout.MyTasting);
                    ListView wineList = FindViewById <ListView>(Resource.Id.MyTasting);

                    MyTastingAdapter adapter = new MyTastingAdapter(this, MYtastings.TastingList.ToList());
                    wineList.Adapter    = adapter;
                    wineList.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
                    {
                        string WineBarcode = myArr1[args.Position].Barcode;
                        int    storeID     = myArr1[args.Position].PlantFinal;
                        LoggingClass.LogInfo("Clicked on " + myArr1[args.Position].Barcode + " to enter into wine from tasting  details", screenid);
                        ProgressIndicator.Show(this);
                        var intent = new Intent(this, typeof(DetailViewActivity));
                        intent.PutExtra("WineBarcode", WineBarcode);
                        intent.PutExtra("storeid", storeID);
                        StartActivity(intent);
                    };
                }
                ProgressIndicator.Hide();
            }

            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                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();
            }
            st.Stop();
            LoggingClass.LogTime("Tastingactivity", st.Elapsed.TotalSeconds.ToString());
        }