Пример #1
0
        public static void DownloadAllImages()
        {
            Task.Factory.StartNew(() =>
            {
                ServiceWrapper svc      = new ServiceWrapper();
                ItemListResponse myData = svc.GetItemLists(1, CurrentUser.RetreiveUserId()).Result;
                foreach (var wine in myData.ItemList)
                {
                    GetImageBitmapFromWineId(wine.Barcode);
                }

                myData = svc.GetItemLists(2, CurrentUser.RetreiveUserId()).Result;

                foreach (var wine in myData.ItemList)
                {
                    GetImageBitmapFromWineId(wine.Barcode);
                }
                myData = svc.GetItemLists(3, CurrentUser.RetreiveUserId()).Result;

                foreach (var wine in myData.ItemList)
                {
                    GetImageBitmapFromWineId(wine.Barcode);
                }
            });
        }
Пример #2
0
        public async void SaveReview()
        {
            try
            {
                BTProgressHUD.Show("Saving the review...");
                ServiceWrapper sw     = new ServiceWrapper();
                Review         review = new Review();
                review.ReviewDate   = DateTime.Now;
                review.ReviewUserId = Convert.ToInt32(CurrentUser.RetreiveUserId());
                if (txtComments.Text == "Describe your tasting")
                {
                    txtComments.Text = "";
                }
                string reviewtxt = txtComments.Text;
                reviewtxt.Trim();
                review.RatingText  = reviewtxt;
                review.IsActive    = true;
                review.PlantFinal  = storeid.ToString();
                review.RatingStars = Convert.ToInt32(StartsSelected);
                //review.SKU = SKU;
                review.Barcode = WineId;

                await sw.InsertUpdateReview(review);

                //NavController.DismissViewController(true, null);
                BTProgressHUD.ShowSuccessWithStatus("Thank you!!!", 2000);
                ((IPopupParent)parent).RefreshParent();
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.Message, screen, ex.StackTrace);
            }
        }
Пример #3
0
        public static async Task UploadProfilePic(byte[] myByteArray, int i)
        {
            try
            {
                StorageCredentials  sc             = new StorageCredentials("icsintegration", "+7UyQSwTkIfrL1BvEbw5+GF2Pcqh3Fsmkyj/cEqvMbZlFJ5rBuUgPiRR2yTR75s2Xkw5Hh9scRbIrb68GRCIXA==");
                CloudStorageAccount storageaccount = new CloudStorageAccount(sc, true);
                CloudBlobClient     blobClient     = storageaccount.CreateCloudBlobClient();
                CloudBlobContainer  container      = blobClient.GetContainerReference("profileimages");

                await container.CreateIfNotExistsAsync();

                //string[] FileEntries = App.System.IO._dir.GetFiles(path);


                //foreach (string FilePath in FileEntries)
                //{
                //    string key = System.IO.Path.GetFileName(path);//.GetFileName(FilePath);
                CloudBlockBlob blob = container.GetBlockBlobReference(CurrentUser.RetreiveUserId() + ".jpg");                 //(path);

                await blob.UploadFromByteArrayAsync(myByteArray, 0, i);
            }catch (Exception ex)
            {
                //LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
        }
Пример #4
0
        public override void ViewDidLoad()
        {
            LoggingClass.LogInfo("Entered into favorite", screen);
            try
            {
                this.CollectionView.Add(refreshControl);
                refreshControl.ValueChanged += (rcSender, e) =>
                {
                    //Refresh this view
                    myData = svc.GetItemFavsUID(CurrentUser.RetreiveUserId()).Result;
                    if (myData.ItemList.Count == 0)
                    {
                        UIImageView ImgIns = new UIImageView();
                        ImgIns.Image = UIImage.FromFile("FavIns.png");
                        UILabel NoFav = new UILabel();
                        NoFav.Text          = myData.ErrorDescription;
                        NoFav.LineBreakMode = UILineBreakMode.WordWrap;
                        NoFav.Lines         = 0;
                        CGSize sTemp = new CGSize(View.Frame.Width, 100);
                        sTemp               = NoFav.SizeThatFits(sTemp);
                        NoFav.Frame         = new CGRect(0, 50, View.Frame.Width - 20, sTemp.Height);
                        NoFav.TextAlignment = UITextAlignment.Center;
                        ImgIns.Frame        = new CGRect((View.Frame.Width / 2) - 100, 50 + sTemp.Height + 20, 202, 381);
                        CollectionView.AddSubview(NoFav);
                        CollectionView.AddSubview(ImgIns);
                    }
                    CollectionView.ReloadData();
                    refreshControl.EndRefreshing();
                };

                myData = svc.GetItemFavsUID(CurrentUser.RetreiveUserId()).Result;
                if (myData.ItemList.Count == 0)
                {
                    UIImageView ImgIns = new UIImageView();
                    ImgIns.Image = UIImage.FromFile("FavIns.png");
                    UILabel NoFav = new UILabel();
                    NoFav.Text          = myData.ErrorDescription;
                    NoFav.LineBreakMode = UILineBreakMode.WordWrap;
                    NoFav.Lines         = 0;
                    CGSize sTemp = new CGSize(View.Frame.Width, 100);
                    sTemp               = NoFav.SizeThatFits(sTemp);
                    NoFav.Frame         = new CGRect(0, 50, View.Frame.Width - 20, sTemp.Height);
                    NoFav.TextAlignment = UITextAlignment.Center;
                    ImgIns.Frame        = new CGRect((View.Frame.Width / 2) - 100, 50 + sTemp.Height + 20, 202, 381);
                    CollectionView.AddSubview(NoFav);
                    CollectionView.AddSubview(ImgIns);
                }
                BTProgressHUD.Dismiss();
                this.View.BackgroundColor           = new UIColor(256, 256, 256, 0.8f);
                this.CollectionView.BackgroundColor = UIColor.White;
                CollectionView.RegisterClassForCell(typeof(MyFavViewCell), MyFavViewCell.Key);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.Message, screen, ex.StackTrace);
            }
        }
Пример #5
0
        public void RefreshParent()
        {
            int userId      = Convert.ToInt32(CurrentUser.RetreiveUserId());
            var tastingData = sw.GetMyTastingsList(userId).Result;

            TableView.Source = new MyTastingTableSource(tastingData.TastingList.ToList(), NavigationController, this);
            TableView.ReloadData();
            refreshControl.EndRefreshing();
        }
Пример #6
0
        protected void DismissKeyboardOnBackgroundTap()
        {
            var tap = new UITapGestureRecognizer {
                CancelsTouchesInView = false
            };

            //tap.AddTarget(() => View.EndEditing(true));

            tap.AddTarget(() => {
                UIAlertView alert = new UIAlertView()
                {
                    Title = "Do you want save the review ?",
                    //Message = "Coming Soon..."
                };

                alert.AddButton("No");
                alert.AddButton("Yes");
                alert.Clicked += (senderalert, buttonArgs) =>
                {
                    if (buttonArgs.ButtonIndex == 1)
                    {
                        if (CurrentUser.RetreiveUserId() == 0)
                        {
                            UIAlertView alert1 = new UIAlertView()
                            {
                                Title = "This feature is allowed only for VIP Card holders",
                                //Message = "Coming Soon..."
                            };
                            //LoggingClass.LogInfo("Clicked on seacuces", screenid);
                            alert1.AddButton("OK");
                            alert1.AddButton("Know more");
                            alert1.Clicked += (sender, buttonArg) =>
                            {
                                if (buttonArgs.ButtonIndex == 1)
                                {
                                    UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html"));
                                }
                            };
                            alert1.Show();
                        }
                        else
                        {
                            NavController.DismissViewController(true, null);
                            SaveReview();
                        }
                    }
                    else if (buttonArgs.ButtonIndex == 0)
                    {
                        NavController.DismissViewController(true, null);
                        BTProgressHUD.Dismiss();
                    }
                };
                alert.Show();
            });
            lblTrans.UserInteractionEnabled = true;
            lblTrans.AddGestureRecognizer(tap);
        }
Пример #7
0
        public void RefreshParent()
        {
            nfloat              width  = View.Frame.Width;
            ServiceWrapper      svc    = new ServiceWrapper();
            ItemReviewResponse  rv     = svc.GetItemReviewUID(CurrentUser.RetreiveUserId()).Result;
            ItemDetailsResponse myData = svc.GetItemDetailsBarcode(WineBarcode, _storeId).Result;

            TableView.Source = new SKUDetailTableSource(width, this, NavigationController, myData.ItemDetails, _storeId);
            TableView.ReloadData();
        }
Пример #8
0
 public override void ViewDidLoad()
 {
     try
     {
         //   this.NavigationItem.SetRightBarButtonItem(
         //	new UIBarButtonItem(UIBarButtonSystemItem.Action, (sender, args) => {
         //       // button was clicked
         //})
         //, true);
         ServiceWrapper svc = new ServiceWrapper();
         myData = svc.GetItemLists(storeId, CurrentUser.RetreiveUserId()).Result;
         if (myData.ItemList.Count != 0)
         {
             this.CollectionView.Add(refreshControl);
             refreshControl.ValueChanged += (rcSender, e) =>
             {
                 //Refresh this view
                 myData = svc.GetItemLists(storeId, CurrentUser.RetreiveUserId()).Result;
                 CollectionView.ReloadData();
                 refreshControl.EndRefreshing();
             };
             BTProgressHUD.Dismiss();
             this.View.BackgroundColor           = new UIColor(256, 256, 256, 0.8f);
             this.CollectionView.BackgroundColor = UIColor.White;
             CollectionView.RegisterClassForCell(typeof(APLCollectionViewCell), APLCollectionViewCell.Key);
         }
         else
         {
             this.View.BackgroundColor           = new UIColor(256, 256, 256, 0.8f);
             this.CollectionView.BackgroundColor = UIColor.White;
             string _name = null;
             if (storeId == 3)
             {
                 _name = LoggingClass.txtstore3;
             }
             UIAlertView alert = new UIAlertView()
             {
                 Title   = _name + " Store",
                 Message = "Coming Soon"
             };
             alert.AddButton("OK");
             alert.Show();
         }
     }
     catch (Exception ex)
     {
         BTProgressHUD.ShowErrorWithStatus("Something went wrong,We're on it.");
         LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
     }
 }
		public async void EmailVerification()
		{
			try
			{
				DeviceToken Dt = new DeviceToken();
				if (CurrentUser.GetId() != null)
				{
					Dt = await svc.VerifyMail(CurrentUser.GetId());
				}
				if (Dt.VerificationStatus == 1)
				{
					CurrentUser.Store(cr.customer.CustomerID.ToString(), cr.customer.FirstName + cr.customer.LastName);
					CurrentUser.PutStore(cr.customer.PreferredStore);
					if (RootTabs == null || _window == null)
					{
						RootTabs = CurrentUser.RootTabs;
						_window = CurrentUser.window;
						nav = new UINavigationController(RootTabs);
						AddNavigationButtons(nav);
						_window.RootViewController = nav;
						LoggingClass.LogInfo("The User logged in with user id: " + CurrentUser.RetreiveUserId(), screenid);
					}
					else
					{
						nav = new UINavigationController(RootTabs);
						AddNavigationButtons(nav);
						_window.RootViewController = nav;
						LoggingClass.LogInfo("The User logged in with user id: " + CurrentUser.RetreiveUserId(), screenid);
					}
					BTProgressHUD.Dismiss();
				}
				else
				{
					try
					{
						BTProgressHUD.ShowErrorWithStatus("Your email is not verified plesase check email and verify.", 5000);
						View.AddSubview(btnResend);
					}
					catch (Exception ex)
					{
						LoggingClass.LogError(ex.Message, screenid, ex.StackTrace);
					}
				}
			}
			catch (Exception Exe)
			{
				LoggingClass.LogError(Exe.Message, screenid, Exe.StackTrace);
			}
		}
 public override void ViewDidLoad()
 {
     try
     {
         LoggingClass.LogInfo("Entered into MyReviews View", screenid);
         int userId = Convert.ToInt32(CurrentUser.RetreiveUserId());
         var myData = sw.GetItemReviewUID(userId).Result;
         var data   = sw.GetMyTastingsList(userId).Result;
         Noreviews = new UILabel();
         if (data.TastingList.Count != 0)
         {
             Noreviews.Text = "You have tasted " + data.TastingList.Count + " wines.\n We would love to hear your feedback.";
         }
         else
         {
             Noreviews.Text = "Please taste and then review.";
         }
         Noreviews.TextAlignment = UITextAlignment.Center;
         Noreviews.LineBreakMode = UILineBreakMode.WordWrap;
         Noreviews.Lines         = 0;
         Noreviews.TextColor     = UIColor.Black;
         CGSize sTemp = new CGSize(View.Frame.Width, 100);
         sTemp           = Noreviews.SizeThatFits(sTemp);
         Noreviews.Frame = new CGRect(0, 50, View.Frame.Width, sTemp.Height);
         ImgIns          = new UIImageView();
         ImgIns.Image    = UIImage.FromFile("ReviewIns.png");
         ImgIns.Frame    = new CGRect((View.Frame.Width / 2) - 150, 120, 300, 300);
         if (myData.Reviews.Count == 0)
         {
             TableView.SeparatorColor = UIColor.Clear;
             View.AddSubview(Noreviews);
             View.AddSubview(ImgIns);
         }
         else
         {
             TableView.AllowsSelection = false;
             TableView.Source          = new MyReviewTableSource(myData.Reviews.ToList(), NavigationController, this);
         }
     }
     catch (Exception ex)
     {
         UIAlertView alert = new UIAlertView()
         {
             Title = "Something went wrong,we're on it.",
         };
         alert.AddButton("Ok");
         LoggingClass.LogError(ex.Message, screenid, ex.StackTrace);
     }
 }
        public void RefreshParent()
        {
            ServiceWrapper svc    = new ServiceWrapper();
            int            userId = Convert.ToInt32(CurrentUser.RetreiveUserId());
            var            myData = svc.GetItemReviewUID(userId).Result;

            if (myData.Reviews.Count == 0)
            {
                TableView.SeparatorColor = UIColor.Clear;
                View.AddSubview(Noreviews);
                View.AddSubview(ImgIns);
            }
            TableView.Source = new MyReviewTableSource(myData.Reviews.ToList(), NavigationController, this);
            TableView.ReloadData();
        }
Пример #12
0
        //Registering for remote notifications
        public override async void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
        {
            try
            {
                CurrentUser.app = application;
                CurrentUser.dt  = deviceToken;
                var DeviceToken = deviceToken.Description;
                if (!string.IsNullOrWhiteSpace(DeviceToken))
                {
                    DeviceToken = DeviceToken.Trim('<').Trim('>');
                    CurrentUser.PutDeviceToken(DeviceToken);
                }
                ServiceWrapper svc = new ServiceWrapper();
                await svc.InsertUpdateToken(DeviceToken, CurrentUser.RetreiveUserId().ToString());

                LoggingClass.LogInfo("Device Token " + DeviceToken, screen);

                //CurrentUser.PutDeviceToken(DeviceToken);
                //UIAlertView alert1 = new UIAlertView()
                //{
                //Title = DeviceToken,
                //};
                //alert1.AddButton("OK");
                //alert1.Show();
                var oldDeviceToken = NSUserDefaults.StandardUserDefaults.StringForKey("PushDeviceToken");

                // Has the token changed?
                if (string.IsNullOrEmpty(oldDeviceToken) || !oldDeviceToken.Equals(DeviceToken))
                {
                    await svc.InsertUpdateToken(DeviceToken, CurrentUser.RetreiveUserId().ToString());

                    //UIAlertView alert = new UIAlertView()
                    //{
                    //	Title = DeviceToken,
                    //};
                    //alert.AddButton("OK");
                    //alert.Show();
                }

                // Save new device token
                NSUserDefaults.StandardUserDefaults.SetString(DeviceToken, "PushDeviceToken");
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.Message + " User not allowed to send notifications.", screen, ex.StackTrace);
            }
        }
Пример #13
0
 public override void ViewDidLoad()
 {
     try
     {
         LoggingClass.LogInfo("Entered into detail view of " + WineBarcode, screenid);
         BTProgressHUD.Show();
         nfloat              width  = View.Frame.Width;
         ServiceWrapper      svc    = new ServiceWrapper();
         ItemDetailsResponse myData = svc.GetItemDetailsBarcode(WineBarcode, _storeId).Result;
         ItemReviewResponse  rv     = svc.GetItemReviewUID(CurrentUser.RetreiveUserId()).Result;
         TableView.SeparatorStyle  = UITableViewCellSeparatorStyle.None;
         TableView.AllowsSelection = false;
         TableView.RowHeight       = UITableView.AutomaticDimension;
         TableView.Source          = new SKUDetailTableSource(width, this, NavigationController, myData.ItemDetails, _storeId);
         BTProgressHUD.Dismiss();
     }
     catch (Exception ex)
     {
         LoggingClass.LogError(ex.Message, screenid, ex.StackTrace.ToString());
     }
 }
        public override void ViewDidLoad()
        {
            //AboutController1.ViewDidLoad(base);

            ServiceWrapper svc = new ServiceWrapper();

            if (FaviouriteView)
            {
                myData = svc.GetItemFavsUID(CurrentUser.RetreiveUserId()).Result;
            }
            else
            {
                myData = svc.GetItemLists(storeId, CurrentUser.RetreiveUserId()).Result;
            }

            //View.BackgroundColor = UIColor.White;
            this.View.BackgroundColor = new UIColor(256, 256, 256, 0.8f);
            //this.View
            //this.CollectionView.BackgroundColor = UIColor.White;
            //this.CollectionView.InsertSubview(new UIImageView(UIImage.FromFile("placeholder.jpeg")), 0);
            //CollectionView.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile("eno.jpg"));
            CollectionView.RegisterClassForCell(typeof(BottleCell), "BottleCell");
        }
