Exemplo n.º 1
0
 public BasketViewController(Order order)
 {
     this.Title = "Your Basket";
     //This hides the back button text when you leave this View Controller
     this.NavigationItem.BackBarButtonItem = new UIBarButtonItem("", UIBarButtonItemStyle.Plain, handler: null);
     TableView.Source = new TableViewSource(this.order = order)
     {
         RowDeleted = CheckEmpty,
     };
     TableView.SeparatorStyle        = UITableViewCellSeparatorStyle.None;
     TableView.RowHeight             = 75;
     TableView.TableFooterView       = new UIView(new RectangleF(0, 0, 0, BottomButtonView.Height));
     this.View.AddSubview(BottomView = new BottomButtonView()
     {
         ButtonText   = "Checkout",
         ButtonTapped = () => {
             if (Checkout != null)
             {
                 Checkout(this, EventArgs.Empty);
             }
         }
     });
     CheckEmpty(false);
     totalAmount = new UILabel()
     {
         Text          = "$1,000",
         TextColor     = UIColor.White,
         TextAlignment = UITextAlignment.Center,
         Font          = UIFont.BoldSystemFontOfSize(17),
     };
     totalAmount.SizeToFit();
     this.NavigationItem.RightBarButtonItem = new UIBarButtonItem(totalAmount);
     UpdateTotals();
 }
		public BasketViewController (Order order)
		{
			this.Title = "Your Basket";
			//This hides the back button text when you leave this View Controller
			this.NavigationItem.BackBarButtonItem = new UIBarButtonItem ("", UIBarButtonItemStyle.Plain, handler: null);
			TableView.Source = new TableViewSource (this.order = order) {
				RowDeleted = CheckEmpty,
			};
			TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None;
			TableView.RowHeight = 75;
			TableView.TableFooterView = new UIView (new RectangleF (0, 0, 0, BottomButtonView.Height));
			this.View.AddSubview (BottomView = new BottomButtonView () {
				ButtonText = "Checkout",
				ButtonTapped = () => {
					if (Checkout != null)
						Checkout (this, EventArgs.Empty);
				}
			});
			CheckEmpty (false);
			totalAmount = new UILabel () {
				Text = "$1,000",
				TextColor = UIColor.White,
				TextAlignment = UITextAlignment.Center,
				Font = UIFont.BoldSystemFontOfSize (17),
			};
			totalAmount.SizeToFit ();
			this.NavigationItem.RightBarButtonItem = new UIBarButtonItem (totalAmount);
			UpdateTotals ();
		}
		public ShippingAddressViewController (User user)
		{
			Title = "Shipping";
			//This hides the back button text when you leave this View Controller
			NavigationItem.BackBarButtonItem = new UIBarButtonItem ("", UIBarButtonItemStyle.Plain, handler: null);
			this.user = user;
			TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None;


			Cells.Add (new CustomViewCell (FirstNameField = new TextEntryView {
				PlaceHolder = "First Name",
				Value = user.FirstName,
			}));

			Cells.Add (new CustomViewCell (LastNameField = new TextEntryView {
				PlaceHolder = "Last Name",
				Value = user.LastName,
			}));

			Cells.Add (new CustomViewCell (PhoneNumberField = new TextEntryView {
				PlaceHolder = "Phone Number",
				Value = user.Phone,
				KeyboardType = UIKeyboardType.NumberPad,
			}));

			Cells.Add (new CustomViewCell (AddressField = new TextEntryView {
				PlaceHolder = "Address",
				Value = user.Address,
				AutocapitalizationType = UITextAutocapitalizationType.Words,
			}));

			Cells.Add (new CustomViewCell (Address2Field = new TextEntryView {
				PlaceHolder = "Address",
				Value = user.Address2,
				AutocapitalizationType = UITextAutocapitalizationType.Words,
			}));
			Cells.Add (new CustomViewCell (CityField = new TextEntryView {
				PlaceHolder = "City",
				Value = user.City,
				AutocapitalizationType = UITextAutocapitalizationType.Words,
			}));

			Cells.Add (new CustomViewCell (PostalField = new TextEntryView {
				PlaceHolder = "Postal Code",
				Value = user.ZipCode,
				KeyboardType = UIKeyboardType.NumbersAndPunctuation,
			}));

			Cells.Add (new CustomViewCell (CountryField = new AutoCompleteTextEntry {
				PlaceHolder = "Country",
				Title = "Select your Country",
				Value = user.Country,
				ValueChanged = (v) => GetStates (),
				PresenterView = this,
			}));

			Cells.Add (new CustomViewCell (StateField = new AutoCompleteTextEntry {
				PlaceHolder = "State",
				Value = user.State,
				Title = "Select your state",
				PresenterView = this,
			}));


			GetCountries ();
			GetStates ();

			TableView.Source = new ShippingAddressPageSource { Cells = Cells };
			TableView.TableFooterView = new UIView (new RectangleF (0, 0, 0, BottomButtonView.Height));
			TableView.ReloadData ();

			View.AddSubview (BottomView = new BottomButtonView () {
				ButtonText = "Place Order",
				ButtonTapped = PlaceOrder,
			});

		}
        public ShippingAddressViewController(User user)
        {
            this.Title = "Shipping";
            //This hides the back button text when you leave this View Controller
            this.NavigationItem.BackBarButtonItem = new UIBarButtonItem("", UIBarButtonItemStyle.Plain, handler: null);
            this.user = user;
            TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None;


            Cells.Add(new CustomViewCell(FirstNameField = new TextEntryView {
                PlaceHolder = "First Name",
                Value       = user.FirstName,
            }));

            Cells.Add(new CustomViewCell(LastNameField = new TextEntryView {
                PlaceHolder = "Last Name",
                Value       = user.LastName,
            }));

            Cells.Add(new CustomViewCell(PhoneNumberField = new TextEntryView {
                PlaceHolder  = "Phone Number",
                Value        = user.Phone,
                KeyboardType = UIKeyboardType.NumberPad,
            }));

            Cells.Add(new CustomViewCell(AddressField = new TextEntryView {
                PlaceHolder            = "Address",
                Value                  = user.Address,
                AutocapitalizationType = UITextAutocapitalizationType.Words,
            }));

            Cells.Add(new CustomViewCell(Address2Field = new TextEntryView {
                PlaceHolder            = "Address",
                Value                  = user.Address2,
                AutocapitalizationType = UITextAutocapitalizationType.Words,
            }));
            Cells.Add(new CustomViewCell(CityField = new TextEntryView {
                PlaceHolder            = "City",
                Value                  = user.City,
                AutocapitalizationType = UITextAutocapitalizationType.Words,
            }));

            Cells.Add(new CustomViewCell(PostalField = new TextEntryView {
                PlaceHolder  = "Postal Code",
                Value        = user.ZipCode,
                KeyboardType = UIKeyboardType.NumbersAndPunctuation,
            }));

            Cells.Add(new CustomViewCell(CountryField = new AutoCompleteTextEntry {
                PlaceHolder   = "Country",
                Title         = "Select your Country",
                Value         = user.Country,
                ValueChanged  = (v) => GetStates(),
                PresenterView = this,
            }));

            Cells.Add(new CustomViewCell(StateField = new AutoCompleteTextEntry {
                PlaceHolder   = "State",
                Value         = user.State,
                Title         = "Select your state",
                PresenterView = this,
            }));


            GetCountries();
            GetStates();

            TableView.Source = new ShippingAddressPageSource {
                Cells = Cells
            };
            TableView.TableFooterView = new UIView(new RectangleF(0, 0, 0, BottomButtonView.Height));
            TableView.ReloadData();

            View.AddSubview(BottomView = new BottomButtonView()
            {
                ButtonText   = "Place Order",
                ButtonTapped = PlaceOrder,
            });
        }