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); }
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()); }
// 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()); }
private void TakeAPicture(object sender, EventArgs eventArgs) { Intent intent = new Intent(MediaStore.ActionImageCapture); App._file = new Java.IO.File(App._dir, String.Format(Convert.ToInt32(CurrentUser.getUserId()) + ".jpg", Guid.NewGuid())); path += "/" + CurrentUser.getUserId() + ".jpg"; intent.PutExtra(MediaStore.ExtraOutput, Uri.FromFile(App._file)); StartActivityForResult(intent, 0); LoggingClass.LogTime("Tak pic", "time"); }
public async Task <ItemReviewResponse> GetItemReviewsByWineBarcode(string WineBarcode) { sw.Start(); LoggingClass.LogServiceInfo("service called", "GetItemReviewsByWineBarcode"); var uri = new Uri(ServiceURL + "/GetReviewsBarcode/" + WineBarcode); var response = await client.GetStringAsync(uri).ConfigureAwait(false); var output = JsonConvert.DeserializeObject <ItemReviewResponse>(response); LoggingClass.LogServiceInfo("service responce", "GetItemReviewsByWineBarcode"); sw.Stop(); LoggingClass.LogTime("The total time to start and end the service GetItemReviewsByWineBarcode", "The timer ran for " + sw.Elapsed.TotalSeconds); return(output); }
public async Task <ItemListResponse> GetItemFavsUID(int userId) { sw.Start(); LoggingClass.LogServiceInfo("service called", "csfavs"); var uri = new Uri(ServiceURL + "GetItemFavUID/" + userId); var response = await client.GetStringAsync(uri).ConfigureAwait(false); var output = JsonConvert.DeserializeObject <ItemListResponse>(response); LoggingClass.LogServiceInfo("service responce", "csfavs"); sw.Stop(); LoggingClass.LogTime("The total time to start and end the service GetItemFavsUID", "The timer ran for " + sw.Elapsed.TotalSeconds); return(output); }
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); }
public async Task <TastingListResponse> GetMyTastingsList(int customerid) { sw.Start(); //customerid = 38691; LoggingClass.LogServiceInfo("service called", "GetMyTastingsList"); var uri = new Uri(ServiceURL + "GetMyTastingsList/" + customerid); var response = await client.GetStringAsync(uri).ConfigureAwait(false); var output = JsonConvert.DeserializeObject <TastingListResponse>(response); sw.Stop(); LoggingClass.LogTime("The total time to start and end the service GetMyTastingsList", "The timer ran for " + sw.Elapsed.TotalSeconds); LoggingClass.LogServiceInfo("service responce", "GetMyTastingsList"); return(output); }
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); }
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); }
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); }
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()); }
protected override void OnCreate(Bundle bundle) { Stopwatch st = new Stopwatch(); st.Start(); base.OnCreate(bundle); uid = Convert.ToInt32(CurrentUser.getUserId()); try { ActionBar.SetHomeButtonEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true); ServiceWrapper svc = new ServiceWrapper(); ItemReviewResponse uidreviews = new ItemReviewResponse(); uidreviews = svc.GetItemReviewUID(uid).Result; List <Review> myArr1; myArr1 = uidreviews.Reviews.ToList(); int c = uidreviews.Reviews.Count; if (c == 0) { var data = svc.GetMyTastingsList(uid).Result; SetContentView(Resource.Layout.ReviewEmpty); txtName = FindViewById <TextView>(Resource.Id.textView1); if (data.TastingList.Count != 0) { txtName.Text = "You have tasted " + data.TastingList.Count + " wines.\n We would love to hear your feedback."; } else { txtName.Text = "Please taste and then review."; } Imag = FindViewById <ImageView>(Resource.Id.imageView1); var TaskA = new System.Threading.Tasks.Task(() => { Imag.SetImageResource(Resource.Drawable.ReviewIns); }); TaskA.Start(); } else { SetContentView(Resource.Layout.MyReviews); var wineList = FindViewById <ListView>(Resource.Id.listView1); Review edit = new Review(); ReviewPopup editPopup = new ReviewPopup(this, edit); MyReviewAdapter adapter = new MyReviewAdapter(this, myArr1); wineList.Adapter = adapter; wineList.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args) { string WineBarcode = myArr1[args.Position].Barcode; int storeID = Convert.ToInt32(myArr1[args.Position].PlantFinal); LoggingClass.LogInfoEx("Clicked on " + myArr1[args.Position].Barcode + " to enter into wine details From ReviewAct", 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); }; LoggingClass.LogInfo("Entered into My Review", screenid); } ProgressIndicator.Hide(); } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString()); AndHUD.Shared.Dismiss(); 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("Reviewactivity", st.Elapsed.TotalSeconds.ToString()); }
protected override void OnCreate(Bundle bundle) { Stopwatch st = new Stopwatch(); st.Start(); base.OnCreate(bundle); try { //SetContentView(Resource.Layout.MyFavoriteGridView); ActionBar.SetHomeButtonEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true); if (StoreName == "") { StoreName = Intent.GetStringExtra("MyData"); } this.Title = StoreName; int userId = Convert.ToInt32(CurrentUser.getUserId()); ServiceWrapper sw = new ServiceWrapper(); ItemListResponse output = new ItemListResponse(); output = sw.GetItemFavsUID(userId).Result; List <Item> myArr; myArr = output.ItemList.ToList(); if (output.ItemList.Count == 0) { SetContentView(Resource.Layout.FavEmp); TextView txtName = FindViewById <TextView>(Resource.Id.textView1); ImageView Imag = FindViewById <ImageView>(Resource.Id.imageView1); //AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme); ////aler.SetTitle("No Reviews Avalilable"); //aler.SetMessage("Sorry you didn't tell us your Favourite wines"); //LoggingClass.LogInfo("Sorry you didn't tell us your Favourite wines", screenid); //aler.SetNegativeButton("Ok", delegate { Finish(); }); //LoggingClass.LogInfo("Clicked on Secaucus", screenid); //Dialog dialog = aler.Create(); //dialog.Show(); } else { SetContentView(Resource.Layout.MyFavoriteGridView); var gridview = FindViewById <GridView>(Resource.Id.gridviewfav); MyFavoriteAdapter adapter = new MyFavoriteAdapter(this, myArr); LoggingClass.LogInfo("Entered into Favourite Adapter", screenid); gridview.SetNumColumns(2); gridview.Adapter = adapter; gridview.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args) { try { string WineBarcode = myArr[args.Position].Barcode; int storeid = 1;// myArr[args.Position].PlantFinal; //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); } catch (Exception) { string WineBarcode = myArr[args.Position].Barcode; int storeid = myArr[args.Position].PlantFinal; ProgressIndicator.Show(this); AndHUD.Shared.Dismiss(); 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); } }; LoggingClass.LogInfo("Entered into My Favorites Activity", screenid); } st.Stop(); LoggingClass.LogTime("Favouriteactivity", st.Elapsed.TotalSeconds.ToString()); ProgressIndicator.Hide(); } 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(); } }
public async void DownloadAsync(object sender, System.EventArgs ea) { try { //st.Start(); Bitmap img = BlobWrapper.ProfileImages(Convert.ToInt32(CurrentUser.getUserId())); if (img != null) { propicimage.SetImageBitmap(img); } else { webClient = new WebClient(); var url = new Uri("https://icsintegration.blob.core.windows.net/profileimages/" + Convert.ToInt32(CurrentUser.getUserId()) + ".jpg"); 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(exe.Message, screenid, exe.StackTrace.ToString()); //progressLayout.Visibility = ViewStates.Gone; //downloadButton.Click += downloadAsync; //downloadButton.Text = "Download Image"; Bitmap imgWine = BlobWrapper.ProfileImages(Convert.ToInt32(CurrentUser.getUserId())); propicimage.SetImageBitmap(imgWine); return; } try { string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); string localFilename = "user.png"; string localPath = System.IO.Path.Combine(documentsPath, localFilename); FileStream fs = new FileStream(localPath, FileMode.OpenOrCreate); await fs.WriteAsync(imageBytes, 0, imageBytes.Length); //Console.WriteLine("Saving image in local path: " + localPath); fs.Close(); BitmapFactory.Options options = new BitmapFactory.Options() { InJustDecodeBounds = true }; await BitmapFactory.DecodeFileAsync(localPath, options); Bitmap bitmap = await BitmapFactory.DecodeFileAsync(localPath); if (bitmap == null) { propicimage.SetImageResource(Resource.Drawable.user1); } propicimage.SetImageBitmap(bitmap); } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString()); } st.Stop(); LoggingClass.LogTime("Download aSync image profile", st.Elapsed.TotalSeconds.ToString()); propicimage.Dispose(); } } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString()); } }
protected override void OnCreate(Bundle savedInstanceState) { CheckInternetConnection(); Stopwatch st = new Stopwatch(); st.Start(); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.detailedView); WineBarcode = Intent.GetStringExtra("WineBarcode"); storeid = Intent.GetIntExtra("storeid", 1); ActionBar.SetHomeButtonEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true); ServiceWrapper svc = new ServiceWrapper(); ItemDetailsResponse myData = new ItemDetailsResponse(); ItemReviewResponse SkuRating = new ItemReviewResponse(); this.Title = "Wine Details"; commentsview = FindViewById <ListView>(Resource.Id.listView2); TextView WineName = FindViewById <TextView>(Resource.Id.txtWineName); //Assigning values to respected Textfields WineName.Focusable = false; TextView WineProducer = FindViewById <TextView>(Resource.Id.txtProducer); WineProducer.Focusable = false; TextView Vintage = FindViewById <TextView>(Resource.Id.txtVintage); Vintage.Focusable = false; TextView WineDescription = FindViewById <TextView>(Resource.Id.txtWineDescription); WineDescription.Focusable = false; RatingBar AvgRating = FindViewById <RatingBar>(Resource.Id.avgrating); AvgRating.Focusable = false; TextView ErrorDescription = FindViewById <TextView>(Resource.Id.Error); ErrorDescription.Focusable = false; ErrorDescription.Visibility = ViewStates.Invisible; TableRow tr5 = FindViewById <TableRow>(Resource.Id.tableRow5); try { DownloadAsync(this, System.EventArgs.Empty, WineBarcode); myData = svc.GetItemDetails(WineBarcode, storeid).Result; SkuRating = svc.GetItemReviewsByWineBarcode(WineBarcode).Result; ReviewArray = SkuRating.Reviews.ToList(); comments = new reviewAdapter(this, ReviewArray); if (comments.Count == 0) { ErrorDescription.Text = SkuRating.ErrorDescription; ErrorDescription.Visibility = ViewStates.Visible; //AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme); //aler.SetTitle("No Reviews"); //aler.SetMessage("Be the first one to Review"); //aler.SetNegativeButton("Ok", delegate { }); //Dialog dialog = aler.Create(); //dialog.Show(); } else { commentsview.Adapter = comments; } setListViewHeightBasedOnChildren1(commentsview); WineName.Text = myData.ItemDetails.Name; WineName.InputType = Android.Text.InputTypes.TextFlagNoSuggestions; 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; Review edit = new Review() { Barcode = WineBarcode, RatingText = "", PlantFinal = storeid.ToString() }; var tempReview = ReviewArray.Find(x => x.ReviewUserId == Convert.ToInt32(CurrentUser.getUserId())); if (tempReview != null) { edit.RatingText = tempReview.RatingText; } 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); alert.SetTitle("Sorry"); alert.SetMessage("We're under maintainence"); alert.SetNegativeButton("Ok", delegate { }); Dialog dialog = alert.Create(); dialog.Show(); } //downloadButton = FindViewById<Button>(Resource.Id.Download); //try //{ // //downloadButton.Enabled = true; // downloadButton.Click += downloadAsync; // //downloadButton.Enabled = false; //} //catch (Exception e) { } st.Stop(); LoggingClass.LogTime("Detail activity", st.Elapsed.TotalSeconds.ToString()); 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; }
protected override void OnCreate(Bundle savedInstanceState) { AndHUD.Shared.Dismiss(); CheckInternetConnection(); Stopwatch st = new Stopwatch(); st.Start(); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.detailedView); // 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"; commentsview = FindViewById <ListView>(Resource.Id.listView2); WineName = FindViewById <TextView>(Resource.Id.txtWineName); //Assigning values to respected Textfields WineName.Focusable = false; WineProducer = FindViewById <TextView>(Resource.Id.txtProducer); WineProducer.Focusable = false; Vintage = FindViewById <TextView>(Resource.Id.txtVintage); Vintage.Focusable = false; WineDescription = FindViewById <TextView>(Resource.Id.txtWineDescription); WineDescription.Focusable = false; AvgRating = FindViewById <RatingBar>(Resource.Id.avgrating); AvgRating.Focusable = false; ErrorDescription = FindViewById <TextView>(Resource.Id.Error); ErrorDescription.Focusable = false; ErrorDescription.Visibility = ViewStates.Gone; TableRow tr5 = FindViewById <TableRow>(Resource.Id.tableRow5); WineBarcode = Intent.GetStringExtra("WineBarcode"); storeid = Intent.GetIntExtra("storeid", 1); Review edit = new Review() { Barcode = WineBarcode, RatingText = "", PlantFinal = storeid.ToString() }; ItemReviewResponse SkuRating = new ItemReviewResponse(); ServiceWrapper svc = new ServiceWrapper(); SkuRating = svc.GetItemReviewsByWineBarcode(WineBarcode).Result; var tempReview = SkuRating.Reviews.ToList().Find(x => x.ReviewUserId == Convert.ToInt32(CurrentUser.getUserId())); if (tempReview != null) { edit.RatingText = tempReview.RatingText; } editPopup = new ReviewPopup(this, edit); RatingBar RatingInput = FindViewById <RatingBar>(Resource.Id.ratingInput);//Taking rating stars input RatingInput.RatingBarChange += editPopup.CreatePopup; Internal_ViewDidLoad(); st.Stop(); AndHUD.Shared.Dismiss(); LoggingClass.LogTime("Detail activity", st.Elapsed.TotalSeconds.ToString()); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Stopwatch sr = new Stopwatch();; sr.Start(); base.OnCreateView(inflater, container, savedInstanceState); var view = inflater.Inflate(Resource.Layout.LocationLayout, null); Button Top = view.FindViewById <Button>(Resource.Id.btnTop); Button Middle = view.FindViewById <Button>(Resource.Id.btnMiddle); Button Bottom = view.FindViewById <Button>(Resource.Id.btnBottom); var metrics = Resources.DisplayMetrics; int height = metrics.HeightPixels; height = height - (int)((360 * metrics.Density) / 3); height = height / 3; height = height + 2; Top.LayoutParameters.Height = height; Middle.LayoutParameters.Height = height; Bottom.LayoutParameters.Height = height; if (tabName == "Locations") { LoggingClass.LogInfo("Clicked on " + tabName, screenid); try { Top.SetBackgroundResource(Resource.Drawable.wall1); //Top.Text = "Wall"; //Top.SetTextColor(Color.White); // Top.TextSize = 20; Middle.SetBackgroundResource(Resource.Drawable.pp1); //Middle.Text = "Pt. Pleasant Beach"; //Middle.SetTextColor(Color.White); // Middle.TextSize = 20; Bottom.SetBackgroundResource(Resource.Drawable.scacus1); //Bottom.Text = "Secaucus"; //Bottom.SetTextColor(Color.White); // Bottom.TextSize = 20; OnPause(); { } Top.Click += (sender, e) => { ProgressIndicator.Show(_parent); LoggingClass.LogInfo("Clicked on Wall", screenid); var intent = new Intent(Activity, typeof(GridViewActivity)); intent.PutExtra("MyData", "Wall Store"); StartActivity(intent); }; Middle.Click += (sender, e) => { ProgressIndicator.Show(_parent); LoggingClass.LogInfo("Clicked on Point Plesent", screenid); var intent = new Intent(Activity, typeof(GridViewActivity)); intent.PutExtra("MyData", "Point Pleasant Store"); StartActivity(intent); }; Bottom.Click += (sender, e) => { AlertDialog.Builder aler = new AlertDialog.Builder(Activity); aler.SetTitle("Secaucus Store"); aler.SetMessage("Coming Soon!"); aler.SetNegativeButton("Ok", delegate { }); LoggingClass.LogInfo("Clicked on Secaucus", screenid); Dialog dialog = aler.Create(); dialog.Show(); }; } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString()); } } if (tabName == "My Hangouts") { LoggingClass.LogInfo("Clicked on " + tabName, screenid); try { Button Bottom1 = view.FindViewById <Button>(Resource.Id.btnBottom1); int height1 = metrics.HeightPixels; height1 = height1 - (int)((360 * metrics.Density) / 4); height1 = height1 / 4; height1 = height1 - 20; Top.LayoutParameters.Height = height1; Middle.LayoutParameters.Height = height1; Bottom.LayoutParameters.Height = height1; Bottom1.LayoutParameters.Height = height1; Top.SetBackgroundResource(Resource.Drawable.mt); //Top.Text = "My Reviews"; //Top.SetTextColor(Color.White); //Top.TextSize = 20; Middle.SetBackgroundResource(Resource.Drawable.mr); //Middle.Text = "My Tastings"; //Middle.SetTextColor(Color.White); //Middle.TextSize = 20; Bottom.SetBackgroundResource(Resource.Drawable.mf); Bottom1.SetBackgroundResource(Resource.Drawable.ms); //Bottom.Text = "My Favorites"; //Bottom.SetTextColor(Color.White); //Bottom.TextSize = 20; if (CurrentUser.getUserId() == "0" || CurrentUser.GetGuestId() != null) { AlertDialog.Builder aler = new AlertDialog.Builder(Activity, Resource.Style.MyDialogTheme); aler.SetTitle("Sorry"); aler.SetMessage("This Feature is available for VIP Users only"); aler.SetPositiveButton("Login", delegate { var intent = new Intent(Activity, typeof(LoginActivity)); StartActivity(intent); }); aler.SetNegativeButton("KnowMore", delegate { var uri = Android.Net.Uri.Parse("https://hangoutz.azurewebsites.net/index.html"); var intent = new Intent(Intent.ActionView, uri); StartActivity(intent); }); aler.SetNeutralButton("Cancel", delegate { }); Dialog dialog1 = aler.Create(); dialog1.Show(); Top.Click += (sender, e) => { Dialog dialog11 = aler.Create(); dialog1.Show(); }; Middle.Click += (sender, e) => { Dialog dialog12 = aler.Create(); dialog1.Show(); }; Bottom.Click += (sender, e) => { Dialog dialog13 = aler.Create(); dialog1.Show(); }; Bottom1.Click += (sender, e) => { Dialog dialog13 = aler.Create(); dialog1.Show(); }; } else { Top.Click += (sender, e) => { ProgressIndicator.Show(_parent); // AndHUD.Shared.Show(_parent, "Loading...", Convert.ToInt32(MaskType.Clear)); LoggingClass.LogInfo("Clicked on My Reviews", screenid); var intent = new Intent(Activity, typeof(MyTastingActivity)); intent.PutExtra("MyData", "My Reviews"); StartActivity(intent); }; Middle.Click += (sender, e) => { ProgressIndicator.Show(_parent); LoggingClass.LogInfo("Clicked on My Tastings", screenid); var intent = new Intent(Activity, typeof(MyReviewActivity)); intent.PutExtra("MyData", "My Tastings"); StartActivity(intent); }; Bottom.Click += (sender, e) => { ProgressIndicator.Show(_parent); LoggingClass.LogInfo("Clicked on My Favorites", screenid); var intent = new Intent(Activity, typeof(MyFavoriteAvtivity)); intent.PutExtra("MyData", "My Favorites"); StartActivity(intent); }; Bottom1.Click += (sender, e) => { //ProgressIndicator.Show(_parent); LoggingClass.LogInfo("Clicked on My Store", screenid); CustomerResponse AuthServ = new CustomerResponse(); int storename = Convert.ToInt32(CurrentUser.GetPrefered()); if (storename == 1) { Intent intent = new Intent(Activity, typeof(GridViewActivity)); intent.PutExtra("MyData", "Wall Store"); ProgressIndicator.Show(Activity); StartActivity(intent); } else if (storename == 2) { Intent intent = new Intent(Activity, typeof(GridViewActivity)); intent.PutExtra("MyData", "Point Pleasant Store"); ProgressIndicator.Show(Activity); StartActivity(intent); } else { AlertDialog.Builder aler = new AlertDialog.Builder(Activity, Resource.Style.MyDialogTheme); //aler.SetTitle("Sorry"); aler.SetMessage("Please Select your preferred store!"); aler.SetNegativeButton("Ok", delegate { }); Dialog dialog1 = aler.Create(); dialog1.Show(); } }; } } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString()); } //}; } if (tabName == "Explore") { try { //Top.SetBackgroundResource(Resource.Drawable.myprofile); //Top.Text = "My Profile"; //Top.SetTextColor(Color.White); //Top.TextSize = 20; //Middle.SetBackgroundResource(Resource.Drawable.sfondo_cantine); //Middle.Text = "Wineries/Search Helper"; //Middle.TextSize = 20; //Middle.SetTextColor(Color.White); //Bottom.SetBackgroundResource(Resource.Drawable.sfondo_regioni); //Bottom.Text = "Regions"; //Bottom.TextSize = 20; //Bottom.SetTextColor(Color.White); //Bottom.SetTextAppearance(Resource.Drawable.abc_btn_borderless_material); //Top.Click += (sender, e) => //{ // ProgressIndicator.Show(_parent); // LoggingClass.LogInfo("Clicked on My Profile",screenid); // var intent = new Intent(Activity, typeof(ProfileActivity)); // intent.PutExtra("MyData", "My Profile"); // StartActivity(intent); //}; //Middle.Click += (sender, e) => //{ // AlertDialog.Builder aler = new AlertDialog.Builder(Activity, Resource.Style.MyDialogTheme); // aler.SetTitle("Wineries Section"); // aler.SetMessage("Coming Soon"); // aler.SetNegativeButton("Ok", delegate { }); // LoggingClass.LogInfo("Clicked on Wineries",screenid); // Dialog dialog = aler.Create(); // dialog.Show(); // //var intent = new Intent(Activity, typeof(LandscapeActivity)); // // intent.PutExtra("MyData", "Wineries"); // // StartActivity(intent); // //var intent = new Intent(Activity, typeof(AutoCompleteTextActivity)); // ////intent.PutExtra("MyData", "Wineries"); // //StartActivity(intent); //}; //Bottom.Click += (sender, e) => //{ // AlertDialog.Builder aler = new AlertDialog.Builder(Activity, Resource.Style.MyDialogTheme); // aler.SetTitle("Regions Section"); // aler.SetMessage("Coming Soon"); // aler.SetNegativeButton("Ok", delegate { }); // LoggingClass.LogInfo("Clicked on Regions",screenid); // Dialog dialog = aler.Create(); // dialog.Show(); // //var intent = new Intent(Activity, typeof(PotraitActivity)); // //intent.PutExtra("MyData", "Regions"); // //StartActivity(intent); //}; } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString()); } //Top.Dispose(); //Bottom.Dispose(); //Middle.Dispose(); } TokenModel devInfo = new TokenModel(); var activityManager = (ActivityManager)this.Context.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; sr.Stop(); LoggingClass.LogTime("tab activity time", sr.Elapsed.TotalSeconds.ToString()); return(view); }