Пример #15
0
        public override void ViewDidLoad()
        {
            try
            {
                UIToolbar toolbar = new UIToolbar(new RectangleF(0.0f, 0.0f, Convert.ToSingle(this.View.Frame.Size.Width), 44.0f));
                //toolbar.TintColor = UIColor.White;
                //toolbar.BarStyle = UIBarStyle.Black;
                //toolbar.Translucent = true;
                toolbar.Items = toolbar.Items = new UIBarButtonItem[]
                {
                    new UIBarButtonItem(UIBarButtonSystemItem.Done, delegate { this.txtComments.ResignFirstResponder(); })
                };
                //AboutController1.ViewDidLoad(base);
                this.View.BackgroundColor = new UIColor(0, 0, 0, 0.8f);
                nfloat y           = 40;
                var    lblProducer = new UILabel();
                lblProducer.Frame           = new CGRect(4, 180 - y, View.Frame.Width - 8, 30);
                lblProducer.Text            = "My Tasting";
                lblProducer.BackgroundColor = UIColor.Purple;
                lblProducer.TextAlignment   = UITextAlignment.Center;
                lblProducer.TextColor       = UIColor.White;
                this.View.AddSubview(lblProducer);
                lblTrans                 = new UILabel();
                lblTrans.Frame           = new CGRect(0, 0, View.Frame.Width, View.Frame.Height);
                lblTrans.BackgroundColor = new UIColor(0, 0, 0, 0.0f);
                this.View.AddSubview(lblTrans);

                //this.View.Alpha = 0.5f;
                UIButton btnClose = new UIButton(new CGRect(9, 185 - y, 20, 20));
                btnClose.SetBackgroundImage(new UIImage("Close.png"), UIControlState.Normal);
                this.View.AddSubview(btnClose);

                btnClose.TouchUpInside += (sender, e) =>
                {
                    NavController.DismissViewController(true, null);
                };

                imgBtl       = new UIImageView(new CGRect(View.Frame.Width - 64, 149 - y, 60, 60));
                imgBtl.Image = UIImage.FromFile("wine_review.png");
                //imgBtl.BackgroundColor = UIColor.White;
                this.View.AddSubview(imgBtl);

                lblWhite                 = new UILabel();
                lblWhite.Frame           = new CGRect(4, 210 - y, View.Frame.Width - 8, 200);     //200
                lblWhite.BackgroundColor = UIColor.White;
                lblWhite.TextAlignment   = UITextAlignment.Center;
                this.View.AddSubview(lblWhite);

                var Separator = new UIImageView(new CGRect(14, 225 - y, View.Frame.Width - 28, 2));
                Separator.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
                Separator.Image            = UIImage.FromFile("separator.png");
                this.View.AddSubview(Separator);


                var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/empty.png"),
                                                    filledImage: UIImage.FromBundle("Stars/star.png"),
                                                    chosenImage: UIImage.FromBundle("Stars/star.png"));

                var lblStarBack = new UILabel();
                lblStarBack.Frame           = new CGRect(View.Bounds.Width * 3 / 9, 210 - y, View.Bounds.Width / 3, 35f);
                lblStarBack.BackgroundColor = UIColor.White;
                lblStarBack.TextAlignment   = UITextAlignment.Center;
                this.View.AddSubview(lblStarBack);

                // Create the view.
                decimal      averageRating = StartsSelected;
                PDRatingView ratingView    = new PDRatingView(new CGRect(View.Bounds.Width * 3 / 8, 210 - y, View.Bounds.Width / 4, 35f), ratingConfig, averageRating);
                //ratingView.UserInteractionEnabled = true

                ratingView.BackgroundColor = UIColor.White;
                ratingView.RatingChosen   += (sender, e) =>
                {
                    StartsSelected = e.Rating;
                };
                this.View.AddSubview(ratingView);


                txtComments       = new UITextView();
                txtComments.Frame = new CGRect(14, 250 - y, View.Frame.Width - 28, 130);
                //txtComments.Text = "Describe your testing";
                //txtComments.TextAlignment = UITextAlignment.Justified;
                //txtComments.BackgroundColor = UIColor.LightGray;
                txtComments.Text = Comments.Length > 0 ? Comments : "Describe your tasting";
                txtComments.InputAccessoryView = toolbar;
                txtComments.Started           += (sender, e) =>
                {
                    if (((UITextView)sender).Text == "Describe your tasting")
                    {
                        ((UITextView)sender).Text = "";
                    }
                };
                txtComments.BecomeFirstResponder();
                this.View.AddSubview(txtComments);

                UIButton btnSave = new UIButton(new CGRect(14, 370 - y, View.Frame.Width - 28, 20));
                //btnSave.SetBackgroundImage(new UIImage("Close.png"), UIControlState.Normal);
                btnSave.SetTitle("SAVE", UIControlState.Normal);
                btnSave.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
                btnSave.SetTitleColor(UIColor.Purple, UIControlState.Normal);
                LoggingClass.LogInfo("Added review to the " + WineId, screen);
                this.View.AddSubview(btnSave);
                btnSave.TouchDown += (sender, e) =>
                {
                    if (CurrentUser.RetreiveUserId() == 0)
                    {
                        UIAlertView alert = new UIAlertView()
                        {
                            Title = "This feature is allowed only for VIP Card holders",
                            //Message = "Coming Soon..."
                        };
                        //LoggingClass.LogInfo("Clicked on seacuces", screenid);
                        alert.AddButton("OK");
                        alert.AddButton("Know more");
                        alert.Clicked += (senderalert, buttonArgs) =>
                        {
                            if (buttonArgs.ButtonIndex == 1)
                            {
                                UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html"));
                            }
                        };
                        alert.Show();
                    }
                    else
                    {
                        BTProgressHUD.Show("Saving review...");                         //show spinner + text
                    }
                };
                btnSave.TouchUpInside += (sender, e) =>
                {
                    if (CurrentUser.RetreiveUserId() == 0)
                    {
                        UIAlertView alert = new UIAlertView()
                        {
                            Title = "This feature is allowed only for VIP Card holders",
                            //Message = "Coming Soon..."
                        };
                        //LoggingClass.LogInfo("Clicked on seacuces", screenid);
                        alert.AddButton("OK");
                        alert.AddButton("Know more");
                        alert.Clicked += (senderalert, buttonArgs) =>
                        {
                            if (buttonArgs.ButtonIndex == 1)
                            {
                                UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html"));
                            }
                        };
                        alert.Show();
                    }
                    else
                    {
                        NavController.DismissViewController(true, null);
                        SaveReview();
                    }
                };
                DismissKeyboardOnBackgroundTap();
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
        }
        public MyReviewCellView(NSString cellId) : base(UITableViewCellStyle.Default, cellId)
        {
            try
            {
                btnBack = new UIButton();
                btnBack.BackgroundColor        = UIColor.FromRGB(63, 63, 63);
                btnBack.UserInteractionEnabled = false;
                SelectionStyle             = UITableViewCellSelectionStyle.Gray;
                imageView                  = new UIButton();
                imageView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
                imageView.ContentMode      = UIViewContentMode.Center;
                imageView.ClipsToBounds    = true;
                //imageView.TouchDown += (object sender, EventArgs e) =>
                //{
                //	BTProgressHUD.Show("Loading...");
                //};
                imageView.TouchUpInside += (object sender, EventArgs e) =>
                {
                    BTProgressHUD.Show(LoggingClass.txtloading);
                    NavController.PushViewController(new DetailViewController(WineIdLabel.Text, storeid.ToString(), false, true), false);
                };
                Review review = new Review();
                separator = new UIImageView();

                btnItemname = new UIButton();
                btnItemname.SetTitle("", UIControlState.Normal);
                btnItemname.SetTitleColor(UIColor.FromRGB(127, 51, 0), UIControlState.Normal);
                btnItemname.Font                = UIFont.FromName("Verdana-Bold", 13f);
                btnItemname.LineBreakMode       = UILineBreakMode.WordWrap;
                btnItemname.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;
                btnItemname.TouchUpInside      += delegate
                {
                    BTProgressHUD.Show("Loading...");
                    NavController.PushViewController(new DetailViewController(WineIdLabel.Text, storeid.ToString(), false, true), false);
                };
                ReviewDate = new UILabel()
                {
                    Font      = UIFont.FromName("AmericanTypewriter", 10f),
                    TextColor = UIColor.FromRGB(38, 127, 200),
                    //TextAlignment = UITextAlignment.Center,
                    BackgroundColor = UIColor.Clear
                };
                Comments = new UITextView()
                {
                    Font          = UIFont.FromName("AmericanTypewriter", 14f),
                    TextColor     = UIColor.FromRGB(55, 127, 0),
                    TextAlignment = UITextAlignment.Justified,
                    //TextAlignment = UITextAlignment.Natural,
                    BackgroundColor = UIColor.Clear,
                    //LineBreakMode = UILineBreakMode.WordWrap
                    Editable   = false,
                    Selectable = false
                };
                ReadMore = new UIButton()
                {
                    Font            = UIFont.FromName("Verdana", 10f),
                    BackgroundColor = UIColor.White
                };
                Vintage = new UILabel()
                {
                    Font            = UIFont.FromName("Verdana", 10f),
                    TextColor       = UIColor.FromRGB(127, 51, 100),
                    BackgroundColor = UIColor.Clear
                };
                decimal averageRating = 0.0m;
                var     ratingConfig  = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/star-silver2.png"),
                                                         filledImage: UIImage.FromBundle("Stars/star.png"),
                                                         chosenImage: UIImage.FromBundle("Stars/star.png"));
                stars   = new PDRatingView(new CGRect(110, 60, 60, 20), ratingConfig, averageRating);
                btnEdit = new UIButton();
                btnEdit.SetImage(UIImage.FromFile("edit.png"), UIControlState.Normal);
                btnEdit.TouchUpInside += (sender, e) =>
                {
                    PopupView yourController = new PopupView(WineIdLabel.Text, storeid);
                    yourController.NavController  = NavController;
                    yourController.parent         = Parent;
                    yourController.StartsSelected = stars.AverageRating;
                    yourController.Comments       = Comments.Text;
                    LoggingClass.LogInfo("Edited the review of " + wineId, screenid);


                    //yourController.WineId = Convert.ToInt32(WineIdLabel.Text);
                    yourController.ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext;
                    //this.PresentViewController(yourController, true, null);
                    Parent.PresentModalViewController(yourController, false);
                };
                btnDelete = new UIButton();
                btnDelete.SetImage(UIImage.FromFile("delete.png"), UIControlState.Normal);
                btnDelete.TouchUpInside += (sender, e) =>
                {
                    UIAlertView alert = new UIAlertView()
                    {
                        Title   = "Delete Review ",
                        Message = LoggingClass.txtdeletereview,
                    };
                    alert.AddButton("Yes");
                    alert.AddButton("No");

                    alert.Clicked += async(senderalert, buttonArgs) =>
                    {
                        if (buttonArgs.ButtonIndex == 0)
                        {
                            review.Barcode      = WineIdLabel.Text;
                            review.ReviewUserId = Convert.ToInt32(CurrentUser.RetreiveUserId());
                            BTProgressHUD.Show("Deleting review");
                            await sw.DeleteReview(review);

                            LoggingClass.LogInfo("Deleting the review of " + wineId, screenid);
                            BTProgressHUD.ShowSuccessWithStatus("Done");
                            ((IPopupParent)Parent).RefreshParent();
                        }
                    };

                    alert.Show();
                };
                btnLike = new UIButton();
                btnLike.ClipsToBounds              = true;
                btnLike.Layer.BorderColor          = UIColor.White.CGColor;
                btnLike.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;
                btnLike.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                btnLike.Tag = 0;
                //myItem = new Item();
                //bool count =Convert.ToBoolean( myItem.IsLike);
                //if (count == true)
                //{
                //btnLike.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);}
                //else
                //{
                //	btnLike.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                //}
                btnLike.TouchUpInside += async(object sender, EventArgs e) =>
                {
                    try
                    {
                        UIButton temp = (UIButton)sender;
                        if (temp.Tag == 0)
                        {
                            btnLike.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);
                            temp.Tag   = 1;
                            Data.Liked = 1;
                            //btnLike.Tag = 1;
                            LoggingClass.LogInfo("Liked Wine " + WineIdLabel.Text, screenid);
                        }
                        else
                        {
                            btnLike.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                            temp.Tag   = 0;
                            Data.Liked = 0;

                            LoggingClass.LogInfo("Unliked Wine " + WineIdLabel.Text, screenid);
                        }
                        SKULike like = new SKULike();
                        like.UserID  = Convert.ToInt32(CurrentUser.RetreiveUserId());
                        like.BarCode = WineIdLabel.Text;
                        like.Liked   = Convert.ToBoolean(temp.Tag);

                        Data.Liked = Convert.ToInt32(temp.Tag);
                        await sw.InsertUpdateLike(like);
                    }
                    catch (Exception ex)
                    {
                        LoggingClass.LogError(ex.Message, screenid, ex.StackTrace);
                    }
                };
                WineIdLabel = new UILabel();
                ContentView.AddSubviews(new UIView[] { btnBack, btnItemname, ReadMore, ReviewDate, Comments, stars, imageView, Vintage, separator, btnEdit, btnDelete, btnLike });
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screenid, ex.StackTrace);
            }
        }
Пример #17
0
        void Internal_ViewDidLoad(bool v)
        {
            try
            {
                //Getting Screen height and width
                nfloat ScreenHeight = UIScreen.MainScreen.Bounds.Height;
                nfloat ScreenWidth  = UIScreen.MainScreen.Bounds.Width;
                //Caliculating height for profile background image
                nfloat probackimgheight = (ScreenHeight - 100) / 3;
                nfloat imgprofile       = 120;
                nfloat Space            = 30;
                nfloat strtx            = 90;
                NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillHideNotification, KeyBoardDownNotification);
                NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidShowNotification, KeyBoardUpNotification);

                pickerDataModel = new StatePickerDataModel();
                //pickerDataModel.Items.Add("Select your state");
                pickerDataModel.Items.Add("AL");
                pickerDataModel.Items.Add("AK");
                pickerDataModel.Items.Add("AZ");
                pickerDataModel.Items.Add("AR");
                pickerDataModel.Items.Add("CA");
                pickerDataModel.Items.Add("CO");
                pickerDataModel.Items.Add("CT");
                pickerDataModel.Items.Add("DE");
                pickerDataModel.Items.Add("FL");
                pickerDataModel.Items.Add("GA");
                pickerDataModel.Items.Add("HI");
                pickerDataModel.Items.Add("ID");
                pickerDataModel.Items.Add("IL");
                pickerDataModel.Items.Add("IN");
                pickerDataModel.Items.Add("IA");
                pickerDataModel.Items.Add("KS");
                pickerDataModel.Items.Add("KY");
                pickerDataModel.Items.Add("LA");
                pickerDataModel.Items.Add("ME");
                pickerDataModel.Items.Add("MD");
                pickerDataModel.Items.Add("MA");
                pickerDataModel.Items.Add("MI");
                pickerDataModel.Items.Add("MN");
                pickerDataModel.Items.Add("MS");
                pickerDataModel.Items.Add("MO");
                pickerDataModel.Items.Add("MT");
                pickerDataModel.Items.Add("NE");
                pickerDataModel.Items.Add("NV");
                pickerDataModel.Items.Add("NH");
                pickerDataModel.Items.Add("NJ");
                pickerDataModel.Items.Add("NM");
                pickerDataModel.Items.Add("NY");
                pickerDataModel.Items.Add("NC");
                pickerDataModel.Items.Add("ND");
                pickerDataModel.Items.Add("OH");
                pickerDataModel.Items.Add("OK");
                pickerDataModel.Items.Add("OR");
                pickerDataModel.Items.Add("PA");
                pickerDataModel.Items.Add("RI");
                pickerDataModel.Items.Add("SC");
                pickerDataModel.Items.Add("SD");
                pickerDataModel.Items.Add("TN");
                pickerDataModel.Items.Add("TX");
                pickerDataModel.Items.Add("UT");
                pickerDataModel.Items.Add("VT");
                pickerDataModel.Items.Add("VA");
                pickerDataModel.Items.Add("WA");
                pickerDataModel.Items.Add("WV");
                pickerDataModel.Items.Add("WI");
                pickerDataModel.Items.Add("WY");

                StoreDataModel = new StorePickerDataModel();
                StoreDataModel.Items.Add("Select your store");
                StoreDataModel.Items.Add("Wall");
                StoreDataModel.Items.Add("Pt. Pleasant Beach");
                StoreDataModel.Items.Add("All");

                BTProgressHUD.Dismiss();

                //Background image controller
                UIImageView backgroud = new UIImageView();
                backgroud.Frame = new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width, probackimgheight - 20);
                backgroud.Image = new UIImage("proback.png");
                backgroud.UserInteractionEnabled = false;

                nfloat x = (ScreenWidth / 2) - (imgprofile / 2);
                x = x - 10;
                nfloat y = ((backgroud.Frame.Height) / 2) - 30;

                UIBotton btnImageBack = new UIBotton
                {
                    UserInteractionEnabled = false,
                    Frame           = new CGRect(x, y + 10, imgprofile + 20, imgprofile + 20),
                    BackgroundColor = UIColor.Black
                };
                imgprofilepic = new UIImageView
                {
                    Frame           = new CGRect(x + 10, y + 20, imgprofile, imgprofile),
                    BackgroundColor = UIColor.White
                };
                imgprofilepic.Image = new UIImage("Images/loadin.png");

                btnChange = new UIButton
                {
                    Frame = new CGRect(x + (imgprofilepic.Frame.Width - 10), y + (imgprofilepic.Frame.Height), 30, 30)
                };

                UIImage imgbtnCam = UIImage.FromFile("edit.png");
                imgbtnCam = ResizeImage(imgbtnCam, 25, 25);
                btnChange.SetImage(imgbtnCam, UIControlState.Normal);
                btnChange.SetBackgroundImage(imgbtnCam, UIControlState.Normal);
                //btnChange.BackgroundColor = UIColor.Blue;
                ScreenWidth  = 25;
                ScreenHeight = UIScreen.MainScreen.Bounds.Width - (strtx + 10);
                y            = y + imgprofilepic.Bounds.Height + 50;

                UILabel lblName = new UILabel
                {
                    Text  = "Name:",
                    Frame = new CGRect(10, y, ScreenHeight, ScreenWidth),
                    Font  = UIFont.FromName("HelveticaNeue-Bold", 16f)
                };
                txtName = new UITextField
                {
                    Frame       = new CGRect(strtx, y, ScreenHeight, ScreenWidth),
                    Placeholder = "E.g. John Doe",
                    BorderStyle = UITextBorderStyle.RoundedRect,
                    Font        = UIFont.FromName("HelveticaNeue", 13f)
                                  //UserInteractionEnabled=true
                };
                txtName.ShouldReturn += (TextField) =>
                {
                    ((UITextField)TextField).ResignFirstResponder();
                    return(true);
                };
                y = y + Space;
                UILabel lblEmail = new UILabel
                {
                    Text  = "Email:",
                    Frame = new CGRect(10, y, ScreenHeight, ScreenWidth),
                    Font  = UIFont.FromName("HelveticaNeue-Bold", 16f)
                };
                //y = y + lblEmail.Bounds.Height;
                txtEmail = new UITextField
                {
                    Placeholder  = "E.g. [email protected]",
                    Frame        = new CGRect(strtx, y, ScreenHeight, ScreenWidth),
                    BorderStyle  = UITextBorderStyle.RoundedRect,
                    KeyboardType = UIKeyboardType.EmailAddress,
                    Font         = UIFont.FromName("HelveticaNeue", 13f)
                                   //UserInteractionEnabled=true
                };
                txtEmail.ShouldReturn += (TextField) =>
                {
                    ((UITextField)TextField).ResignFirstResponder();
                    return(true);
                };
                y = y + Space;
                UILabel lblMobile = new UILabel
                {
                    Text  = "Mobile:",
                    Frame = new CGRect(10, y, ScreenHeight, ScreenWidth),
                    Font  = UIFont.FromName("HelveticaNeue-Bold", 16f)
                };

                txtFirst3 = new UITextField
                {
                    Placeholder = "123",
                    //Text="123",
                    Frame        = new CGRect(strtx, y, 50, ScreenWidth),
                    BorderStyle  = UITextBorderStyle.RoundedRect,
                    KeyboardType = UIKeyboardType.NumberPad,
                    Font         = UIFont.FromName("HelveticaNeue", 13f)
                                   //UserInteractionEnabled = true
                };
                //strtx = strtx + 10;
                UILabel symIphon1 = new UILabel
                {
                    Text  = "-",
                    Frame = new CGRect(strtx + 50, y, 10, ScreenWidth)
                };
                txtSecond3 = new UITextField
                {
                    Placeholder = "456",
                    //Text="123",
                    Frame        = new CGRect(strtx + 60, y, 50, ScreenWidth),
                    BorderStyle  = UITextBorderStyle.RoundedRect,
                    KeyboardType = UIKeyboardType.NumberPad,
                    Font         = UIFont.FromName("HelveticaNeue", 13f)
                };
                UILabel symIphon2 = new UILabel
                {
                    Text  = "-",
                    Frame = new CGRect(strtx + 110, y, 10, ScreenWidth)
                };
                txtLast4 = new UITextField
                {
                    Placeholder = "7890",
                    //Text="1234",
                    Frame        = new CGRect(strtx + 120, y, UIScreen.MainScreen.Bounds.Width - (strtx + 130), ScreenWidth),
                    BorderStyle  = UITextBorderStyle.RoundedRect,
                    KeyboardType = UIKeyboardType.NumberPad,
                    Font         = UIFont.FromName("HelveticaNeue", 13f)
                                   //UserInteractionEnable
                };
                txtLast4.ShouldReturn += (TextField) =>
                {
                    ((UITextField)TextField).ResignFirstResponder();
                    return(true);
                };
                txtFirst3.ShouldReturn += (TextField) =>
                {
                    ((UITextField)TextField).ResignFirstResponder();
                    return(true);
                };
                txtSecond3.ShouldReturn += (TextField) =>
                {
                    ((UITextField)TextField).ResignFirstResponder();
                    return(true);
                };
                y = y + Space;
                UILabel lblAddress = new UILabel
                {
                    Text  = "Address:",
                    Frame = new CGRect(10, y, ScreenHeight, ScreenWidth),
                    Font  = UIFont.FromName("HelveticaNeue-Bold", 16f)
                };
                txtAddress = new UITextField
                {
                    Placeholder = "E.g. 1600 Pennsylvania Ave NW",
                    Frame       = new CGRect(strtx, y, ScreenHeight, ScreenWidth),
                    BorderStyle = UITextBorderStyle.RoundedRect,
                    Font        = UIFont.FromName("HelveticaNeue", 13f)
                };
                txtAddress.ShouldReturn += (TextField) =>
                {
                    ((UITextField)TextField).ResignFirstResponder();
                    return(true);
                };
                y = y + Space;
                UILabel lblState = new UILabel
                {
                    Text  = "State:",
                    Frame = new CGRect(10, y + 25, ScreenHeight, ScreenWidth),
                    Font  = UIFont.FromName("HelveticaNeue-Bold", 16f)
                };
                stpicker.Frame = new CGRect(strtx, y, 50, 90);
                //stpicker.BackgroundColor = UIColor.LightGray;
                stpicker.Model = pickerDataModel;
                //stpicker.Hidden = true;

                //
                nfloat  zipx       = strtx + 80;
                UILabel lblZipcode = new UILabel
                {
                    Text  = "Zipcode:",
                    Frame = new CGRect(zipx, y + 25, ScreenHeight, ScreenWidth),
                    Font  = UIFont.FromName("HelveticaNeue-Bold", 16f)
                };
                txtZipcode = new UITextField
                {
                    Placeholder            = "E.g. 08632",
                    Frame                  = new CGRect(zipx + 70, y + 25, 80, ScreenWidth),
                    BorderStyle            = UITextBorderStyle.RoundedRect,
                    UserInteractionEnabled = true,
                    KeyboardType           = UIKeyboardType.NumberPad,
                    Font = UIFont.FromName("HelveticaNeue", 13f)
                };
                txtZipcode.ShouldReturn += (TextField) =>
                {
                    ((UITextField)TextField).ResignFirstResponder();
                    return(true);
                };
                y = y + 90;
                //y = y + Space;
                UILabel lblCardExpiry = new UILabel
                {
                    Text  = "Expiry:",
                    Frame = new CGRect(UIScreen.MainScreen.Bounds.Width / 2, y, ScreenHeight, ScreenWidth),
                    Font  = UIFont.FromName("HelveticaNeue-Bold", 16f)
                };
                UILabel lblCardDate = new UILabel
                {
                    Frame = new CGRect((UIScreen.MainScreen.Bounds.Width / 2) + 70, y, ScreenHeight, ScreenWidth),
                    Font  = UIFont.FromName("HelveticaNeue", 13f)
                };
                //y = y + Space;
                UILabel lblcardnumber = new UILabel
                {
                    Text  = "Card #:",
                    Frame = new CGRect(10, y, ScreenHeight, ScreenWidth),
                    Font  = UIFont.FromName("HelveticaNeue-Bold", 16f)
                };
                UILabel CardNumer = new UILabel
                {
                    Frame = new CGRect(strtx, y, ScreenHeight, ScreenWidth),
                    Font  = UIFont.FromName("HelveticaNeue", 13f)
                };
                y = y + Space;
                UILabel lblMystore = new UILabel
                {
                    Text  = "My Store:",
                    Frame = new CGRect(10, y + 25, ScreenHeight, ScreenWidth),
                    Font  = UIFont.FromName("HelveticaNeue-Bold", 16f)
                };
                StorePicker.Frame = new CGRect(strtx, y, UIScreen.MainScreen.Bounds.Width - (strtx + 10), 90);
                //StorePicker.BackgroundColor = UIColor.LightGray;
                StorePicker.Hidden = false;
                y         = y + 90;
                btnUpdate = new UIButton();
                btnUpdate.SetTitle("Update", UIControlState.Normal);
                btnUpdate.Frame = new CGRect(UIScreen.MainScreen.Bounds.Width / 2 - 25, y, 100, 30);
                btnUpdate.SetTitleColor(UIColor.White, UIControlState.Normal);
                btnUpdate.BackgroundColor     = UIColor.Purple;
                btnUpdate.Font                = UIFont.FromName("HelveticaNeue-Bold", 16f);
                btnUpdate.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
                StorePicker.Model             = StoreDataModel;
                Scroll = new UIScrollView
                {
                    Frame            = new CGRect(0, 0, View.Frame.Width, View.Frame.Height),
                    ContentSize      = new CGSize(View.Frame.Width, View.Frame.Height),
                    BackgroundColor  = UIColor.White,
                    AutoresizingMask = UIViewAutoresizing.FlexibleHeight,
                };
                UITapGestureRecognizer taps = new UITapGestureRecognizer();
                taps.CancelsTouchesInView = false;
                taps.AddTarget(() => Scroll.EndEditing(true));

                if (CurrentUser.RetreiveUserId() == 0)
                {
                    Scroll.AddSubview(stpicker);
                    Scroll.AddSubview(StorePicker);
                    StorePicker.UserInteractionEnabled = false;
                    stpicker.UserInteractionEnabled    = false;
                    txtName.UserInteractionEnabled     = false;
                    txtEmail.UserInteractionEnabled    = false;
                    txtFirst3.UserInteractionEnabled   = false;
                    txtSecond3.UserInteractionEnabled  = false;
                    txtLast4.UserInteractionEnabled    = false;
                    txtAddress.UserInteractionEnabled  = false;
                    txtZipcode.UserInteractionEnabled  = false;
                    btnChange.UserInteractionEnabled   = false;
                    btnUpdate.UserInteractionEnabled   = false;
                    UIAlertView alert = new UIAlertView()
                    {
                        Title = "This feature is allowed only for VIP Card holders",
                        //Message = "Coming Soon..."
                    };

                    alert.AddButton("OK");
                    alert.AddButton("Log in");
                    alert.AddButton("Know more");
                    alert.Clicked += (senderalert, buttonArgs) =>
                    {
                        if (buttonArgs.ButtonIndex == 1)
                        {
                            CurrentUser.Clear();
                            LoginViewController yourController = new LoginViewController();
                            yourController.nav      = NavCtrl;
                            yourController.RootTabs = CurrentUser.RootTabs;
                            NavCtrl.PushViewController(yourController, false);
                        }
                    };
                    alert.Clicked += (senderalert, buttonArgs) =>
                    {
                        if (buttonArgs.ButtonIndex == 2)
                        {
                            UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html"));
                        }
                    };
                    alert.Show();
                }
                else
                {
                    Scroll.AddSubview(stpicker);
                    Scroll.AddSubview(StorePicker);
                    DownloadAsync();
                    cRes = svc.GetCustomerDetails(CurrentUser.RetreiveUserId()).Result;
                    if (cRes.customer.CardNumber != null && cRes.customer.CardNumber != "")
                    {
                        name          = cRes.customer.FirstName + " " + cRes.customer.LastName;
                        name          = name.Trim();
                        txtName.Text  = name;
                        txtEmail.Text = cRes.customer.Email;
                        if (cRes.customer.PhoneNumber != null && cRes.customer.PhoneNumber != "")
                        {
                            //if (cRes.customer.PhoneNumber.Length != 10)
                            //{
                            //Console.WriteLine(cRes.customer.PhoneNumber);
                            txtFirst3.Text = cRes.customer.PhoneNumber.Substring(0, 3);
                            //Console.WriteLine(cRes.customer.PhoneNumber.Substring(0, 3));
                            txtSecond3.Text = cRes.customer.PhoneNumber.Substring(3, 3);
                            //Console.WriteLine(cRes.customer.PhoneNumber.Substring(3, 3));
                            txtLast4.Text = cRes.customer.PhoneNumber.Substring(6);
                            //Console.WriteLine(cRes.customer.PhoneNumber.Substring(6));
                            //}
                        }
                        CardNumer.Text   = cRes.customer.CardNumber;
                        lblCardDate.Text = cRes.customer.ExpireDate.ToString("MM-dd-yyyy");
                        txtZipcode.Text  = cRes.customer.Zip;
                        string state = cRes.customer.State;
                        if (pickerDataModel.Items.Contains(state))
                        {
                            int i = pickerDataModel.Items.FindIndex(n => n == state);
                            stpicker.Select(i, 0, false);
                        }
                        int prefStore = cRes.customer.PreferredStore;
                        StorePicker.Select(prefStore, 0, false);
                        txtAddress.Text = cRes.customer.Address1 + cRes.customer.Address2 + cRes.customer.City;
                        txtZipcode.AccessibilityScroll(UIAccessibilityScrollDirection.Up);
                        btnChange.TouchUpInside += (sender, e) =>
                        {
                            try
                            {
                                UIAlertView alert = new UIAlertView()
                                {
                                    Title = "Please choose an option to upload profile picture",
                                    //Message = "Coming Soon..."
                                };
                                alert.AddButton("Cancel");
                                alert.AddButton("Camera");
                                alert.AddButton("Gallery");
                                alert.Clicked += (senderalert, buttonArgs) =>
                                {
                                    if (buttonArgs.ButtonIndex == 1)
                                    {
                                        try
                                        {
                                            IsCameraAuthorized();
                                            TweetStation.Camera.TakePicture(this, (obj) =>
                                            {
                                                var photo = obj.ValueForKey(new NSString("UIImagePickerControllerOriginalImage")) as UIImage;
                                                var meta  = obj.ValueForKey(new NSString("UIImagePickerControllerMediaMetadata")) as NSDictionary;
                                                UploadProfilePic(photo);
                                            });
                                        }
                                        catch (Exception exe)
                                        {
                                            LoggingClass.LogError(exe.Message, screenid, exe.StackTrace);
                                        }
                                    }
                                };
                                alert.Clicked += (senderalert, buttonArgs) =>
                                {
                                    if (buttonArgs.ButtonIndex == 2)
                                    {
                                        imagePicker                       = new UIImagePickerController();
                                        imagePicker.SourceType            = UIImagePickerControllerSourceType.PhotoLibrary;
                                        imagePicker.MediaTypes            = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.PhotoLibrary);
                                        imagePicker.FinishedPickingMedia += Handle_FinishedPickingMedia;
                                        imagePicker.Canceled             += Handle_Canceled;
                                        NavCtrl.PresentModalViewController(imagePicker, true);
                                    }
                                };
                                alert.Show();
                            }
                            catch (Exception exe)
                            {
                                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace);
                            }
                        };

                        btnUpdate.TouchUpInside += async delegate
                        {
                            string txtMobilenumber = txtFirst3.Text + txtSecond3.Text + txtLast4.Text;
                            if (txtMobilenumber.Length != 10)
                            {
                                BTProgressHUD.ShowErrorWithStatus("Phone number is invalid", 3000);
                            }
                            if ((txtEmail.Text.Contains("@")) == false || (txtEmail.Text.Contains(".")) == false)
                            {
                                BTProgressHUD.ShowErrorWithStatus("Email is invalid", 3000);
                            }
                            else if ((txtZipcode.Text.Length != 5))
                            {
                                BTProgressHUD.ShowErrorWithStatus("Zipcode is invalid", 3000);
                            }
                            else if (txtFirst3.Text.Length != 3 || txtSecond3.Text.Length != 3 || txtLast4.Text.Length != 4)
                            {
                                BTProgressHUD.ShowErrorWithStatus("Phone number is invalid", 3000);
                            }
                            else
                            {
                                BTProgressHUD.Show("Updating Profile...");
                                LoggingClass.LogInfo("Update button into Profile View", screenid);
                                Customer cust = new Customer();
                                cust.CustomerID = CurrentUser.RetreiveUserId();
                                cust.Address1   = txtAddress.Text;
                                name            = txtName.Text;
                                name            = name.Trim();
                                try
                                {
                                    string[] str1 = name.Split(' ');
                                    if (str1.Length == 2)
                                    {
                                        cust.FirstName = str1[0];
                                        cust.LastName  = str1[1];
                                    }
                                    else
                                    {
                                        cust.FirstName = str1[0] + str1[1];
                                        cust.LastName  = str1[2];
                                    }
                                }
                                catch (Exception exe)
                                {
                                    LoggingClass.LogError(exe.Message, screenid, exe.StackTrace);
                                }
                                cust.Email       = txtEmail.Text;
                                cust.PhoneNumber = txtMobilenumber;

                                if (pickerDataModel.SelectedItem == "AL")
                                {
                                    if (pickerDataModel.Items.Contains(cRes.customer.State))
                                    {
                                        int i = pickerDataModel.Items.FindIndex(n => n == cRes.customer.State);
                                        stpicker.Select(i, 0, false);
                                    }
                                    cust.State = cRes.customer.State;
                                }
                                else
                                {
                                    cust.State = pickerDataModel.SelectedItem;
                                }
                                cust.Zip = txtZipcode.Text;
                                if (StoreDataModel.SelectedItem == 0)
                                {
                                    cust.PreferredStore = cRes.customer.PreferredStore;
                                    StorePicker.Select(cRes.customer.PreferredStore, 0, false);
                                    CurrentUser.PutStore(cust.PreferredStore);
                                }
                                else
                                {
                                    cust.PreferredStore = StoreDataModel.SelectedItem;
                                    CurrentUser.PutStore(cust.PreferredStore);
                                }
                                await svc.UpdateCustomer(cust);

                                BTProgressHUD.ShowSuccessWithStatus("Profile Updated.");
                            }
                        };
                    }
                    else
                    {
                        UIAlertView alert = new UIAlertView()
                        {
                            Title   = "Sorry",
                            Message = "Something went wrong. We are on it"
                        };

                        alert.AddButton("OK");
                        alert.Show();
                    }
                }

                Scroll.AddGestureRecognizer(taps);
                Scroll.AddSubview(backgroud);
                Scroll.AddSubview(btnImageBack);
                Scroll.AddSubview(imgprofilepic);
                Scroll.AddSubview(btnChange);
                Scroll.AddSubview(lblName);
                Scroll.AddSubview(txtName);
                Scroll.AddSubview(lblEmail);
                Scroll.AddSubview(txtEmail);
                Scroll.AddSubview(lblMobile);
                Scroll.AddSubview(txtFirst3);
                Scroll.AddSubview(symIphon1);
                Scroll.AddSubview(txtSecond3);
                Scroll.AddSubview(symIphon2);
                Scroll.AddSubview(txtLast4);
                Scroll.AddSubview(lblState);
                //Scroll.AddSubview(stpicker);
                Scroll.AddSubview(lblAddress);
                Scroll.AddSubview(txtAddress);
                Scroll.AddSubview(lblZipcode);
                Scroll.AddSubview(txtZipcode);
                //Scroll.AddSubview(StorePicker);
                Scroll.AddSubview(lblMystore);
                Scroll.AddSubview(lblCardExpiry);
                Scroll.AddSubview(lblCardDate);
                Scroll.AddSubview(lblcardnumber);
                Scroll.AddSubview(CardNumer);
                Scroll.AddSubview(btnUpdate);

                //for (int i = 0; i<Scroll.Subviews.Length ; i++)
                //{
                //	nfloat n = Scroll.Subviews[i].Bounds.Height;// Frame.Size.Height;
                //	h = h + n;
                //}
                //Console.WriteLine(h+"\n"+ScreenHeight);
                h = y + 50;
                Scroll.ContentSize = new CGSize(UIScreen.MainScreen.Bounds.Width, h);
                View = (Scroll);
            }
            catch (Exception e)
            {
                UIAlertView alert = new UIAlertView()
                {
                    Title   = "Sorry",
                    Message = "Something went wrong. We are on it"
                };

                alert.AddButton("OK");
                alert.Show();
                LoggingClass.LogError(e.Message, screenid, e.StackTrace);
                //Console.WriteLine(e.Message + "\n" + e.StackTrace);
            }
        }
        public APLCollectionViewCell(CGRect frame) : base(frame)
        {
            try
            {
                //BTProgressHUD.Show("Please wait...");
                CGRect box = new CGRect(Bounds.Location, Bounds.Size);
                box.X           = 0;
                box.Y           = 0;
                box.Height      = box.Height - 140;
                BackgroundColor = UIColor.White;

                btnBack = new UIButton();
                btnBack.BackgroundColor        = UIColor.Black;
                btnBack.Frame                  = new CGRect(2, 2, Bounds.Width + 1, box.Height - 139);
                btnBack.UserInteractionEnabled = false;

                ImageView = new UIButton(box);
                ImageView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
                ImageView.ContentMode      = UIViewContentMode.ScaleAspectFill;
                //ImageView.Layer.BorderWidth = 3.0f;
                ImageView.ClipsToBounds              = true;
                ImageView.Layer.BorderColor          = UIColor.White.CGColor;
                ImageView.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;

                box.Y    = 3;
                btlImage = new UIButton(box);
                btlImage.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
                //btlImage.ContentMode = UIViewContentMode.ScaleAspectFill;
                btlImage.ClipsToBounds              = true;
                btlImage.Layer.BorderColor          = UIColor.White.CGColor;
                btlImage.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;

                //btlImage.TouchDown += (sender, e) =>
                //{
                //		BTProgressHUD.Show("Loading..."); //show spinner + text
                //};

                btlImage.TouchUpInside += (object sender, EventArgs e) =>
                {
                    BTProgressHUD.Show("Loading...");
                    //BTProgressHUD.Dismiss();
                    NavigationController.PushViewController(new DetailViewController(WineBarcode, storeId, false, false), false);
                    LoggingClass.LogInfo("Clicked on " + WineBarcode + " to enter into Details", screen);
                };

                box.Height = 25;
                box.Width  = 25;
                box.X      = (Bounds.Width - 30);
                box.Y      = 5;
                heartImage = new UIButton(box);
                heartImage.ClipsToBounds              = true;
                heartImage.Layer.BorderColor          = UIColor.White.CGColor;
                heartImage.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;
                heartImage.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                heartImage.Tag            = 0;
                heartImage.TouchUpInside += async(object sender, EventArgs e) =>
                {
                    //Do some actionn
                    if (CurrentUser.RetreiveUserId() != 0)
                    {
                        UIButton temp = (UIButton)sender;
                        if (temp.Tag == 0)
                        {
                            heartImage.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);
                            temp.Tag      = 1;
                            myItem.IsLike = true;
                            LoggingClass.LogInfo("Liked Wine " + WineBarcode, screen);
                        }
                        else
                        {
                            heartImage.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                            temp.Tag      = 0;
                            myItem.IsLike = false;
                            LoggingClass.LogInfo("Unliked Wine " + WineBarcode, screen);
                        }
                        //NavigationController.PushViewController(new DetailViewController(), false);
                        SKULike like = new SKULike();
                        like.UserID  = Convert.ToInt32(CurrentUser.RetreiveUserId());
                        like.BarCode = WineBarcode;
                        like.Liked   = Convert.ToBoolean(temp.Tag);
                        ServiceWrapper sw = new ServiceWrapper();
                        await sw.InsertUpdateLike(like);
                    }
                    else
                    {
                        UIAlertView alert = new UIAlertView()
                        {
                            Title = "This feature is allowed only for VIP Card holders",
                            //Message = "Coming Soon..."
                        };
                        alert.AddButton("OK");
                        alert.AddButton("Know more");
                        alert.Clicked += (senderalert, buttonArgs) =>
                        {
                            if (buttonArgs.ButtonIndex == 1)
                            {
                                UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html"));
                            }
                        };
                        //alert.AlertViewStyle = UIAlertViewStyle.PlainTextInput;

                        alert.Show();
                    }
                };

                //for buy button
                box.Height                        = 35;
                box.Width                         = 35;
                box.X                             = (Bounds.Width - 40);
                box.Y                             = 40;
                btnBuy                            = new UIButton(box);
                btnBuy.ClipsToBounds              = true;
                btnBuy.Layer.BorderColor          = UIColor.White.CGColor;
                btnBuy.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;
                btnBuy.SetImage(UIImage.FromFile("buy.png"), UIControlState.Normal);
                btnBuy.TouchUpInside += delegate {
                    NavigationController.PushViewController(new ExploreViewController("http://www.wineoutlet.com/sku" + Sku + ".html"), false);
                    //UIApplication.SharedApplication.OpenUrl(new NSUrl("http://www.wineoutlet.com/sku"+Sku+".html"));
                };

                CGRect lower = new CGRect(Bounds.Location, Bounds.Size);
                lower.Y     = 50;             //lower.Y + (ratio)*(Bounds.Height);
                btnItemname = new UIButton(lower);
                btnItemname.SetTitle("", UIControlState.Normal);
                btnItemname.SetTitleColor(UIColor.Purple, UIControlState.Normal);
                btnItemname.Font           = UIFont.FromName("Verdana-Bold", 13f);
                btnItemname.LineBreakMode  = UILineBreakMode.WordWrap;
                btnItemname.TouchUpInside += (object sender, EventArgs e) =>
                {
                    BTProgressHUD.Show("Loading...");
                    //BTProgressHUD.Dismiss();
                    NavigationController.PushViewController(new DetailViewController(WineBarcode, storeId, false, false), false);
                    LoggingClass.LogInfo("Clicked on " + WineBarcode + " to enter into Details", screen);
                };
                lblName               = new UILabel(lower);
                lblName.Font          = UIFont.FromName("Verdana-Bold", 13f);
                lblName.TextColor     = UIColor.Purple;
                lblName.Text          = WineName;
                lblName.TextAlignment = UITextAlignment.Center;
                lblName.LineBreakMode = UILineBreakMode.WordWrap;
                lblName.Lines         = 0;


                lower.Y      = 245;
                lower.Height = 1;
                lower.Width  = lower.Width - 20;
                lower.X      = lower.X + 10;

                Separator = new UIImageView(lower);
                Separator.AutoresizingMask  = UIViewAutoresizing.FlexibleWidth;
                Separator.Image             = UIImage.FromFile("separator.png");
                Separator.ContentMode       = UIViewContentMode.ScaleAspectFill;
                Separator.ClipsToBounds     = true;
                Separator.Layer.BorderColor = UIColor.White.CGColor;
                Separator.BackgroundColor   = UIColor.LightGray;

                CGRect year = new CGRect(Bounds.Location, Bounds.Size);
                year.Y                  = lower.Y - 15;
                year.X                  = year.Width / 2 - 25;
                year.Height             = 30;
                year.Width              = 50;
                lblYear                 = new UILabel(year);
                lblYear.Font            = UIFont.FromName("Verdana", 12f);
                lblYear.Text            = Vintage;
                lblYear.TextAlignment   = UITextAlignment.Center;
                lblYear.BackgroundColor = UIColor.White;


                lblRegPrice      = new UILabel(new CGRect(0, Bounds.Height - 60, Bounds.Width, 12f));
                lblRegPrice.Text = RegPrice;

                lblRegPrice.Font = UIFont.FromName("Verdana", 13f);

                lblRegPrice.TextAlignment = UITextAlignment.Center;

                var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/star-silver2.png"),
                                                    filledImage: UIImage.FromBundle("Stars/star.png"),
                                                    chosenImage: UIImage.FromBundle("Stars/star.png"));
                //decimal averageRating = 3.25m;

                ratingView = new PDRatingView(new CGRect(Bounds.Width * 1 / 4, Bounds.Height - 40, Bounds.Width / 2, 14f), ratingConfig, averageRating);
                ratingView.UserInteractionEnabled = false;
                //ratingView.BackgroundColor = UIColor.White;
                //Console.WriteLine(Sku);
                //if (Sku != null)
                //{
                //ContentView.AddSubview(btnBuy);
                //}

                AmountLeft = new UITextView(new CGRect(0, Bounds.Height - 30, Bounds.Width, 20));
                AmountLeft.TextAlignment = UITextAlignment.Center;
                AmountLeft.Editable      = false;
                //AmountLeft.ProgressTintColor = UIColor.Blue;
                //AmountLeft.SetProgress(1, true);
                //AmountLeft.Progress = 30f;
                //ContentView.AddSubview(btnBack);
                ContentView.AddSubview(ImageView);
                ContentView.InsertSubviewAbove(btlImage, ImageView);
                ContentView.AddSubview(AmountLeft);
                ContentView.AddSubview(heartImage);
                //ContentView.AddSubview(lblName);
                ContentView.AddSubview(btnItemname);
                ContentView.AddSubview(Separator);
                ContentView.AddSubview(lblYear);
                ContentView.AddSubview(lblRegPrice);
                ContentView.AddSubview(ratingView);
                ContentView.AddSubview(btnBuy);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
        }
Пример #19
0
		public async void EmailVerification(Boolean start)
		{
			try
			{
				DeviceToken Dt = new DeviceToken();
				if (CurrentUser.GetId() != null)
				{
					Dt = await svc.VerifyMail(CurrentUser.GetId());
					try
					{
						if (cr.customer == null)
						{
							cr = await svc.GetCustomerDetails(Convert.ToInt32(CurrentUser.GetId()));
						}
					}
					catch (Exception exe)
					{
						//LoggingClass.LogError(exe.Message, screenid, exe.StackTrace);
					}
				}
				if (Dt.VerificationStatus == 1)
				{
					CurrentUser.Store(cr.customer.CustomerID.ToString(), cr.customer.FirstName + cr.customer.LastName);
					CurrentUser.PutStore(cr.customer.PreferredStore);
					if (RootTabs == null || _window == null)
					{
						RootTabs = CurrentUser.RootTabs;
						_window = CurrentUser.window;
						nav = new UINavigationController(RootTabs);
						AddNavigationButtons(nav);
						_window.RootViewController = nav;
						LoggingClass.LogInfo("The User logged in with user id: " + CurrentUser.RetreiveUserId(), screenid);
					}
					else
					{
						nav = new UINavigationController(RootTabs);
						AddNavigationButtons(nav);
						_window.RootViewController = nav;
						LoggingClass.LogInfo("The User logged in with user id: " + CurrentUser.RetreiveUserId(), screenid);
					}
					BTProgressHUD.Dismiss();
				}
				else
				{
					if (start == false)
					{
						try
						{
							BTProgressHUD.ShowErrorWithStatus("Your email is not verified plesase check email and verify.", 5000);
							View.AddSubview(btnResend);
						}
						catch (Exception ex)
						{
							//LoggingClass.LogError(ex.Message, screenid, ex.StackTrace);
						}
					}
				}
			}
			catch (Exception Exe)
			{
					//UIAlertView alert = new UIAlertView()
					//{
					//Title = Exe.Message+"\n"+Exe.StackTrace,
					//	//Message = "Coming Soon..."
					//};

					//alert.AddButton("OK");
					//alert.Show();
				LoggingClass.LogError(Exe.Message, screenid, Exe.StackTrace);
			}
		}
        public override void ViewDidLoad()
        {
            try
            {
                //this.NavCtrl.NavigationBar.BarStyle = UIBarStyle.BlackTranslucent;
                //UINavigationBar.Appearance.BackgroundColor = UIColor.Clear;
                //NavCtrl.NavigationBar.BackgroundColor = UIColor.Clear;
                nfloat ScreenHeight = UIScreen.MainScreen.Bounds.Height;
                ScreenHeight = (ScreenHeight - 100) / 3;
                Boolean internetStatus = Reachability.IsHostReachable("https://www.google.com");
                if (internetStatus == false)
                {
                    UIAlertView alert = new UIAlertView()
                    {
                        Title   = "Sorry",
                        Message = "Not connected to internet.Please connect and retry."
                    };

                    alert.AddButton("OK");
                    alert.Show();
                }
                BTProgressHUD.Dismiss();
                UIImageView backgroud = new UIImageView();
                backgroud.Frame = new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width, ScreenHeight - 20);
                backgroud.Image = new UIImage("proback.png");
                backgroud.UserInteractionEnabled = false;
                btnBack.UserInteractionEnabled   = false;
                //imgProfile.Frame = new CGRect((View.Frame.Width / 2) - 72, 3 * (backgroud.Frame.Height / 3), 144, 152);
                //UITapGestureRecognizer singleTap = new UITapGestureRecognizer();
                //singleTap.CancelsTouchesInView = false;
                //Scroll.AddGestureRecognizer(singleTap);
                //DismissKeyboardOnBackgroundTap();
                NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.WillHideNotification, KeyBoardDownNotification);
                NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidShowNotification, KeyBoardUpNotification);
                LoggingClass.LogInfo("Entered into Profile View", screenid);
                pickerDataModel = new StatePickerDataModel();
                pickerDataModel.Items.Add("---Select your state---");
                pickerDataModel.Items.Add("AL");
                pickerDataModel.Items.Add("AK");
                pickerDataModel.Items.Add("AZ");
                pickerDataModel.Items.Add("AR");
                pickerDataModel.Items.Add("CA");
                pickerDataModel.Items.Add("CO");
                pickerDataModel.Items.Add("CT");
                pickerDataModel.Items.Add("DE");
                pickerDataModel.Items.Add("FL");
                pickerDataModel.Items.Add("GA");
                pickerDataModel.Items.Add("HI");
                pickerDataModel.Items.Add("ID");
                pickerDataModel.Items.Add("IL");
                pickerDataModel.Items.Add("IN");
                pickerDataModel.Items.Add("IA");
                pickerDataModel.Items.Add("KS");
                pickerDataModel.Items.Add("KY");
                pickerDataModel.Items.Add("LA");
                pickerDataModel.Items.Add("ME");
                pickerDataModel.Items.Add("MD");
                pickerDataModel.Items.Add("MA");
                pickerDataModel.Items.Add("MI");
                pickerDataModel.Items.Add("MN");
                pickerDataModel.Items.Add("MS");
                pickerDataModel.Items.Add("MO");
                pickerDataModel.Items.Add("MT");
                pickerDataModel.Items.Add("NE");
                pickerDataModel.Items.Add("NV");
                pickerDataModel.Items.Add("NH");
                pickerDataModel.Items.Add("NJ");
                pickerDataModel.Items.Add("NM");
                pickerDataModel.Items.Add("NY");
                pickerDataModel.Items.Add("NC");
                pickerDataModel.Items.Add("ND");
                pickerDataModel.Items.Add("OH");
                pickerDataModel.Items.Add("OK");
                pickerDataModel.Items.Add("OR");
                pickerDataModel.Items.Add("PA");
                pickerDataModel.Items.Add("RI");
                pickerDataModel.Items.Add("SC");
                pickerDataModel.Items.Add("SD");
                pickerDataModel.Items.Add("TN");
                pickerDataModel.Items.Add("TX");
                pickerDataModel.Items.Add("UT");
                pickerDataModel.Items.Add("VT");
                pickerDataModel.Items.Add("VA");
                pickerDataModel.Items.Add("WA");
                pickerDataModel.Items.Add("WV");
                pickerDataModel.Items.Add("WI");
                pickerDataModel.Items.Add("WY");

                statePicker.Model = pickerDataModel;
                //statePicker.BackgroundColor = UIColor.Red;
                //statePicker = new UIPickerView(new CGRect(01,01,UIScreen.MainScreen.Bounds.Width,UIScreen.MainScreen.Bounds.Height));
                //	//UIScreen.MainScreen.Bounds.X-UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height, UIScreen.MainScreen.Bounds.Width, 180));
                StoreDataModel = new StorePickerDataModel();
                StoreDataModel.Items.Add("---Select preffered store---");
                StoreDataModel.Items.Add("Wall");
                StoreDataModel.Items.Add("Pt. Pleasant Beach");
                StoreDataModel.Items.Add("All");
                storePicker.Model = StoreDataModel;
                //statePicker.Select(5, 0, true);
                //LoggingClass.UploadErrorLogs();
                if (CurrentUser.RetreiveUserId() == 0)
                {
                    DownloadAsync();
                    UIAlertView alert = new UIAlertView()
                    {
                        Title = "This feature is allowed only for VIP Card holders",
                        //Message = "Coming Soon..."
                    };

                    alert.AddButton("OK");
                    alert.AddButton("Log in");
                    alert.AddButton("Know more");
                    alert.Clicked += (senderalert, buttonArgs) =>
                    {
                        if (buttonArgs.ButtonIndex == 1)
                        {
                            CurrentUser.Clear();
                            LoginViewController yourController = new LoginViewController();
                            yourController.nav      = NavCtrl;
                            yourController.RootTabs = CurrentUser.RootTabs;
                            NavCtrl.PushViewController(yourController, false);
                            //NavCtrl.PopViewController(false);
                            //NavCtrl.PopViewController(false);
                        }
                    };
                    alert.Clicked += (senderalert, buttonArgs) =>
                    {
                        if (buttonArgs.ButtonIndex == 2)
                        {
                            UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html"));
                        }
                    };
                    alert.Show();
                    btnUpdate.UserInteractionEnabled   = false;
                    txtLastName.UserInteractionEnabled = false;
                    txtPhone.UserInteractionEnabled    = false;
                    txtAddress.UserInteractionEnabled  = false;
                    txtZipCode.UserInteractionEnabled  = false;
                    txtEmail.UserInteractionEnabled    = false;
                    statePicker.UserInteractionEnabled = false;
                    storePicker.UserInteractionEnabled = false;
                    imgProfile.UserInteractionEnabled  = false;
                    btnPicEdit.UserInteractionEnabled  = false;
                }
                else
                {
                    DownloadAsync();
                    cRes = svc.GetCustomerDetails(CurrentUser.RetreiveUserId()).Result;
                    //txtFirstName.Text = cRes.customer.FirstName;
                    name             = cRes.customer.FirstName + " " + cRes.customer.LastName;
                    name             = name.Trim();
                    txtLastName.Text = name;                    //cRes.customer.FirstName+" "+cRes.customer.LastName;
                    //txtCity.Text = cRes.customer.City;
                    txtEmail.Text = cRes.customer.Email;
                    if (cRes.customer.PhoneNumber.Length != 10)
                    {
                        //cRes.customer.PhoneNumber
                        txtPhone.Text = cRes.customer.PhoneNumber;
                    }
                    txtCardnumber.Text = cRes.customer.CardNumber;
                    txtExpirydate.Text = cRes.customer.ExpireDate.ToString("MM-dd-yyyy");
                    txtZipCode.Text    = cRes.customer.Zip;
                    string state = cRes.customer.State;
                    if (pickerDataModel.Items.Contains(state))
                    {
                        int i = pickerDataModel.Items.FindIndex(x => x == state);
                        statePicker.Select(i, 0, false);
                    }
                    int prefStore = cRes.customer.PreferredStore;
                    storePicker.Select(prefStore, 0, false);
                    txtAddress.Text = cRes.customer.Address1 + cRes.customer.Address2 + cRes.customer.City;
                    //txtFirstName.ShouldReturn += (TextField) =>
                    // {
                    //  ((UITextField)TextField).ResignFirstResponder();
                    //  return true;
                    // };
                    txtLastName.ShouldReturn += (TextField) =>
                    {
                        ((UITextField)TextField).ResignFirstResponder();
                        return(true);
                    };
                    txtEmail.ShouldReturn += (TextField) =>
                    {
                        ((UITextField)TextField).ResignFirstResponder();
                        return(true);
                    };
                    txtPhone.ShouldReturn += (TextField) =>
                    {
                        ((UITextField)TextField).ResignFirstResponder();
                        return(true);
                    };
                    txtAddress.ShouldReturn += (TextField) =>
                    {
                        ((UITextField)TextField).ResignFirstResponder();
                        return(true);
                    };
                    txtZipCode.ShouldReturn += (TextField) =>
                    {
                        ((UITextField)TextField).ResignFirstResponder();
                        return(true);
                    };
                    txtZipCode.AccessibilityScroll(UIAccessibilityScrollDirection.Up);
                    btnUpdate.SetTitleColor(UIColor.Purple, UIControlState.Normal);
                    //btnEdit.SetTitleColor(UIColor.Purple, UIControlState.Normal);
                    //btnUpdate.TouchDown += (sender, e) =>
                    //{
                    //	BTProgressHUD.Show("Updating profile..."); //show spinner + text
                    //};
                    //btnUpdate.TouchUpInside += async (sender, e) =>
                    //{
                    //	if (txtPhone.Text.Length > 10 || txtPhone.Text.Length < 10)
                    //	{
                    //		BTProgressHUD.ShowErrorWithStatus("Phone number is invalid");
                    //	}
                    //	else if ((txtEmail.Text.Contains("@")) == false || (txtEmail.Text.Contains(".")) == false)
                    //	{
                    //		BTProgressHUD.ShowErrorWithStatus("Email is invalid");
                    //	}
                    //	else if ((txtZipCode.Text.Length!=5))
                    //	{
                    //		BTProgressHUD.ShowErrorWithStatus("Zipcode is invalid");
                    //	}
                    //	else
                    //	{
                    //		LoggingClass.LogInfo("Update button into Profile View", screenid);
                    //		Customer cust = new Customer();
                    //		cust.CustomerID = CurrentUser.RetreiveUserId();
                    //		cust.Address1 = txtAddress.Text;
                    //		name = txtLastName.Text;
                    //	name = name.Trim();
                    //	try
                    //	{
                    //		string[] str1 = name.Split(' ');
                    //		if (str1.Length == 2)
                    //		{
                    //			cust.FirstName = str1[0];
                    //			cust.LastName = str1[1];
                    //		}
                    //		else
                    //		{
                    //			cust.FirstName = str1[0] + str1[1];
                    //			cust.LastName = str1[2];
                    //		}
                    //	}
                    //	catch (Exception exe)
                    //	{
                    //		LoggingClass.LogError(exe.Message, screenid, exe.StackTrace);
                    //	}
                    //		cust.Email = txtEmail.Text;
                    //		cust.PhoneNumber = txtPhone.Text;
                    //		cust.State = pickerDataModel.SelectedItem;
                    //		cust.Zip = txtZipCode.Text;
                    //		cust.PreferredStore = StoreDataModel.SelectedItem;
                    //		CurrentUser.PutStore(StoreDataModel.SelectedItem);
                    //		await svc.UpdateCustomer(cust);
                    //		BTProgressHUD.ShowSuccessWithStatus("Profile Updated.");
                    //		//try
                    //		//{
                    //		//	NavCtrl.PopViewController(true);
                    //		//	//NavCtrl.PushViewController(new FirstViewController(handle), false);
                    //		//}
                    //		//catch (Exception exe)
                    //		//{
                    //		//	LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
                    //		//}
                    //	}
                    //};
                    btnUpdate.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
                    UIImage imgbtnCam = UIImage.FromFile("cam.png");
                    imgbtnCam = ResizeImage(imgbtnCam, 25, 25);
                    btnPicEdit.SetImage(imgbtnCam, UIControlState.Normal);
                    btnBack.UserInteractionEnabled = false;
                    //btnPicEdit.SetTitle("Edit", UIControlState.Normal);
                    //try
                    //{
                    btnPicEdit.TouchUpInside += (sender, e) =>
                    {
                        try
                        {
                            UIAlertView alert = new UIAlertView()
                            {
                                Title = "Please choose an option to upload profile picture",
                                //Message = "Coming Soon..."
                            };
                            alert.AddButton("Cancel");
                            alert.AddButton("Camera");
                            alert.AddButton("Gallery");
                            alert.Clicked += (senderalert, buttonArgs) =>
                            {
                                if (buttonArgs.ButtonIndex == 1)
                                {
                                    try
                                    {
                                        IsCameraAuthorized();
                                        TweetStation.Camera.TakePicture(this, (obj) =>
                                        {
                                            var photo = obj.ValueForKey(new NSString("UIImagePickerControllerOriginalImage")) as UIImage;
                                            var meta  = obj.ValueForKey(new NSString("UIImagePickerControllerMediaMetadata")) as NSDictionary;
                                            UploadProfilePic(photo);
                                            //ALAssetsLibrary library = new ALAssetsLibrary();
                                            //library.WriteImageToSavedPhotosAlbum(photo.CGImage, meta, (assetUrl, error) =>
                                            //{
                                            //	UploadProfilePic(assetUrl.ToString());
                                            //	Console.WriteLine("assetUrl:" + assetUrl);
                                            //});
                                            //var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                                        });
                                    }
                                    catch (Exception exe)
                                    {
                                        LoggingClass.LogError(exe.Message, screenid, exe.StackTrace);
                                    }
                                }
                            };
                            alert.Clicked += (senderalert, buttonArgs) =>
                            {
                                if (buttonArgs.ButtonIndex == 2)
                                {
                                    imagePicker                       = new UIImagePickerController();
                                    imagePicker.SourceType            = UIImagePickerControllerSourceType.PhotoLibrary;
                                    imagePicker.MediaTypes            = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.PhotoLibrary);
                                    imagePicker.FinishedPickingMedia += Handle_FinishedPickingMedia;
                                    imagePicker.Canceled             += Handle_Canceled;
                                    NavCtrl.PresentModalViewController(imagePicker, true);
                                }
                            };
                            alert.Show();
                            //imagePicker = new UIImagePickerController();
                            //imagePicker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary;
                            //imagePicker.MediaTypes = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.PhotoLibrary);
                            //imagePicker.FinishedPickingMedia += Handle_FinishedPickingMedia;
                            //imagePicker.Canceled += Handle_Canceled;
                            //NavCtrl.PresentModalViewController(imagePicker, true);
                        }
                        catch (Exception exe)
                        {
                            LoggingClass.LogError(exe.Message, screenid, exe.StackTrace);
                        }
                    };
                }
                //imgEmail.Image = new UIImage("mail.png");
                //imgAddr.Image = new UIImage("add.png");
                //imgPhone.Image = new UIImage("phone1.png");
                Scroll = new UIScrollView
                {
                    Frame            = new CGRect(0, 0, View.Frame.Width, View.Frame.Height),
                    ContentSize      = new CGSize(View.Frame.Width, View.Frame.Height),
                    BackgroundColor  = UIColor.White,
                    AutoresizingMask = UIViewAutoresizing.FlexibleHeight,
                };

                UIToolbar toolbar = new UIToolbar(new RectangleF(0.0f, 0.0f, Convert.ToSingle(this.View.Frame.Size.Width), 44.0f));
                toolbar.TintColor   = UIColor.White;
                toolbar.BarStyle    = UIBarStyle.Default;
                toolbar.Translucent = true;
                UITapGestureRecognizer taps = new UITapGestureRecognizer();
                taps.CancelsTouchesInView = false;
                taps.AddTarget(() => Scroll.EndEditing(true));
                Scroll.AddGestureRecognizer(taps);
                UIImage imgbtnUpdate = UIImage.FromFile("tick.png");
                imgbtnUpdate = ResizeImage(imgbtnUpdate, 25, 25);
                //var topBtn = new UIBarButtonItem(imgbtnUpdate, UIBarButtonItemStyle.Plain, async delegate
                //{
                btnUpdate.TouchUpInside += async delegate
                {
                    //if (txtPhone.Text.Length!=12)
                    //{
                    //	BTProgressHUD.ShowErrorWithStatus("Phone number is invalid");
                    //}
                    if ((txtEmail.Text.Contains("@")) == false || (txtEmail.Text.Contains(".")) == false)
                    {
                        BTProgressHUD.ShowErrorWithStatus("Email is invalid");
                    }
                    else if ((txtZipCode.Text.Length != 5))
                    {
                        BTProgressHUD.ShowErrorWithStatus("Zipcode is invalid");
                    }
                    else
                    {
                        BTProgressHUD.Show("Updating Profile...");
                        LoggingClass.LogInfo("Update button into Profile View", screenid);
                        Customer cust = new Customer();
                        cust.CustomerID = CurrentUser.RetreiveUserId();
                        cust.Address1   = txtAddress.Text;
                        //cust.FirstName = txtFirstName.Text;
                        name = txtLastName.Text;
                        name = name.Trim();
                        try
                        {
                            string[] str1 = name.Split(' ');
                            if (str1.Length == 2)
                            {
                                cust.FirstName = str1[0];
                                cust.LastName  = str1[1];
                            }
                            else
                            {
                                cust.FirstName = str1[0] + str1[1];
                                cust.LastName  = str1[2];
                            }
                        }
                        catch (Exception exe)
                        {
                            LoggingClass.LogError(exe.Message, screenid, exe.StackTrace);
                        }
                        cust.Email       = txtEmail.Text;
                        cust.PhoneNumber = txtPhone.Text;

                        if (pickerDataModel.SelectedItem == "---Select your state---")
                        {
                            if (pickerDataModel.Items.Contains(cRes.customer.State))
                            {
                                int i = pickerDataModel.Items.FindIndex(x => x == cRes.customer.State);
                                statePicker.Select(i, 0, false);
                            }
                            cust.State = cRes.customer.State;
                        }
                        else
                        {
                            cust.State = pickerDataModel.SelectedItem;
                        }
                        cust.Zip = txtZipCode.Text;
                        if (StoreDataModel.SelectedItem == 0)
                        {
                            cust.PreferredStore = cRes.customer.PreferredStore;
                            storePicker.Select(cRes.customer.PreferredStore, 0, false);
                            CurrentUser.PutStore(cust.PreferredStore);
                        }
                        else
                        {
                            cust.PreferredStore = StoreDataModel.SelectedItem;
                            CurrentUser.PutStore(cust.PreferredStore);
                        }
                        await svc.UpdateCustomer(cust);

                        BTProgressHUD.ShowSuccessWithStatus("Profile Updated.");
                    }
                };
                imgProfile.ClipsToBounds   = true;
                imgProfile.BackgroundColor = UIColor.White;
                //NavigationController.NavigationBar.TopItem.SetRightBarButtonItem(topBtn, true);
                btnBack.BackgroundColor = UIColor.FromRGB(93, 93, 93);
                Scroll.AddSubview(backgroud);
                Scroll.AddSubview(btnBack);
                //Scroll.AddSubview(imgAddr);
                //Scroll.AddSubview(imgPhone);
                //Scroll.AddSubview(imgEmail);
                Scroll.AddSubview(txtEmail);
                Scroll.AddSubview(statePicker);
                Scroll.AddSubview(storePicker);
                Scroll.AddSubview(txtPhone);
                Scroll.AddSubview(txtZipCode);
                //Scroll.AddSubview(txtFirstName);
                Scroll.AddSubview(txtLastName);
                Scroll.AddSubview(txtAddress);
                Scroll.AddSubview(imgProfile);
                Scroll.AddSubview(btnPicEdit);
                Scroll.AddSubview(lblEmail);
                Scroll.AddSubview(lblState);
                Scroll.AddSubview(lblMobile);
                Scroll.AddSubview(lblAddress);
                Scroll.AddSubview(lblZipcode);
                //Scroll.AddSubview(lblFirstname);
                Scroll.AddSubview(lblLastname);
                Scroll.AddSubview(btnUpdate);
                Scroll.AddSubview(lblStorePi);
                Scroll.AddSubview(lblExpiryDate);
                Scroll.AddSubview(txtExpirydate);
                Scroll.AddSubview(lblcardnumber);
                Scroll.AddSubview(txtCardnumber);

                //View.AddSubview(Scroll);

                for (int i = 0; i < Scroll.Subviews.Length; i++)
                {
                    nfloat n = Scroll.Subviews[i].Frame.Size.Height;
                    h = h + n;
                }
                //Console.WriteLine(h);
                Scroll.ContentSize = new CGSize(UIScreen.MainScreen.Bounds.Width, h - 200);
                View = (Scroll);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screenid, ex.StackTrace);
            }
        }
        public async void DownloadAsync()
        {
            //Boolean internetStatus = Reachability.IsHostReachable("https://www.google.com");
            NSData HighImgData = null;

            //UIImage HighresImg = null;
            try
            {
                imgProfile.Image = new UIImage("Images/loadin.png");
            }
            catch (Exception ex)
            {
                //Console.WriteLine(ex.StackTrace);
                LoggingClass.LogError(ex.Message, screenid, ex.StackTrace.ToString());
            }
            WebClient webClient = new WebClient();
            //string url = "http://www.my-hd-wallpapers.com/wall/1405244488_moutain-reflect-on-a-lake_800.jpg";
            string url = "https://icsintegration.blob.core.windows.net/profileimages/" + CurrentUser.RetreiveUserId() + ".jpg";

            byte[] imageBytes = null;
            try
            {
                imageBytes = await webClient.DownloadDataTaskAsync(url);

                HighImgData = NSData.FromStream(new MemoryStream(imageBytes));
            }
            catch (TaskCanceledException)
            {
                //this.progressLayout.Visibility = ViewStates.Gone;
                return;
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString());
            }

            //HighresImg  =UIImage.LoadFromData(HighImgData);
            try
            {
                if (HighImgData != null)
                {
                    imgProfile.Image = UIImage.LoadFromData(HighImgData);
                }
                else
                {
                    imgProfile.Image = new UIImage("user1.png");
                }
            }
            catch (Exception Ex)
            {
                LoggingClass.LogError(Ex.Message, screenid, Ex.StackTrace.ToString());
            }
        }
Пример #22
0
        public override void ViewDidLoad()
        {
            try
            {
                int userId = Convert.ToInt32(CurrentUser.RetreiveUserId());

                if (userId == 0)
                {
                    UIAlertView alert = new UIAlertView()
                    {
                        Title = "This feature is allowed only for VIP Card holders",
                        //Message = "Coming Soon..."
                    };
                    alert.AddButton("OK");
                    alert.AddButton("Know more");
                    alert.Clicked += (senderalert, buttonArgs) =>
                    {
                        if (buttonArgs.ButtonIndex == 1)
                        {
                            UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html"));
                        }
                    };
                    alert.Show();
                }
                else
                {
                    var tastingData = sw.GetMyTastingsList(userId).Result;
                    if (tastingData.TastingList.Count == 0)
                    {
                        UILabel lblNoTastings = new UILabel();
                        lblNoTastings.Text          = tastingData.ErrorDescription;
                        lblNoTastings.TextAlignment = UITextAlignment.Center;
                        lblNoTastings.LineBreakMode = UILineBreakMode.WordWrap;
                        lblNoTastings.Lines         = 0;
                        CGSize sTemp = new CGSize(View.Frame.Width, 100);
                        sTemp = lblNoTastings.SizeThatFits(sTemp);
                        lblNoTastings.Frame      = new CGRect(0, 50, View.Bounds.Width, sTemp.Height);
                        TableView.SeparatorColor = UIColor.Clear;
                        View.AddSubview(lblNoTastings);
                        UIButton btnrefresh = new UIButton();
                        btnrefresh.Frame = new CGRect(0, 90, 50, 50);
                        btnrefresh.SetTitle("Swipe down to refresh", UIControlState.Normal);
                        btnrefresh.TouchUpInside += delegate {
                            RefreshParent();
                        };
                        View.AddSubview(btnrefresh);
                    }
                    //UIAlertView alert = new UIAlertView()
                    //{
                    //	Title = "Please swipe down to get your new tastings.",
                    //	//Message = "Coming Soon..."
                    //};
                    //alert.AddButton("OK");
                    //alert.Show();
                    this.View.Add(refreshControl);
                    refreshControl.ValueChanged += delegate {
                        RefreshParent();
                    };
                    TableView.AllowsSelection = false;
                    TableView.Source          = new MyTastingTableSource(tastingData.TastingList.ToList(), NavigationController, this);
                    //BTProgressHUD.Dismiss();
                }
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.Message, screen, ex.StackTrace);
                Console.WriteLine(ex.Message);
            }
        }
Пример #23
0
        public UIView GetViewForSKUCell(nint index)
        {
            UIView vw = new UIView();

            //UIImage image = new UIImage();
            try
            {
                var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/empty.png"),
                                                    filledImage: UIImage.FromBundle("Stars/star.png"),
                                                    chosenImage: UIImage.FromBundle("Stars/star.png"));

                switch (index)
                {
                case 1:
                    var lblName = new UILabel();
                    lblName.Frame         = new CGRect(0, 0, this.Width, 40);
                    lblName.Text          = data.Name;
                    lblName.Font          = UIFont.FromName("Verdana-Bold", 16f);
                    lblName.TextAlignment = UITextAlignment.Center;
                    lblName.TextColor     = UIColor.Purple;
                    vw = lblName;
                    break;

                case 2:
                    //vw = Separator;
                    break;

                case 3:
                    var lblVintage = new UILabel();
                    lblVintage.Frame = new CGRect(0, 0, this.Width, 20);
                    double l = Math.Floor(Math.Log10(data.Vintage) + 1);
                    if (l > 4)
                    {
                        lblVintage.Text = "";
                    }
                    else
                    {
                        lblVintage.Text = data.Vintage.ToString();
                    }
                    lblVintage.Font            = UIFont.FromName("Verdana", 12f);
                    lblVintage.TextAlignment   = UITextAlignment.Center;
                    lblVintage.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile("line123.png"));
                    vw = lblVintage;
                    //vw.AddSubview(Separator);
                    break;

                case 4:
                    var btlBack = new UIImageView();
                    btlBack.Frame = new CGRect(0, 10, this.Width, this.Width);
                    btlBack.Image = UIImage.FromFile("Wines/bottle.jpg");
                    btlImage      = new UIImageView();

                    //UIImage image = BlobWrapper.GetImageBitmapFromWineId(data.WineId.ToString(),_store.ToString());
                    UIImage image = new UIImage("Images/loadin.png");


                    if (image != null)
                    {
                        CGRect rect      = btlBack.Bounds;
                        nfloat boxHeight = rect.Height;                                 // which is = width;
                        nfloat imgHeight = image.Size.Height;
                        nfloat ratio     = boxHeight / imgHeight;
                        CGSize newSize   = new CGSize(image.Size.Width * ratio, image.Size.Height * ratio);
                        image = image.Scale(newSize);
                        nfloat X = (boxHeight - image.Size.Width) / 2;
                        btlImage.Frame = new CGRect(X, 0, image.Size.Width, image.Size.Height);
                        nfloat wid = this.Width;
                        nfloat hei = this.Width;
                        btlImage.Image = image;
                        DownloadAsync(data.Barcode, _store, btlImage, boxHeight);
                    }
                    else
                    {
                        btlImage.Image = new UIImage("Wines/bottle.jpg");
                    }
                    vw = btlImage;

                    break;

                case 5:
                    ratingView = new PDRatingView(new CGRect(this.Width * 3 / 8 + 2, 10, this.Width / 4, 20f), ratingConfig, data.AverageRating);
                    ratingView.UserInteractionEnabled = false;
                    vw = ratingView;
                    break;

                case 6:
                    var lblRateTitle = new UILabel();
                    lblRateTitle.Frame         = new CGRect(4, 10, this.Width, 50);
                    lblRateTitle.Text          = "Rate this Wine";
                    lblRateTitle.TextAlignment = UITextAlignment.Center;
                    lblRateTitle.Font          = UIFont.FromName("Verdana-Bold", 16f);
                    lblRateTitle.TextColor     = UIColor.Purple;
                    vw = lblRateTitle;
                    break;

                case 7:
                    var lblRateRequest = new UILabel();
                    lblRateRequest.Frame         = new CGRect(4, 0, this.Width, 10);
                    lblRateRequest.Text          = "Select number of Stars";
                    lblRateRequest.Font          = UIFont.FromName("AmericanTypewriter", 10f);
                    lblRateRequest.TextAlignment = UITextAlignment.Center;
                    vw = lblRateRequest;
                    break;

                case 8:
                    var starUpLine = new UIImageView(new CGRect(4, 0, this.Width - 8, 1));
                    starUpLine.AutoresizingMask  = UIViewAutoresizing.FlexibleWidth;
                    starUpLine.Image             = UIImage.FromFile("separator.png");
                    starUpLine.ContentMode       = UIViewContentMode.ScaleAspectFill;
                    starUpLine.ClipsToBounds     = true;
                    starUpLine.Layer.BorderColor = UIColor.White.CGColor;
                    starUpLine.BackgroundColor   = UIColor.LightGray;
                    vw = starUpLine;
                    break;

                case 9:
                    PDRatingView ratingView2 = new PDRatingView(new CGRect(this.Width * 2 / 8, 0, this.Width / 2, 36f), ratingConfig, 0m);
                    // [Optional] Do something when the user selects a rating.
                    UIViewController that = Parent;

                    ratingView2.RatingChosen += (sender, e) =>
                    {
                        if (CurrentUser.RetreiveUserId() == 0)
                        {
                            UIAlertView alert = new UIAlertView()
                            {
                                Title = "This feature is allowed only for VIP Card holders",
                                //Message = "Coming Soon..."
                            };
                            //LoggingClass.LogInfo("Clicked on seacuces", screenid);
                            alert.AddButton("OK");
                            alert.AddButton("Know more");
                            alert.Clicked += (senderalert, buttonArgs) =>
                            {
                                if (buttonArgs.ButtonIndex == 1)
                                {
                                    UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html"));
                                }
                            };
                            alert.Show();
                            ratingView2.ChosenRating = 0;
                        }
                        else
                        {
                            LoggingClass.LogInfo("Clicked on stars to give rating on " + data.Barcode, screenid);
                            PopupView yourController = new PopupView(data.Barcode, _store);
                            yourController.NavController          = NavigationController;
                            yourController.parent                 = that;
                            yourController.StartsSelected         = e.Rating;
                            yourController.ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext;
                            that.PresentModalViewController(yourController, false);
                        }
                        //ShowModal(false);
                    };
                    vw = ratingView2;
                    break;

                case 10:
                    var starDownLine = new UIImageView(new CGRect(4, 10, this.Width - 8, 1));
                    starDownLine.AutoresizingMask  = UIViewAutoresizing.FlexibleWidth;
                    starDownLine.Image             = UIImage.FromFile("separator.png");
                    starDownLine.ContentMode       = UIViewContentMode.ScaleAspectFill;
                    starDownLine.ClipsToBounds     = true;
                    starDownLine.Layer.BorderColor = UIColor.White.CGColor;
                    starDownLine.BackgroundColor   = UIColor.LightGray;
                    vw = starDownLine;
                    break;

                case 11:
                    var lblDesc = new UILabel();
                    lblDesc.Frame         = new CGRect(4, 10, this.Width, 20);
                    lblDesc.Text          = "Description: ";
                    lblDesc.TextAlignment = UITextAlignment.Left;
                    vw = lblDesc;
                    break;

                case 12:
                    var lblDescText = new UITextView();
                    lblDescText.Editable = false;
                    if (data.Description == null || data.Description == "")
                    {
                        lblDescText.Text = "Not available";
                    }
                    else
                    {
                        lblDescText.Text = data.Description;
                    }
                    lblDescText.TextAlignment = UITextAlignment.Justified;
                    //lblDescText.BackgroundColor = UIColor.LightGray;
                    CGSize sTemp = new CGSize(this.Width, 100);
                    sTemp             = lblDescText.SizeThatFits(sTemp);
                    lblDescText.Frame = new CGRect(0, 0, this.Width, sTemp.Height);
                    vw = lblDescText;
                    break;

                case 13:
                    table = new UITableView();
                    //string[,] tableItems
                    table.Frame           = new CGRect(0, 0, this.Width, data.WineProperties.Count * 22);
                    table.Source          = new WineInfoTableSource(data.WineProperties);
                    table.AllowsSelection = false;
                    table.ScrollEnabled   = false;
                    vw = table;
                    break;

                case 14:
                    var lblProducer = new UILabel();
                    lblProducer.Frame         = new CGRect(4, 10, this.Width, 20);
                    lblProducer.Text          = "Producer: ";
                    lblProducer.TextAlignment = UITextAlignment.Left;
                    vw = lblProducer;
                    break;

                case 15:
                    var lblProducerText = new UITextView();
                    lblProducerText.Editable = false;
                    //lblProducerText.Frame = new CGRect(0, 0, this.Width, 100);
                    if (data.Producer == null || data.Producer == "")
                    {
                        lblProducerText.Text = "Not available";
                    }
                    else
                    {
                        lblProducerText.Text = data.Producer;
                    }
                    lblProducerText.TextAlignment = UITextAlignment.Justified;
                    //lblProducerText.BackgroundColor = UIColor.LightGray;
                    sTemp = new CGSize(this.Width, 100);
                    sTemp = lblProducerText.SizeThatFits(sTemp);
                    lblProducerText.Frame = new CGRect(0, 0, this.Width, sTemp.Height);
                    vw = lblProducerText;
                    break;

                case 16:
                    vw = LoadReviews();
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screenid, ex.StackTrace);
            }
            return(vw);
        }
Пример #24
0
        public override void ViewDidLoad()
        {
            try
            {
                base.ViewDidLoad();
                //LoggingClass.UploadLogs();
                CGSize sTemp = new CGSize(UIScreen.MainScreen.Bounds.Width, 100);
                LoggingClass.LogInfo("Entered into About View ", screen);
                nfloat ScreenHeight = UIScreen.MainScreen.Bounds.Height;
                nfloat Screenwidth  = UIScreen.MainScreen.Bounds.Width - 10;
                nfloat bckimgheight = (ScreenHeight - 100) / 3;
                bckimgheight = bckimgheight + 30;
                UIImageView backgroud = new UIImageView();
                backgroud.Frame = new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width, bckimgheight);
                backgroud.Image = new UIImage("Images/aboutus.jpg");
                nfloat  y  = bckimgheight;
                UILabel T1 = new UILabel();
                T1.Frame         = new CGRect(0, y + 10, UIScreen.MainScreen.Bounds.Width - 20, 10);
                T1.Font          = UIFont.FromName("HelveticaNeue-Bold", 35f);
                T1.Text          = "Wine Outlet";
                T1.TextColor     = UIColor.Purple;
                T1.TextAlignment = UITextAlignment.Center;
                sTemp            = T1.SizeThatFits(sTemp);
                T1.Frame         = new CGRect(0, y + 10, Screenwidth, sTemp.Height);


                y = y + T1.Frame.Height + 20;
                //Console.WriteLine(y);

                UILabel H1 = new UILabel();
                H1.Frame         = new CGRect(5, y, Screenwidth, 10);
                H1.Text          = "Uncork the Merriment";
                H1.TextAlignment = UITextAlignment.Left;
                H1.TextColor     = UIColor.Black;
                H1.Font          = UIFont.FromName("Verdana-Bold", 20f);
                sTemp            = H1.SizeThatFits(sTemp);
                H1.Frame         = new CGRect(5, y, Screenwidth, sTemp.Height);

                y = y + sTemp.Height + 10;
                //Console.WriteLine(y);

                //UITextView Heading1 = new UITextView();
                //Heading1.Frame = new CGRect(5, y+10, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                //Heading1.Text = "Uncork the Merriment";
                //Heading1.TextAlignment = UITextAlignment.Left;
                ////Heading1.TextAlignment = UITextAlignment.Justified;
                //Heading1.TextColor = UIColor.Black;
                //Heading1.Font = UIFont.FromName("Verdana-Bold", 20f);
                //Heading1.Editable = false;

                UITextView p1 = new UITextView();
                p1.Frame         = new CGRect(5, y, Screenwidth, UIScreen.MainScreen.Bounds.Height);
                p1.Text          = "“Wine is inspiring and adds greatly to the joy of living”-Napoleon Bonaparte.\n\n The Wine Outlet app was developed to deliver the complete wine experience of internationally acclaimed wines while easing the pressure in choosing an exceptional wine. Wine Outlet has partnered with the world’s number 1 wine dispensing and preservation system Enomatic, a self-serve system that provides customers with a try before you buy experience.";
                p1.TextColor     = UIColor.Black;
                p1.TextAlignment = UITextAlignment.Justified;
                p1.Font          = UIFont.FromName("Verdana", 13f);
                p1.Editable      = false;
                sTemp            = p1.SizeThatFits(sTemp);
                p1.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);
                y = y + sTemp.Height - 40;

                UITextView Heading2 = new UITextView();
                Heading2.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, 10);
                Heading2.Text          = "WHO WE ARE";
                Heading2.TextColor     = UIColor.Black;
                Heading2.TextAlignment = UITextAlignment.Justified;
                Heading2.Font          = UIFont.FromName("Verdana-Bold", 20f);
                Heading2.Editable      = false;
                sTemp          = Heading2.SizeThatFits(sTemp);
                Heading2.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);
                y = y + sTemp.Height;

                UITextView p2 = new UITextView();
                p2.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, 10);
                p2.Text  = "With the wide variety of assorted wines to sample from, Wine Outlet presents the perfect backdrop connecting wine lovers with the opportunity to try new wines before they buy. Our enticing VIP program allows customers an exclusive opportunity to sample for FREE from personally selected wines. Stocked with one of the" +
                           " largest selections throughout New Jersey, each Wine Outlet will " +
                           "be the perfect spot for both the novice and connoisseur.";
                p2.TextColor     = UIColor.Black;
                p2.TextAlignment = UITextAlignment.Justified;
                p2.Font          = UIFont.FromName("Verdana", 13f);
                p2.Editable      = false;
                sTemp            = p2.SizeThatFits(sTemp);
                p2.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height - 180;
                UITextView Heading3 = new UITextView();
                Heading3.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                Heading3.Text          = "WHAT WE OFFER";
                Heading3.TextAlignment = UITextAlignment.Justified;
                Heading3.TextColor     = UIColor.Black;
                Heading3.Font          = UIFont.FromName("Verdana-Bold", 20f);
                Heading3.Editable      = false;
                Heading3.TextAlignment = UITextAlignment.Left;
                sTemp          = Heading3.SizeThatFits(sTemp);
                Heading3.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height - 30;
                UITextView p3 = new UITextView();
                p3.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                p3.Text          = "We offer an experience of enjoyment. Upon the authentication, our exciting mobile application, Wine Outlet, takes our privileged customers to the virtual vineyard of savors and flavors, through the following options:  \n\nPick the Choice: Guest users also can see all the available wines for tasting.\n\n My Tasting: See the list of wines you have tasted. \n\n My Reviews: View your ratings and reviews and let other wine lovers explore it along with you.\n\n My Favorites: Pick your favorites and we send you customized notifications when there are any discounts or available for wine tasting.\n\n My Profile: Protect your credentials and update it as and when you wish.";
                p3.TextColor     = UIColor.Black;
                p3.TextAlignment = UITextAlignment.Justified;
                p3.Font          = UIFont.FromName("Verdana", 13f);
                p3.Editable      = false;
                sTemp            = p3.SizeThatFits(sTemp);
                p3.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height - 450;
                UITextView p4 = new UITextView();
                p4.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                p4.Text          = "RATE AND REVIEW";
                p4.TextColor     = UIColor.Black;
                p4.TextAlignment = UITextAlignment.Justified;
                p4.Font          = UIFont.FromName("Verdana-Bold", 20f);
                p4.Editable      = false;
                p4.TextAlignment = UITextAlignment.Left;
                sTemp            = p4.SizeThatFits(sTemp);
                p4.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height - 20;
                UITextView p5 = new UITextView();
                p5.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                p5.Text          = "Please provide rating and review for your favorite wine. Wine Outlet app displays the average rating and the individual rating of the users.";
                p5.TextColor     = UIColor.Black;
                p5.TextAlignment = UITextAlignment.Justified;
                p5.Font          = UIFont.FromName("Verdana", 13f);
                p5.Editable      = false;
                sTemp            = p5.SizeThatFits(sTemp);
                p5.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                //y = y + sTemp.Height-10;
                //UITextView p6 = new UITextView();
                //p6.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                //p6.Text = "Rate and Review is the spot for rating your favorite wine and Wine outlet displays the average rating and the individual rating of the users.";
                //p5.TextColor = UIColor.Black;
                //p6.Font = UIFont.FromName("Verdana", 13f);
                //p6.Editable = false;
                //p6.TextAlignment = UITextAlignment.Justified;
                //sTemp = p6.SizeThatFits(sTemp);
                //p6.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height - 100;
                UITextView VersionText = new UITextView();
                VersionText.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                var ver = NSBundle.MainBundle.InfoDictionary["CFBundleVersion"];
                //MonoTouch.Constants.Version;
                //Console.WriteLine(ver);
                VersionText.Text          = "Version 1.4(" + ver + ").\nAll rights reserved.";
                VersionText.TextColor     = UIColor.Black;
                VersionText.Font          = UIFont.FromName("Verdana", 18f);
                VersionText.Editable      = false;
                VersionText.TextAlignment = UITextAlignment.Center;
                sTemp             = VersionText.SizeThatFits(sTemp);
                VersionText.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height;
                UITextView ContactUsText = new UITextView();
                ContactUsText.Frame         = new CGRect(5, y - 50, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                ContactUsText.Text          = "Click here to contact us";
                ContactUsText.TextColor     = UIColor.Purple;
                ContactUsText.Font          = UIFont.FromName("Verdana", 18f);
                ContactUsText.Editable      = false;
                ContactUsText.TextAlignment = UITextAlignment.Center;

                if (MFMailComposeViewController.CanSendMail)
                {
                    ContactUsText.UserInteractionEnabled = true;
                }
                else
                {
                    ContactUsText.UserInteractionEnabled = false;
                }

                //ContactUsText.ShouldInteractWithUrl += ContactUsText_ShouldInteractWithUrl;
                var tap = new UITapGestureRecognizer {
                    CancelsTouchesInView = false
                };
                tap.AddTarget(() =>
                {
                    mailController = new MFMailComposeViewController();
                    mailController.SetToRecipients(new string[] { "*****@*****.**" });
                    mailController.SetSubject("Feedback " + ver);
                    mailController.SetMessageBody("User info " + CurrentUser.RetreiveUserId().ToString(), true);
                    this.PresentViewController(mailController, true, null);
                    mailController.Finished += (object s, MFComposeResultEventArgs args) =>
                    {
                        args.Controller.DismissViewController(true, null);
                    };
                });
                //ContactUsText.UserInteractionEnabled = true;
                ContactUsText.AddGestureRecognizer(tap);

                nfloat h = 0;

                scrollView = new UIScrollView
                {
                    Frame            = new CGRect(0, 20, View.Frame.Width, View.Frame.Height),
                    ContentSize      = new CGSize(View.Frame.Width, View.Frame.Height),
                    BackgroundColor  = UIColor.White,
                    AutoresizingMask = UIViewAutoresizing.FlexibleHeight
                };


                scrollView.AddSubview(backgroud);
                //scrollView.AddSubview(Title1);
                scrollView.AddSubview(T1);
                scrollView.AddSubview(H1);
                //scrollView.AddSubview(Heading1);
                scrollView.AddSubview(p1);
                scrollView.AddSubview(Heading2);
                scrollView.AddSubview(p2);
                scrollView.AddSubview(Heading3);
                scrollView.AddSubview(p3);
                scrollView.AddSubview(p4);
                scrollView.AddSubview(p5);
                //scrollView.AddSubview(p6);
                scrollView.AddSubview(VersionText);
                scrollView.AddSubview(ContactUsText);

                //for (int i = 0; i < scrollView.Subviews.Length; i++)
                //{
                //	h = scrollView.Subviews[i].Frame.Size.Height + 370 + ScreenHeight;
                //}
                scrollView.ContentSize = new CGSize(UIScreen.MainScreen.Bounds.Width, y + 30);
                View = (scrollView);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
                //Console.WriteLine(ex.Message);
            }
        }
Пример #25
0
        public MyTastingCellView(NSString cellId) : base(UITableViewCellStyle.Default, cellId)
        {
            try
            {
                SelectionStyle = UITableViewCellSelectionStyle.Gray;
                LoggingClass.LogInfo("Entered Into Tasting View", screen);
                imageView = new UIButton();
                imageView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
                imageView.ContentMode      = UIViewContentMode.Center;
                imageView.ClipsToBounds    = true;

                imageView.TouchUpInside += (object sender, EventArgs e) =>
                {
                    BTProgressHUD.Show("Loading...");
                    NavController.PushViewController(new DetailViewController(WineIdLabel.Text, storeid.ToString(), false, true), false);
                };
                separator   = new UIImageView();
                btnItemname = new UIButton();
                btnItemname.SetTitle("", UIControlState.Normal);
                btnItemname.SetTitleColor(UIColor.FromRGB(127, 51, 0), UIControlState.Normal);
                btnItemname.Font           = UIFont.FromName("Verdana-Bold", 13f);
                btnItemname.LineBreakMode  = UILineBreakMode.WordWrap;
                btnItemname.TouchUpInside += delegate
                {
                    BTProgressHUD.Show("Loading...");
                    NavController.PushViewController(new DetailViewController(WineIdLabel.Text, storeid.ToString(), false, true), false);
                };
                WineName = new UILabel()
                {
                    Font            = UIFont.FromName("Verdana", 14f),
                    TextColor       = UIColor.FromRGB(127, 51, 0),
                    BackgroundColor = UIColor.Clear,
                };
                ReviewDate = new UILabel()
                {
                    Font      = UIFont.FromName("AmericanTypewriter", 10f),
                    TextColor = UIColor.FromRGB(38, 127, 200),
                    //TextAlignment = UITextAlignment.Center,
                    BackgroundColor = UIColor.Clear
                };
                Vintage = new UILabel()
                {
                    Font            = UIFont.FromName("Verdana", 10f),
                    TextColor       = UIColor.FromRGB(127, 51, 100),
                    BackgroundColor = UIColor.Clear
                };
                location = new UILabel()
                {
                    Font            = UIFont.FromName("Verdana", 10f),
                    TextColor       = UIColor.FromRGB(127, 51, 100),
                    BackgroundColor = UIColor.Clear
                };
                heartImage = new UIButton();
                heartImage.ClipsToBounds              = true;
                heartImage.Layer.BorderColor          = UIColor.White.CGColor;
                heartImage.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;
                heartImage.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                heartImage.Tag = 0;
                myItem         = new Item();
                bool count = Convert.ToBoolean(myItem.IsLike);
                if (count == true)
                {
                    heartImage.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);
                }
                else
                {
                    heartImage.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                }
                heartImage.TouchUpInside += async(object sender, EventArgs e) =>
                {
                    try
                    {
                        //Do some actionn
                        if (CurrentUser.RetreiveUserId() != 0)
                        {
                            UIButton temp = (UIButton)sender;
                            if (temp.Tag == 0)
                            {
                                heartImage.SetImage(UIImage.FromFile("heart_full.png"), UIControlState.Normal);
                                temp.Tag      = 1;
                                myItem.IsLike = true;
                                taste.IsLike  = true;
                                LoggingClass.LogInfo("Liked Wine " + WineIdLabel.Text, screen);
                            }
                            else
                            {
                                heartImage.SetImage(UIImage.FromFile("heart_empty.png"), UIControlState.Normal);
                                temp.Tag      = 0;
                                myItem.IsLike = false;
                                taste.IsLike  = false;
                                LoggingClass.LogInfo("Unliked Wine " + WineIdLabel.Text, screen);
                            }
                            //NavigationController.PushViewController(new DetailViewController(), false);
                            SKULike like = new SKULike();
                            like.UserID   = Convert.ToInt32(CurrentUser.RetreiveUserId());
                            like.BarCode  = WineIdLabel.Text;
                            like.Liked    = Convert.ToBoolean(temp.Tag);
                            myItem.IsLike = Convert.ToBoolean(temp.Tag);
                            ServiceWrapper sw = new ServiceWrapper();
                            await sw.InsertUpdateLike(like);
                        }
                    }
                    catch (Exception ex)
                    {
                        LoggingClass.LogError(ex.Message, screen, ex.StackTrace);
                    }
                };
                WineIdLabel = new UILabel();
                ContentView.AddSubviews(new UIView[] { btnItemname, ReviewDate, imageView, Vintage, separator, heartImage, location });
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.Message, screen, ex.StackTrace);
            }
        }
Пример #26
0
        public override void ViewDidLoad()
        {
            try
            {
                base.ViewDidLoad();
                //LoggingClass.UploadLogs();
                CGSize sTemp = new CGSize(UIScreen.MainScreen.Bounds.Width, 100);
                LoggingClass.LogInfo("Entered into About View ", screen);
                nfloat ScreenHeight = UIScreen.MainScreen.Bounds.Height;
                nfloat Screenwidth  = UIScreen.MainScreen.Bounds.Width - 10;
                nfloat bckimgheight = (ScreenHeight - 100) / 3;
                bckimgheight = bckimgheight + 30;
                UIImageView backgroud = new UIImageView();
                backgroud.Frame = new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width, bckimgheight);
                backgroud.Image = new UIImage("Images/aboutus.jpg");
                nfloat  y  = bckimgheight;
                UILabel T1 = new UILabel();
                T1.Frame         = new CGRect(0, y + 10, UIScreen.MainScreen.Bounds.Width - 20, 10);
                T1.Font          = UIFont.FromName("HelveticaNeue-Bold", 35f);
                T1.Text          = "Wine Hangouts";
                T1.TextColor     = UIColor.Purple;
                T1.TextAlignment = UITextAlignment.Center;
                sTemp            = T1.SizeThatFits(sTemp);
                T1.Frame         = new CGRect(0, y + 10, Screenwidth, sTemp.Height);


                y = y + T1.Frame.Height + 10;
                //Console.WriteLine(y);

                UILabel H1 = new UILabel();
                H1.Frame         = new CGRect(5, y, Screenwidth, 10);
                H1.Text          = "Uncork the Merriment";
                H1.TextAlignment = UITextAlignment.Left;
                H1.TextColor     = UIColor.Black;
                H1.Font          = UIFont.FromName("Verdana-Bold", 20f);
                sTemp            = H1.SizeThatFits(sTemp);
                H1.Frame         = new CGRect(5, y, Screenwidth, sTemp.Height);

                y = y + sTemp.Height + 10;
                //Console.WriteLine(y);

                //UITextView Heading1 = new UITextView();
                //Heading1.Frame = new CGRect(5, y+10, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                //Heading1.Text = "Uncork the Merriment";
                //Heading1.TextAlignment = UITextAlignment.Left;
                ////Heading1.TextAlignment = UITextAlignment.Justified;
                //Heading1.TextColor = UIColor.Black;
                //Heading1.Font = UIFont.FromName("Verdana-Bold", 20f);
                //Heading1.Editable = false;

                UITextView p1 = new UITextView();
                p1.Frame         = new CGRect(5, y, Screenwidth, UIScreen.MainScreen.Bounds.Height);
                p1.Text          = "A delicious bottled wine is the way to the perfect blend of joy. Wine Hangouts is thus,developed to facilitate the wine lovers to deliver a complete wine experience through the internationally acclaimed wines and beers. Sticking strict to the quality, Wine Hangouts brings in the best self-serve partners in the industry: Enomatic- The World’s #1Wine Dispenser and Wine Preservation System and iPoruIt – A revolutionary self-serve solution for beers, to elevate the merriment of our guests to the best.";
                p1.TextColor     = UIColor.Black;
                p1.TextAlignment = UITextAlignment.Justified;
                p1.Font          = UIFont.FromName("Verdana", 13f);
                p1.Editable      = false;
                sTemp            = p1.SizeThatFits(sTemp);
                p1.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);
                y = y + sTemp.Height - 40;

                UITextView Heading2 = new UITextView();
                Heading2.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, 10);
                Heading2.Text          = "WHO WE ARE";
                Heading2.TextColor     = UIColor.Black;
                Heading2.TextAlignment = UITextAlignment.Justified;
                Heading2.Font          = UIFont.FromName("Verdana-Bold", 20f);
                Heading2.Editable      = false;
                sTemp          = Heading2.SizeThatFits(sTemp);
                Heading2.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);
                y = y + sTemp.Height;

                UITextView p2 = new UITextView();
                p2.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, 10);
                p2.Text          = "Wine Hangouts ensures the perfect backdrop to relish and to hang out with the wine and beer lovers, through over 24 assorted wines from the world’s best wineries. Each of our wine outlets is assured with one of the largest inventories of wine you can experience in New Jersey. The exclusive opportunity for our privileged customers makes it more enticing by offering FREE tasting of the 24 wines out of our huge collection.So, isn’t it time for a Wine Dine?";
                p2.TextColor     = UIColor.Black;
                p2.TextAlignment = UITextAlignment.Justified;
                p2.Font          = UIFont.FromName("Verdana", 13f);
                p2.Editable      = false;
                sTemp            = p2.SizeThatFits(sTemp);
                p2.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height - 180;
                UITextView Heading3 = new UITextView();
                Heading3.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                Heading3.Text          = "WHAT WE OFFER";
                Heading3.TextAlignment = UITextAlignment.Justified;
                Heading3.TextColor     = UIColor.Black;
                Heading3.Font          = UIFont.FromName("Verdana-Bold", 20f);
                Heading3.Editable      = false;
                Heading3.TextAlignment = UITextAlignment.Left;
                sTemp          = Heading3.SizeThatFits(sTemp);
                Heading3.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height - 30;
                UITextView p3 = new UITextView();
                p3.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                p3.Text          = "We offer- not just the wines and beers, but an experience of enjoyment.Upon the credential authentication, the mobile application- Wine Hangout takes our privileged customers to the virtual vineyard of savors and flavors, through the following options:  \n\nPick the Choice: Guest is displayed with all the available wines for tasting.\n\n My Tasting: See the list of wines you have tasted and choose more from the remaining surprises.\n\n My Reviews: View your ratings and reviews and let other wine lovers explore it along with you.\n\n My Favorites: Pick your favorites and we save the list to send you customized notifications when there are any discounts or available for wine tasting.\n\n My Profile: Protect your credentials and update it as and when you wish.";
                p3.TextColor     = UIColor.Black;
                p3.TextAlignment = UITextAlignment.Justified;
                p3.Font          = UIFont.FromName("Verdana", 13f);
                p3.Editable      = false;
                sTemp            = p3.SizeThatFits(sTemp);
                p3.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height - 470;
                UITextView p4 = new UITextView();
                p4.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                p4.Text          = "RATE AND REVIEW";
                p4.TextColor     = UIColor.Black;
                p4.TextAlignment = UITextAlignment.Justified;
                p4.Font          = UIFont.FromName("Verdana-Bold", 20f);
                p4.Editable      = false;
                p4.TextAlignment = UITextAlignment.Left;
                sTemp            = p4.SizeThatFits(sTemp);
                p4.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height - 20;
                UITextView p5 = new UITextView();
                p5.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                p5.Text          = "Please provide rating and review for your favorite wine. Wine Hangouts app displays the average rating and the individual rating of the users.";
                p5.TextColor     = UIColor.Black;
                p5.TextAlignment = UITextAlignment.Justified;
                p5.Font          = UIFont.FromName("Verdana", 13f);
                p5.Editable      = false;
                sTemp            = p5.SizeThatFits(sTemp);
                p5.Frame         = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                //y = y + sTemp.Height-10;
                //UITextView p6 = new UITextView();
                //p6.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                //p6.Text = "Rate and Review is the spot for rating your favorite wine and Wine Hangouts displays the average rating and the individual rating of the users.";
                //p5.TextColor = UIColor.Black;
                //p6.Font = UIFont.FromName("Verdana", 13f);
                //p6.Editable = false;
                //p6.TextAlignment = UITextAlignment.Justified;
                //sTemp = p6.SizeThatFits(sTemp);
                //p6.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height - 100;
                UITextView VersionText = new UITextView();
                VersionText.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                var ver = NSBundle.MainBundle.InfoDictionary["CFBundleVersion"];
                //MonoTouch.Constants.Version;
                //Console.WriteLine(ver);
                VersionText.Text          = "Version 1.17(" + ver + ").\nAll rights reserved.\n Reach us at";
                VersionText.TextColor     = UIColor.Black;
                VersionText.Font          = UIFont.FromName("Verdana", 18f);
                VersionText.Editable      = false;
                VersionText.TextAlignment = UITextAlignment.Center;
                sTemp             = VersionText.SizeThatFits(sTemp);
                VersionText.Frame = new CGRect(5, y, UIScreen.MainScreen.Bounds.Width - 20, sTemp.Height);

                y = y + sTemp.Height;
                UITextView ContactUsText = new UITextView();
                ContactUsText.Frame         = new CGRect(5, y - 50, UIScreen.MainScreen.Bounds.Width - 20, UIScreen.MainScreen.Bounds.Height);
                ContactUsText.Text          = "*****@*****.**";
                ContactUsText.TextColor     = UIColor.Purple;
                ContactUsText.Font          = UIFont.FromName("Verdana", 18f);
                ContactUsText.Editable      = false;
                ContactUsText.TextAlignment = UITextAlignment.Center;

                if (MFMailComposeViewController.CanSendMail)
                {
                    ContactUsText.UserInteractionEnabled = true;
                }
                else
                {
                    ContactUsText.UserInteractionEnabled = false;
                }

                //ContactUsText.ShouldInteractWithUrl += ContactUsText_ShouldInteractWithUrl;
                var tap = new UITapGestureRecognizer {
                    CancelsTouchesInView = false
                };
                tap.AddTarget(() =>
                {
                    mailController = new MFMailComposeViewController();
                    mailController.SetToRecipients(new string[] { "*****@*****.**" });
                    mailController.SetSubject("Feedback " + ver);
                    mailController.SetMessageBody("User info " + CurrentUser.RetreiveUserId().ToString(), true);
                    this.PresentViewController(mailController, true, null);
                    mailController.Finished += (object s, MFComposeResultEventArgs args) =>
                    {
                        args.Controller.DismissViewController(true, null);
                    };
                });
                //ContactUsText.UserInteractionEnabled = true;
                ContactUsText.AddGestureRecognizer(tap);

                nfloat h = 0;

                scrollView = new UIScrollView
                {
                    Frame            = new CGRect(0, 20, View.Frame.Width, View.Frame.Height),
                    ContentSize      = new CGSize(View.Frame.Width, View.Frame.Height),
                    BackgroundColor  = UIColor.White,
                    AutoresizingMask = UIViewAutoresizing.FlexibleHeight
                };


                scrollView.AddSubview(backgroud);
                //scrollView.AddSubview(Title1);
                scrollView.AddSubview(T1);
                scrollView.AddSubview(H1);
                //scrollView.AddSubview(Heading1);
                scrollView.AddSubview(p1);
                scrollView.AddSubview(Heading2);
                scrollView.AddSubview(p2);
                scrollView.AddSubview(Heading3);
                scrollView.AddSubview(p3);
                scrollView.AddSubview(p4);
                scrollView.AddSubview(p5);
                //scrollView.AddSubview(p6);
                scrollView.AddSubview(VersionText);
                scrollView.AddSubview(ContactUsText);

                //for (int i = 0; i < scrollView.Subviews.Length; i++)
                //{
                //	h = scrollView.Subviews[i].Frame.Size.Height + 370 + ScreenHeight;
                //}
                scrollView.ContentSize = new CGSize(UIScreen.MainScreen.Bounds.Width, y + 30);
                View = (scrollView);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
                //Console.WriteLine(ex.Message);
            }
        }
Пример #27
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            try
            {
                //downloading all wine images
                BlobWrapper.DownloadAllImages();
                // Override point for customization after application launch.
                // If not required for your application you can safely delete this method
                UITabBarController RootTab = (UITabBarController)Window.RootViewController;
                //CurrentUser.Clear();
                CurrentUser.Store("48732", "user Simulator");
                //for direct log in
                //CurrentUser.PutCa	rdNumber("7207589007");
                //Console.WriteLine(DateTime.Now + " App opened");
                UIImage profile = UIImage.FromFile("profile.png");
                profile = ResizeImage(profile, 25, 25);
                _window = Window;
                UIImage info = UIImage.FromFile("Info.png");
                info = ResizeImage(info, 25, 25);
                //Checking the user already logged in or not
                if (CurrentUser.RetreiveUserId() != 0)
                {
                    ManageTabBar(RootTab);
                    LoggingClass.LogInfo("App opened " + CurrentUser.RetreiveUserId(), screen);
                    nav = new UINavigationController(RootTab);
                    //Window.RootViewController = RootTab;
                    AddNavigationButtons(nav);
                    UIBarButtonItem.Appearance.TintColor = UIColor.FromRGB(128, 0, 128);
                    Window.RootViewController            = nav;
                }
                //Checking Guest logged in or not
                else if (CurrentUser.GetGuestId() != "0" && CurrentUser.GetGuestId() != null)
                {
                    CurrentUser.Store("0", "Guest");
                    ManageTabBar(RootTab);
                    //Console.WriteLine(DateTime.Now + " App opened");
                    nav = new UINavigationController(RootTab);
                    //Window.RootViewController = RootTab;
                    AddNavigationButtons(nav);
                    UIBarButtonItem.Appearance.TintColor = UIColor.FromRGB(128, 0, 128);
                    Window.RootViewController            = nav;
                }
                else
                {
                    ManageTabBar(RootTab);
                    var login = new LoginViewController();
                    login.RootTabs = Window.RootViewController;
                    login._window  = Window;
                    nav            = new UINavigationController(login);
                    //nav.NavigationBar.BackgroundColor = UIColor.FromRGB(97, 100, 142);
                    UIBarButtonItem.Appearance.TintColor = UIColor.FromRGB(128, 0, 128);
                    Window.RootViewController            = nav;
                }
            }
            catch (Exception exe)
            {
                LoggingClass.LogError(exe.Message, screen, exe.StackTrace);
            }
            //Notification Settings
            if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
            {
                var pushSettings = UIUserNotificationSettings.GetSettingsForTypes(
                    UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound,
                    new NSSet());

                UIApplication.SharedApplication.RegisterUserNotificationSettings(pushSettings);
                UIApplication.SharedApplication.RegisterForRemoteNotifications();
            }
            else
            {
                UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound;
                UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);
            }
            return(true);
        }
Пример #28
0
        public override void ViewDidLoad()
        {
            //AboutController1.ViewDidLoad(base);
            // Perform any additional setup after loading the view, typically from a nib.
            try
            {
                nfloat ScreenHeight = UIScreen.MainScreen.Bounds.Height;
                ScreenHeight = (ScreenHeight - 100) / 4;
                nfloat   margin        = 1;
                nfloat   start         = 50;
                UIButton btnReviews    = new UIButton();
                UIButton btnTastings   = new UIButton();
                UIButton btnFavourites = new UIButton();
                UIButton btnMyStore    = new UIButton();
                LoggingClass.LogInfo("Entered into My Hangouts", screen);
                btnReviews.Frame    = new CGRect(0, start + ScreenHeight + margin, UIScreen.MainScreen.Bounds.Width, ScreenHeight);
                btnTastings.Frame   = new CGRect(0, start, UIScreen.MainScreen.Bounds.Width, ScreenHeight);
                btnFavourites.Frame = new CGRect(0, start + (ScreenHeight + margin) * 2, UIScreen.MainScreen.Bounds.Width, ScreenHeight);
                btnMyStore.Frame    = new CGRect(0, start + ((ScreenHeight + margin) * 3) + 1, UIScreen.MainScreen.Bounds.Width, ScreenHeight);

                btnReviews.SetTitle("", UIControlState.Normal);
                btnMyStore.SetTitle("", UIControlState.Normal);
                btnTastings.SetTitle("", UIControlState.Normal);
                btnFavourites.SetTitle("", UIControlState.Normal);

                btnReviews.SetBackgroundImage(new UIImage("Images/mr.jpg"), UIControlState.Normal);
                btnTastings.SetBackgroundImage(new UIImage("Images/mt.jpg"), UIControlState.Normal);
                btnFavourites.SetBackgroundImage(new UIImage("Images/mf.jpg"), UIControlState.Normal);
                btnMyStore.SetBackgroundImage(new UIImage("Images/ms.jpg"), UIControlState.Normal);
                //if (CurrentUser.RetreiveUserId() == 0)
                //{
                //	UIAlertView alert1 = new UIAlertView()
                //	{
                //		Title = "This feature is allowed only for VIP Card holders",
                //		//Message = "Coming Soon..."
                //	};
                //	alert1.AddButton("OK");
                //	alert1.AddButton("Know more");
                //		alert1.Clicked += (senderalert, buttonArgs) =>
                //		{
                //			if (buttonArgs.ButtonIndex == 1)
                //			{
                //				UIApplication.SharedApplication.OpenUrl(new NSUrl("http://savvyitdev.com/winehangouts/"));
                //			}
                //		};
                //	alert1.AddButton("Login");
                //	alert1.Show();
                //	btnReviews.TouchUpInside += (sender, e) =>
                //	{
                //		UIAlertView alert = new UIAlertView()
                //		{
                //			Title = "This feature is allowed only for VIP Card holders",
                //				//Message = "Coming Soon..."
                //			};
                //		alert.AddButton("OK");
                //		alert.AddButton("Know more");
                //		alert.Clicked += (senderalert, buttonArgs) =>
                //		{
                //			if (buttonArgs.ButtonIndex == 1)
                //			{
                //				UIApplication.SharedApplication.OpenUrl(new NSUrl("http://savvyitdev.com/winehangouts/"));
                //			}
                //		};
                //		alert.Show();
                //	};
                //	btnTastings.TouchUpInside += (sender, e) =>
                //	{
                //		UIAlertView alert = new UIAlertView()
                //		{
                //			Title = "This feature is allowed only for VIP Card holders",
                //				//Message = "Coming Soon..."
                //			};
                //		alert.AddButton("OK");
                //		alert.AddButton("Know more");
                //		alert.Clicked += (senderalert, buttonArgs) =>
                //		{
                //			if (buttonArgs.ButtonIndex == 1)
                //			{
                //				UIApplication.SharedApplication.OpenUrl(new NSUrl("http://savvyitdev.com/winehangouts/"));
                //			}
                //		};
                //		alert.Show();
                //	};
                //	btnFavourites.TouchUpInside += (sender, e) =>
                //	{
                //		UIAlertView alert = new UIAlertView()
                //		{
                //			Title = "This feature is allowed only for VIP Card holders",
                //				//Message = "Coming Soon..."
                //			};
                //		alert.AddButton("OK");
                //		alert.AddButton("Know more");
                //		alert.Clicked += (senderalert, buttonArgs) =>
                //		{
                //			if (buttonArgs.ButtonIndex == 1)
                //			{
                //				UIApplication.SharedApplication.OpenUrl(new NSUrl("http://savvyitdev.com/winehangouts/"));
                //			}
                //		};
                //		alert.Show();
                //	};
                //}
                //else
                //{
                btnReviews.TouchDown += (sender, e) =>
                {
                    BTProgressHUD.Show("Loading...");                             //show spinner + text
                };
                btnTastings.TouchDown += (sender, e) =>
                {
                    BTProgressHUD.Show("Loading...");                             //show spinner + text
                };
                btnFavourites.TouchDown += (sender, e) =>
                {
                    BTProgressHUD.Show("Loading...");                             //show spinner + text
                };
                btnMyStore.TouchDown += (sender, e) =>
                {
                    BTProgressHUD.Show("Loading...");
                };
                btnReviews.TouchUpInside += (sender, e) =>
                {
                    if (CurrentUser.RetreiveUserId() != 0)
                    {
                        var MyReview = new MyReviewViewController();
                        NavigationController.PushViewController(MyReview, false);
                        LoggingClass.LogInfo("Entered into My Reviews", screen);
                        BTProgressHUD.Dismiss();
                        NavigationController.NavigationBar.TopItem.Title = "My Reviews";
                    }
                    else
                    {
                        BTProgressHUD.Dismiss();
                        UIAlertView alert = new UIAlertView()
                        {
                            Title = "This feature is allowed only for VIP Card holders",
                            //Message = "Coming Soon..."
                        };
                        alert.AddButton("OK");
                        alert.AddButton("Know more");
                        alert.Clicked += (senderalert, buttonArgs) =>
                        {
                            if (buttonArgs.ButtonIndex == 1)
                            {
                                UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html"));
                            }
                        };
                        alert.Show();
                    }
                };
                btnTastings.TouchUpInside += (sender, e) =>
                {
                    if (CurrentUser.RetreiveUserId() != 0)
                    {
                        var MyTaste = new MyTastingViewController();
                        NavigationController.PushViewController(MyTaste, false);
                        LoggingClass.LogInfo("Entered into My Tastings", screen);
                        BTProgressHUD.Dismiss();
                        NavigationController.NavigationBar.TopItem.Title = "My Tastings";
                    }
                    else
                    {
                        BTProgressHUD.Dismiss();
                        UIAlertView alert = new UIAlertView()
                        {
                            Title = "This feature is allowed only for VIP Card holders",
                            //Message = "Coming Soon..."
                        };
                        alert.AddButton("OK");
                        alert.AddButton("Know more");
                        alert.Clicked += (senderalert, buttonArgs) =>
                        {
                            if (buttonArgs.ButtonIndex == 1)
                            {
                                UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html"));
                            }
                        };
                        alert.Show();
                    }
                };
                btnFavourites.TouchUpInside += (sender, e) =>
                {
                    if (CurrentUser.RetreiveUserId() != 0)
                    {
                        nfloat width = UIScreen.MainScreen.Bounds.Width;
                        width = width / 2 - 15;
                        UICollectionViewFlowLayout flowLayout;
                        flowLayout = new UICollectionViewFlowLayout()
                        {
                            ItemSize        = new CGSize(width, 325.0f),
                            SectionInset    = new UIEdgeInsets(10.0f, 10.0f, 10.0f, 10.0f),
                            ScrollDirection = UICollectionViewScrollDirection.Vertical
                        };
                        NavigationController.PushViewController(new MyFavController(flowLayout), false);
                        NavigationController.NavigationBar.TopItem.Title = "My Favorites";
                        LoggingClass.LogInfo("Entered into Favourite View", screen);
                        BTProgressHUD.Dismiss();
                    }
                    else
                    {
                        BTProgressHUD.Dismiss();
                        UIAlertView alert = new UIAlertView()
                        {
                            Title = "This feature is allowed only for VIP Card holders",
                            //Message = "Coming Soon..."
                        };
                        alert.AddButton("OK");
                        alert.AddButton("Know more");
                        alert.Clicked += (senderalert, buttonArgs) =>
                        {
                            if (buttonArgs.ButtonIndex == 1)
                            {
                                UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html"));
                            }
                        };
                        alert.Show();
                    }
                };
                btnMyStore.TouchUpInside += (sender, e) =>
                {
                    nfloat width = UIScreen.MainScreen.Bounds.Width;
                    width = width / 2 - 15;
                    UICollectionViewFlowLayout flowLayout;
                    flowLayout = new UICollectionViewFlowLayout()
                    {
                        ItemSize        = new CGSize(width, 325.0f),
                        SectionInset    = new UIEdgeInsets(10.0f, 10.0f, 10.0f, 10.0f),
                        ScrollDirection = UICollectionViewScrollDirection.Vertical
                    };
                    if (CurrentUser.GetStore() == 1)
                    {
                        //BTProgressHUD.Show("Please wait...");
                        NavigationController.Title = "Locations";
                        NavigationController.PushViewController(new PhyCollectionView(flowLayout, 1), false);
                        NavigationController.NavigationBar.TopItem.Title = "My Store  (" + LoggingClass.txtstore1 + ")";
                    }
                    else if (CurrentUser.GetStore() == 2)
                    {
                        //BTProgressHUD.Show("Please wait...");
                        NavigationController.Title = "Locations";
                        NavigationController.PushViewController(new PhyCollectionView(flowLayout, 2), false);
                        NavigationController.NavigationBar.TopItem.Title = "My Store (" + LoggingClass.txtstore2 + ")";
                    }
                    else if (CurrentUser.GetStore() == 3)
                    {
                        //BTProgressHUD.Show("Please wait...");
                        NavigationController.Title = "Locations";
                        NavigationController.PushViewController(new PhyCollectionView(flowLayout, 3), false);
                        NavigationController.NavigationBar.TopItem.Title = "My Store (" + LoggingClass.txtstore3 + ")";
                    }
                    else
                    {
                        UIAlertView alert = new UIAlertView()
                        {
                            Title = "Please choose your preferred store in profile.",
                            //Message = "Coming Soon..."
                        };
                        alert.AddButton("OK");
                        BTProgressHUD.Dismiss();
                        alert.Show();
                    }
                };
                View.AddSubview(btnMyStore);
                View.AddSubview(btnReviews);
                View.AddSubview(btnTastings);
                View.AddSubview(btnFavourites);
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace);
            }
        }
        public void Internal_ViewDidLoad(Boolean refresh)
        {
            try
            {
                LoggingClass.LogInfo("Entered into detail view of " + _wineId, screen);
                //BTProgressHUD.Show();
                nfloat width = View.Frame.Width;
                ItemDetailsResponse mydata = svc.GetItemDetailsBarcode(_wineId, _storeId).Result;
                //ItemReviewResponse rv = svc.GetItemReviewUID(CurrentUser.RetreiveUserId()).Result;
                var data = mydata.ItemDetails;
                if (data.Barcode != null)
                {
                    var lblName = new UILabel();
                    lblName.Frame         = new CGRect(0, 0, width, 40);
                    lblName.Text          = data.Name;
                    lblName.Font          = UIFont.FromName("Verdana-Bold", 16f);
                    lblName.TextAlignment = UITextAlignment.Center;
                    lblName.TextColor     = UIColor.Purple;

                    //var Separator = new UIImageView();
                    //Separator.Frame = new CGRect(0, 50, View.Frame.Width, 2);
                    //Separator.Image = UIImage.FromFile("separator.png");

                    var lblVintage = new UILabel();
                    lblVintage.Frame = new CGRect(View.Frame.Width / 2 - 10, 40, 40, 20);
                    double l = Math.Floor(Math.Log10(data.Vintage) + 1);
                    if (l < 4)
                    {
                        lblVintage.Text = " ";
                    }
                    else
                    {
                        lblVintage.Text = data.Vintage.ToString();
                    }
                    lblVintage.Font            = UIFont.FromName("Verdana", 12f);
                    lblVintage.TextAlignment   = UITextAlignment.Center;
                    lblVintage.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile("line123.png"));


                    var btlImage = new UIImageView();                     //92 * 233
                    btlImage.Frame = new CGRect(0, 10, width, width);
                    UIImage image = new UIImage("Images/loadin.png");

                    var btnBuy = new UIButton();
                    btnBuy.Frame             = new CGRect(UIScreen.MainScreen.Bounds.Width - 140, 70 + View.Frame.Width, 130, 70);
                    btnBuy.ClipsToBounds     = true;
                    btnBuy.Layer.BorderColor = UIColor.White.CGColor;
                    //btnBuy.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge;
                    btnBuy.SetImage(UIImage.FromFile("buy.png"), UIControlState.Normal);
                    btnBuy.TouchUpInside += delegate {
                        UIApplication.SharedApplication.OpenUrl(new NSUrl("http://www.wineoutlet.com/sku" + data.SKU + ".html"));
                    };

                    CGRect rect      = btlImage.Bounds;
                    nfloat boxHeight = rect.Height;                     // which is = width;
                    //nfloat imgHeight = image.Size.Height;
                    //nfloat ratio = boxHeight / imgHeight;
                    //CGSize newSize = new CGSize(image.Size.Width * ratio, image.Size.Height * ratio);
                    //image = image.Scale(newSize);
                    nfloat X = (rect.Width / 2) - 50;
                    btlImage.Frame = new CGRect(X, btlImage.Bounds.Height / 2, 100, 100);
                    btlImage.Image = image;
                    DownloadAsync(data.Barcode, _storeId, btlImage, boxHeight, 70);
                    nfloat Y1 = 90 + View.Frame.Width;

                    UITextView txtWineleft = new UITextView(new CGRect(0, Y1 + 10, width, 40));
                    txtWineleft.Text          = "Wine left in bottle: " + data.AvailableVolume.ToString() + ".ml";
                    txtWineleft.TextAlignment = UITextAlignment.Center;
                    txtWineleft.Editable      = false;
                    //uip.SetProgress(Convert.ToSingle(data.AvailableVolume), false);
                    //uip.ProgressTintColor = UIColor.Green;
                    //uip.TintColor = UIColor.Gray;
                    //CGAffineTransform transform=CGAffineTransform.MakeScale(1.0f,Convert.ToSingle(data.AvailableVolume));
                    //uip.Transform = transform;

                    var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/empty.png"),
                                                        filledImage: UIImage.FromBundle("Stars/star.png"),
                                                        chosenImage: UIImage.FromBundle("Stars/star.png"));

                    nfloat Y = 70 + View.Frame.Width;
                    ratingView = new PDRatingView(new CGRect(width * 3 / 8 + 2, Y, width / 4, 20f), ratingConfig, data.AverageRating);
                    ratingView.UserInteractionEnabled = false;


                    var lblRateTitle = new UILabel();
                    lblRateTitle.Frame         = new CGRect(4, Y + 40, width, 50);
                    lblRateTitle.Text          = "Rate this Wine";
                    lblRateTitle.TextAlignment = UITextAlignment.Center;
                    lblRateTitle.Font          = UIFont.FromName("Verdana-Bold", 16f);
                    lblRateTitle.TextColor     = UIColor.Purple;

                    var lblRateRequest = new UILabel();
                    lblRateRequest.Frame         = new CGRect(4, Y + 75, width, 10);
                    lblRateRequest.Text          = "Select number of Stars";
                    lblRateRequest.Font          = UIFont.FromName("AmericanTypewriter", 10f);
                    lblRateRequest.TextAlignment = UITextAlignment.Center;

                    var starUpLine = new UIImageView(new CGRect(4, Y + 90, width - 8, 1));
                    starUpLine.AutoresizingMask  = UIViewAutoresizing.FlexibleWidth;
                    starUpLine.Image             = UIImage.FromFile("separator.png");
                    starUpLine.ContentMode       = UIViewContentMode.ScaleAspectFill;
                    starUpLine.ClipsToBounds     = true;
                    starUpLine.Layer.BorderColor = UIColor.White.CGColor;
                    starUpLine.BackgroundColor   = UIColor.LightGray;
                    Y = Y + 10;
                    PDRatingView     ratingViewSelect = new PDRatingView(new CGRect(width * 2 / 8, Y + 82, width / 2, 36f), ratingConfig, 0m);
                    UIViewController that             = this;

                    var starDownLine = new UIImageView(new CGRect(4, Y + 120, View.Frame.Width - 8, 1));
                    starDownLine.AutoresizingMask  = UIViewAutoresizing.FlexibleWidth;
                    starDownLine.Image             = UIImage.FromFile("separator.png");
                    starDownLine.ContentMode       = UIViewContentMode.ScaleAspectFill;
                    starDownLine.ClipsToBounds     = true;
                    starDownLine.Layer.BorderColor = UIColor.White.CGColor;
                    starDownLine.BackgroundColor   = UIColor.LightGray;

                    Y = Y + 140;
                    var lblDesc = new UILabel();
                    lblDesc.Frame         = new CGRect(4, Y, View.Frame.Width, 20);
                    lblDesc.Text          = "Description: ";
                    lblDesc.TextAlignment = UITextAlignment.Left;

                    Y = Y + 20;
                    var lblDescText = new UITextView();
                    lblDescText.Editable = false;
                    if (data.Description == null || data.Description == "")
                    {
                        lblDescText.Text = "Not available";
                        lblDescText.Font = UIFont.FromName("EuphemiaUCAS-Italic", 10f);
                    }
                    else
                    {
                        lblDescText.Text = data.Description.Trim();
                    }
                    lblDescText.TextAlignment = UITextAlignment.Justified;
                    CGSize sTemp = new CGSize(width, 100);
                    sTemp             = lblDescText.SizeThatFits(sTemp);
                    lblDescText.Frame = new CGRect(0, Y, width, sTemp.Height);

                    Y = Y + lblDescText.Frame.Size.Height;
                    var table = new UITableView();
                    table.Frame           = new CGRect(0, Y, width, data.WineProperties.Count * 22);
                    table.Source          = new WineInfoTableSource(data.WineProperties);
                    table.AllowsSelection = false;
                    table.ScrollEnabled   = false;

                    Y = Y + table.Frame.Size.Height + 10;
                    var lblProducer = new UILabel();
                    lblProducer.Frame         = new CGRect(4, Y, width, 20);
                    lblProducer.Text          = "Producer: ";
                    lblProducer.TextAlignment = UITextAlignment.Left;

                    Y = Y + 20;
                    var lblProducerText = new UITextView();
                    lblProducerText.Editable = false;
                    if (data.Producer == null || data.Producer == "")
                    {
                        lblProducerText.Text = "Not available";
                        lblProducerText.Font = UIFont.FromName("EuphemiaUCAS-Italic", 10f);
                    }
                    else
                    {
                        lblProducerText.Text = data.Producer.Trim();
                    }
                    lblProducerText.TextAlignment = UITextAlignment.Justified;
                    sTemp = new CGSize(width, 100);
                    sTemp = lblProducerText.SizeThatFits(sTemp);
                    lblProducerText.Frame = new CGRect(0, Y, width, sTemp.Height);


                    ItemReviewResponse ratings = svc.GetItemReviewsByWineID(data.Barcode).Result;
                    data.Reviews = ratings.Reviews.ToList();
                    Y            = Y + lblProducerText.Frame.Size.Height;
                    var review = LoadReviews(data, Y, width);
                    Y = Y + review.Frame.Size.Height;

                    //Y = Y + 20;
                    var NoReviews = new UITextView();
                    NoReviews.Hidden = true;
                    if (data.Reviews.Count == 0)
                    {
                        _noreviews = true;
                        reviewTable.SeparatorColor = UIColor.Clear;
                        NoReviews.Text             = ratings.ErrorDescription;
                        sTemp                   = NoReviews.SizeThatFits(sTemp);
                        NoReviews.Frame         = new CGRect(0, Y - 50, width, 40);
                        NoReviews.Editable      = false;
                        NoReviews.TextAlignment = UITextAlignment.Center;
                        NoReviews.Hidden        = false;
                    }

                    var    currentReview = data.Reviews.Where(x => x.ReviewUserId == CurrentUser.RetreiveUserId()).FirstOrDefault();
                    string currComments  = "";
                    if (currentReview != null)
                    {
                        currComments = currentReview.RatingText;
                    }
                    if (_notif == true)
                    {
                        //ratingViewSelect.RatingChosen += (sender, e) =>
                        //{
                        //if (CurrentUser.RetreiveUserId() == 0)
                        //{
                        //	UIAlertView alert = new UIAlertView()
                        //	{
                        //		Title = "This feature is allowed only for VIP Card holders",
                        //		//Message = "Coming Soon..."
                        //	};
                        //		alert.AddButton("OK");
                        //	alert.AddButton("Know more");
                        //	alert.Clicked += (senderalert, buttonArgs) =>
                        //	{
                        //		if (buttonArgs.ButtonIndex == 1)
                        //		{
                        //			UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html"));
                        //		}
                        //	};
                        //	alert.Show();
                        //	ratingViewSelect.ChosenRating = 0;
                        //}
                        //else
                        //{
                        try
                        {
                            LoggingClass.LogInfo("Came from notifications and giving rating for " + data.Barcode, screen);
                            PopupView yourController = new PopupView(data.Barcode, _storeId);
                            yourController.NavController          = NavigationController;
                            yourController.parent                 = that;
                            yourController.StartsSelected         = 5;
                            yourController.Comments               = currComments;
                            yourController.ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext;
                            that.PresentModalViewController(yourController, false);
                        }
                        catch (Exception exe)
                        {
                            LoggingClass.LogError(exe.Message, screen, exe.StackTrace);
                        }
                        //}
                        //};
                    }
                    ratingViewSelect.RatingChosen += (sender, e) =>
                    {
                        if (CurrentUser.RetreiveUserId() == 0)
                        {
                            UIAlertView alert = new UIAlertView()
                            {
                                Title = "This feature is allowed only for VIP Card holders",
                                //Message = "Coming Soon..."
                            };
                            alert.AddButton("OK");
                            alert.AddButton("Know more");
                            alert.Clicked += (senderalert, buttonArgs) =>
                            {
                                if (buttonArgs.ButtonIndex == 1)
                                {
                                    UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html"));
                                }
                            };
                            alert.Show();
                            ratingViewSelect.ChosenRating = 0;
                        }
                        else
                        {
                            LoggingClass.LogInfo("Clicked on stars to give rating on " + data.Barcode, screen);
                            PopupView yourController = new PopupView(data.Barcode, _storeId);
                            yourController.NavController          = NavigationController;
                            yourController.parent                 = that;
                            yourController.StartsSelected         = e.Rating;
                            yourController.Comments               = currComments;
                            yourController.ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext;
                            that.PresentModalViewController(yourController, false);
                        }
                    };
                    scrollView       = new UIScrollView();
                    scrollView.Frame = new CGRect(0, 70, View.Frame.Width, View.Frame.Height);
                    if (_noreviews == true)
                    {
                        scrollView.ContentSize = new CGSize(View.Frame.Width, Y + 70);
                    }
                    else
                    {
                        scrollView.ContentSize = new CGSize(View.Frame.Width, Y + 20);
                    }
                    if (refresh == true)
                    {
                        //scrollView.ContentSize = new CGSize(UIScreen.MainScreen.Bounds.Width, 70);
                        scrollView.ContentOffset = new CGPoint(0, 300);
                        var tap = new UITapGestureRecognizer {
                            CancelsTouchesInView = false
                        };
                        tap.AddTarget(() =>
                        {
                            scrollView.ContentSize   = new CGSize(View.Frame.Width, Y + 70);
                            scrollView.ContentOffset = new CGPoint(0, 0);
                        });
                    }


                    scrollView.BackgroundColor  = UIColor.White;
                    scrollView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight;
                    //};
                    if (_fav != true)
                    {
                        scrollView.AddSubview(txtWineleft);
                    }
                    //When making it async the Frame.Y is messing up by image Y. So changing it to 70. Ideally it should be 0.
                    //Same will apply to ContentSize.Y
                    View.AddSubview(scrollView);
                    //View.AddSubview(NoReviews);
                    //scrollView.AddSubview(btnBuy);
                    scrollView.AddSubview(lblName);
                    //scrollView.AddSubview(txtWineleft);
                    scrollView.AddSubview(lblVintage);
                    scrollView.AddSubview(btlImage);
                    scrollView.AddSubview(ratingView);
                    scrollView.AddSubview(lblRateTitle);
                    scrollView.AddSubview(lblRateRequest);
                    scrollView.AddSubview(ratingViewSelect);
                    scrollView.AddSubview(starUpLine);
                    scrollView.AddSubview(starDownLine);
                    scrollView.AddSubview(lblDesc);
                    scrollView.AddSubview(lblDescText);
                    scrollView.AddSubview(table);
                    scrollView.AddSubview(lblProducer);
                    scrollView.AddSubview(lblProducerText);
                    scrollView.AddSubview(review);
                    scrollView.AddSubview(NoReviews);
                    //scrollView.
                    BTProgressHUD.Dismiss();
                }
                else
                {
                    BTProgressHUD.Dismiss();
                    UIAlertView alert = new UIAlertView()
                    {
                        Title   = "Sorry",
                        Message = "Something went wrong. We are on it"
                    };

                    alert.AddButton("OK");
                    alert.Show();
                }
            }
            catch (Exception ex)
            {
                LoggingClass.LogError(ex.Message, screen, ex.StackTrace.ToString());
            }
        }
Пример #30
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.View.BackgroundColor = new UIColor(0, 0, 0, 0.8f);

            var lblProducer = new UILabel();

            lblProducer.Frame           = new CGRect(4, 180, View.Frame.Width - 8, 30);
            lblProducer.Text            = "My Tasting";
            lblProducer.BackgroundColor = UIColor.Purple;
            lblProducer.TextAlignment   = UITextAlignment.Center;
            this.View.AddSubview(lblProducer);

            //this.View.Alpha = 0.5f;
            UIButton btnClose = new UIButton(new CGRect(9, 185, 20, 20));

            btnClose.SetBackgroundImage(new UIImage("Close.png"), UIControlState.Normal);
            this.View.AddSubview(btnClose);

            btnClose.TouchUpInside += (sender, e) =>
            {
                //var viewCtrl = NavController.PopViewController(false);
                //viewCtrl.Dispose();
                //NavController.PopToViewController(parent,false);
                NavController.DismissViewController(true, null);
            };

            UIImageView imgBtl = new UIImageView(new CGRect(View.Frame.Width - 64, 149, 60, 60));

            imgBtl.Image = UIImage.FromFile("wine_review.png");
            //imgBtl.BackgroundColor = UIColor.White;
            this.View.AddSubview(imgBtl);

            var lblWhite = new UILabel();

            lblWhite.Frame           = new CGRect(4, 210, View.Frame.Width - 8, 200);
            lblWhite.BackgroundColor = UIColor.White;
            lblWhite.TextAlignment   = UITextAlignment.Center;
            this.View.AddSubview(lblWhite);

            UIButton btnYes    = new UIButton(new CGRect(14, 340, View.Frame.Width - 28, 20));
            UIButton btnCancel = new UIButton(new CGRect(14, 340, View.Frame.Width - 30, 20));

            //btnSave.SetBackgroundImage(new UIImage("Close.png"), UIControlState.Normal);
            btnCancel.SetTitle("Cancel", UIControlState.Normal);
            btnCancel.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
            btnCancel.SetTitleColor(UIColor.Purple, UIControlState.Normal);

            btnYes.SetTitle("Delete", UIControlState.Normal);
            btnYes.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;
            btnYes.SetTitleColor(UIColor.Purple, UIControlState.Normal);

            this.View.AddSubview(btnYes);
            this.View.AddSubview(btnCancel);
            btnCancel.TouchUpInside += (sender, e) =>
            {
                NavController.DismissViewController(true, null);
            };

            btnYes.TouchUpInside += async delegate
            {
                ServiceWrapper sw     = new ServiceWrapper();
                Review         review = new Review();
                review.WineId       = WineId;
                review.ReviewUserId = Convert.ToInt32(CurrentUser.RetreiveUserId());
                ((IPopupParent)parent).RefreshParent();
                await sw.DeleteReview(review);

                //myDialog.Dismiss();
            };
            //btnDelete.TouchDown += async delegate
            //{

            //	review.WineId = WineId;
            //	review.ReviewUserId = Convert.ToInt32(CurrentUser.RetreiveUserId());
            //	await sw.DeleteReview(review);

            //	((IPopupParent)parent).RefreshParent();

            //	NavController.DismissViewController(true, null);
            //Save Service Call.
            //txtComments
            //	BTProgressHUD.ShowSuccessWithStatus("Thank you!!!");
            //};
        }