Inheritance: MonoBehaviour
示例#1
0
        /// <summary>
        /// Returns a new field set with legend for a new settings group
        /// </summary>
        /// <param name="currentItem">
        /// The settings item
        /// </param>
        /// <returns>
        /// Fieldset control
        /// </returns>
        private static HtmlGenericControl CreateNewFieldSet(ISettingItem currentItem)
        {
            // start a new fieldset
            var fieldset = new HtmlGenericControl("fieldset");
            fieldset.Attributes.Add(
                "class", string.Concat("SettingsTableGroup ", currentItem.Group.ToString().ToLower()));

            // create group legend
            var legend = new HtmlGenericControl("legend");
            legend.Attributes.Add("class", "SubSubHead");
            var legendText = new Localize
                {
                   TextKey = currentItem.Group.ToString(), Text = currentItem.GroupDescription
                };
            legend.Controls.Add(legendText);
            fieldset.Controls.Add(legend);

            return fieldset;
        }
示例#2
0
 public void SetGerman()
 {
     Localize.SetCurrentLanguage(SystemLanguage.German);
     SaveInfo.SetLang(SystemLanguage.German);
 }
示例#3
0
 public void SetEnglish()
 {
     Localize.SetCurrentLanguage(SystemLanguage.English);
     SaveInfo.SetLang(SystemLanguage.English);
 }
示例#4
0
        public override async void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.FromRGB(242, 242, 242);

            var paymentSettings = await Mvx.Resolve <IPaymentService>().GetPaymentSettings();

            _payPalSettings = paymentSettings.PayPalClientSettings;

            lblInstructions.Text = Localize.GetValue("CreditCardInstructions");

            if (!ViewModel.CanChooseTip)
            {
                viewTip.RemoveFromSuperview();
            }
            else
            {
                ConfigureTipSection();
            }

            if (!ViewModel.CanChooseLabel)
            {
                viewLabel.RemoveFromSuperview();
            }
            else
            {
                ConfigureLabelSection();
            }

            if (!ViewModel.ShowInstructions)
            {
                lblInstructions.RemoveFromSuperview();
            }

            if (!ViewModel.IsPayPalOnly)
            {
                ConfigureCreditCardSection();
            }
            else
            {
                viewCreditCard.RemoveFromSuperview();
            }

            if (PayPalIsEnabled)
            {
                ConfigurePayPalSection();
            }
            else
            {
                viewPayPal.RemoveFromSuperview();
            }

            if (ViewModel.PaymentSettings.EnableAddressVerification)
            {
                lblStreetName.Text   = Localize.GetValue("CreditCardAdd_StreetNameLabel");
                lblStreetNumber.Text = Localize.GetValue("CreditCardAdd_StreetNumberLabel");

                txtStreetName.Placeholder          = Localize.GetValue("CreditCardAdd_StreetNameLabel");
                txtStreetName.AccessibilityLabel   = txtStreetName.Placeholder;
                txtStreetNumber.Placeholder        = Localize.GetValue("CreditCardAdd_StreetNumberLabel");
                txtStreetNumber.AccessibilityLabel = txtStreetNumber.Placeholder;
                lblEmail.Text       = Localize.GetValue("EmailLabel");
                lblPhoneNumber.Text = Localize.GetValue("PassengerPhoneLabel");

                txtEmail.Placeholder              = Localize.GetValue("RideSettingsEmailTitle");
                txtEmail.AccessibilityLabel       = txtEmail.Placeholder;
                txtPhoneNumber.Placeholder        = Localize.GetValue("RideSettingsPhone");
                txtPhoneNumber.AccessibilityLabel = txtPhoneNumber.Placeholder;

                lblCountryCode.Configure(NavigationController, ViewModel.SelectedCountryCode, countryCode => ViewModel.SelectedCountryCode = countryCode);
                lblCountryCode.Font                      = UIFont.FromName(FontName.HelveticaNeueLight, 38 / 2);
                lblCountryCode.TintColor                 = UIColor.Black;
                lblCountryCode.TextColor                 = UIColor.FromRGB(44, 44, 44);
                lblCountryCode.TextAlignment             = UITextAlignment.Center;
                lblCountryCode.AdjustsFontSizeToFitWidth = true;
                lblCountryCode.BackgroundColor           = UIColor.White;
            }
            else
            {
                lblStreetName.RemoveFromSuperview();
                lblStreetNumber.RemoveFromSuperview();
                lblEmail.RemoveFromSuperview();
                lblPhoneNumber.RemoveFromSuperview();
            }

            var set = this.CreateBindingSet <CreditCardAddView, CreditCardAddViewModel>();

            set.Bind(btnSaveCard)
            .For("Title")
            .To(vm => vm.CreditCardSaveButtonDisplay);

            set.Bind(txtCvv)
            .For("HiddenEx")
            .To(vm => vm.IsAddingNewCard)
            .WithConversion("BoolInverter");

            set.Bind(lblCvv)
            .For("HiddenEx")
            .To(vm => vm.IsAddingNewCard)
            .WithConversion("BoolInverter");

            set.Bind(btnSaveCard)
            .For("TouchUpInside")
            .To(vm => vm.SaveCreditCardCommand);

            set.Bind(btnDeleteCard)
            .For("TouchUpInside")
            .To(vm => vm.DeleteCreditCardCommand);

            set.Bind(btnDeleteCard)
            .For("HiddenEx")
            .To(vm => vm.CanDeleteCreditCard)
            .WithConversion("BoolInverter");

            set.Bind(btnCardDefault)
            .For("TouchUpInside")
            .To(vm => vm.SetAsDefault);

            set.Bind(btnCardDefault)
            .For("HiddenEx")
            .To(vm => vm.CanSetCreditCardAsDefault)
            .WithConversion("BoolInverter");

            set.Bind(btnScanCard)
            .For("HiddenEx")
            .To(vm => vm.CanScanCreditCard)
            .WithConversion("BoolInverter");

            set.Bind(txtNameOnCard)
            .For(v => v.Text)
            .To(vm => vm.Data.NameOnCard);

            set.Bind(txtNameOnCard)
            .For(v => v.Enabled)
            .To(vm => vm.IsAddingNewCard);

            set.Bind(txtZipCode)
            .For(v => v.Text)
            .To(vm => vm.Data.ZipCode);

            set.Bind(txtZipCode)
            .For(v => v.Enabled)
            .To(vm => vm.IsAddingNewCard);

            set.Bind(txtCardNumber)
            .For(v => v.Text)
            .To(vm => vm.CreditCardNumber);

            set.Bind(txtCardNumber)
            .For(v => v.ImageLeftSource)
            .To(vm => vm.CreditCardImagePath);

            set.Bind(txtCardNumber)
            .For(v => v.Enabled)
            .To(vm => vm.IsAddingNewCard);

            set.Bind(txtExpMonth)
            .For(v => v.Text)
            .To(vm => vm.ExpirationMonthDisplay);

            set.Bind(txtExpMonth)
            .For(v => v.Enabled)
            .To(vm => vm.IsAddingNewCard);

            set.Bind(txtExpMonth)
            .For(v => v.HasRightArrow)
            .To(vm => vm.IsAddingNewCard);

            set.Bind(txtExpYear)
            .For(v => v.Text)
            .To(vm => vm.ExpirationYearDisplay);

            set.Bind(txtExpYear)
            .For(v => v.Enabled)
            .To(vm => vm.IsAddingNewCard);

            set.Bind(txtExpYear)
            .For(v => v.HasRightArrow)
            .To(vm => vm.IsAddingNewCard);

            set.Bind(txtCvv)
            .For(v => v.Text)
            .To(vm => vm.Data.CCV);

            set.Bind(txtCvv)
            .For(v => v.Enabled)
            .To(vm => vm.IsAddingNewCard);

            set.Bind(txtEmail)
            .For(v => v.Enabled)
            .To(vm => vm.IsAddingNewCard);

            set.Bind(txtPhoneNumber)
            .For(v => v.Enabled)
            .To(vm => vm.IsAddingNewCard);

            set.Bind(lblCountryCode)
            .For(v => v.Enabled)
            .To(vm => vm.IsAddingNewCard);

            set.Bind(txtStreetName)
            .For(v => v.Enabled)
            .To(vm => vm.IsAddingNewCard);

            set.Bind(txtStreetNumber)
            .For(v => v.Enabled)
            .To(vm => vm.IsAddingNewCard);

            set.Bind(btnLinkPayPal)
            .For(v => v.Hidden)
            .To(vm => vm.CanLinkPayPalAccount)
            .WithConversion("BoolInverter");

            set.Bind(btnUnlinkPayPal)
            .For(v => v.Hidden)
            .To(vm => vm.CanUnlinkPayPalAccount)
            .WithConversion("BoolInverter");

            set.Bind(viewPayPalIsLinkedInfo)
            .For(v => v.Hidden)
            .To(vm => vm.ShowLinkedPayPalInfo)
            .WithConversion("BoolInverter");

            set.Bind(txtTip)
            .For(v => v.Text)
            .To(vm => vm.PaymentPreferences.TipAmount);

            set.Bind(imgVisa)
            .For(v => v.HiddenWithConstraints)
            .To(vm => vm.PaymentSettings.DisableVisaMastercard);

            set.Bind(imgAmex)
            .For(v => v.HiddenWithConstraints)
            .To(vm => vm.PaymentSettings.DisableAMEX);

            set.Bind(lblCountryCode)
            .For(v => v.SelectedCountryCode)
            .To(vm => vm.SelectedCountryCode);

            set.Bind(txtLabel)
            .For(v => v.Text)
            .To(vm => vm.Data.Label);

            set.Bind(imgDiscover)
            .For(v => v.HiddenWithConstraints)
            .To(vm => vm.PaymentSettings.DisableDiscover);

            set.Bind(txtStreetName)
            .For("HiddenEx")
            .To(vm => vm.PaymentSettings.EnableAddressVerification)
            .WithConversion("BoolInverter");

            set.Bind(txtStreetNumber)
            .For("HiddenEx")
            .To(vm => vm.PaymentSettings.EnableAddressVerification)
            .WithConversion("BoolInverter");

            set.Bind(txtStreetName)
            .To(vm => vm.Data.StreetName);

            set.Bind(txtStreetNumber)
            .To(vm => vm.Data.StreetNumber);

            set.Bind(txtEmail)
            .For("HiddenEx")
            .To(vm => vm.PaymentSettings.EnableAddressVerification)
            .WithConversion("BoolInverter");

            set.Bind(txtPhoneNumber)
            .For("HiddenEx")
            .To(vm => vm.PaymentSettings.EnableAddressVerification)
            .WithConversion("BoolInverter");

            set.Bind(txtEmail)
            .To(vm => vm.Data.Email);

            set.Bind(txtPhoneNumber)
            .To(vm => vm.Data.Phone);

            set.Apply();

            txtNameOnCard.ShouldReturn += GoToNext;
        }
示例#5
0
 protected virtual void Error(bool inverted, IEnumerable <MatchType> expected)
 {
     Error(0, Localize.From("'{0}': expected {1}", ToString(LA0Int), ToString(inverted, expected)));
 }
示例#6
0
 public override void LoadMyComponent()
 {
     base.LoadMyComponent();
     loadingTextDots = GetComponent <Text>();
     myLocalization  = GetComponent <Localize>();
 }
示例#7
0
 private void ConfigureLabelSection()
 {
     lblLabel.Text      = Localize.GetValue("PaymentDetails.LabelName");
     txtLabel.MaxLength = 40;
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            btnMenu.SetImage(UIImage.FromFile("menu_icon.png"), UIControlState.Normal);

            btnLocateMe.SetImage(UIImage.FromFile("location_icon.png"), UIControlState.Normal);

            _datePicker = new BookLaterDatePicker();
            _datePicker.UpdateView(UIScreen.MainScreen.Bounds.Height, UIScreen.MainScreen.Bounds.Width);
            _datePicker.Hide();
            View.AddSubview(_datePicker);

            panelMenu.ViewToAnimate         = homeView;
            panelMenu.PanelOffsetConstraint = constraintHomeLeadingSpace;
            btnMenu.AccessibilityLabel      = Localize.GetValue("MenuButton");
            btnLocateMe.AccessibilityLabel  = Localize.GetValue("LocateMeButton");
            btnAirport.AccessibilityLabel   = Localize.GetValue("AirportsButton");
            btnTrain.AccessibilityLabel     = Localize.GetValue("TrainStationsButton");

            var set = this.CreateBindingSet <HomeView, HomeViewModel>();

            set.Bind(panelMenu)
            .For(v => v.DataContext)
            .To(vm => vm.Panel);

            set.Bind(btnMenu)
            .For(v => v.Command)
            .To(vm => vm.Panel.OpenOrCloseMenu);

            set.Bind(btnMenu)
            .For(v => v.Hidden)
            .To(vm => vm.CurrentViewState)
            .WithConversion("EnumToBool", new[] { HomeViewModelState.BookingStatus, HomeViewModelState.ManualRidelinq });

            set.Bind(btnAirport)
            .For(v => v.Command)
            .To(vm => vm.AirportSearch);

            set.Bind(btnAirport)
            .For(v => v.Hidden)
            .To(vm => vm.IsAirportButtonHidden);

            set.Bind(btnTrain)
            .For(v => v.Command)
            .To(vm => vm.TrainStationSearch);

            set.Bind(btnTrain)
            .For(v => v.Hidden)
            .To(vm => vm.IsTrainButtonHidden);

            set.Bind(btnLocateMe)
            .For(v => v.Command)
            .To(vm => vm.LocateMe);

            set.Bind(btnLocateMe)
            .For(v => v.Hidden)
            .To(vm => vm.CurrentViewState)
            .WithConversion("EnumToBool", new[] { HomeViewModelState.BookingStatus, HomeViewModelState.ManualRidelinq });

            set.Bind(mapView)
            .For(v => v.DataContext)
            .To(vm => vm.Map);

            set.Bind(ctrlOrderOptions)
            .For(v => v.DataContext)
            .To(vm => vm.OrderOptions);

            set.Bind(ctrlDropOffSelection)
            .For(v => v.DataContext)
            .To(vm => vm.DropOffSelection);

            set.Bind(ctrlAddressPicker)
            .For(v => v.DataContext)
            .To(vm => vm.AddressPicker);

            set.Bind(ctrlOrderReview)
            .For(v => v.DataContext)
            .To(vm => vm.OrderReview);

            set.Bind(orderEdit)
            .For(v => v.DataContext)
            .To(vm => vm.OrderEdit);

            set.Bind(orderAirport)
            .For(v => v.DataContext)
            .To(vm => vm.OrderAirport);

            set.Bind(bottomBar)
            .For(v => v.DataContext)
            .To(vm => vm);

            set.Bind(_datePicker)
            .For(v => v.DataContext)
            .To(vm => vm.BottomBar);

            set.Bind(ctrlOrderBookingOptions)
            .For(v => v.DataContext)
            .To(vm => vm.BottomBar);

            set.Bind()
            .For(v => v.HomeViewState)
            .To(vm => vm.CurrentViewState);

            #region BookingStatus

            set.Bind(mapView)
            .For(v => v.MapCenter)
            .To(vm => vm.BookingStatus.MapCenter);

            set.Bind(bookingStatusControl)
            .For(v => v.DataContext)
            .To(vm => vm.BookingStatus);

            set.Bind(mapView)
            .For(v => v.OrderStatusDetail)
            .To(vm => vm.BookingStatus.OrderStatusDetail);

            set.Bind(contactTaxiControl)
            .For(v => v.DataContext)
            .To(vm => vm.BookingStatus);

            set.Bind(changeDropOffControl)
            .For(v => v.DataContext)
            .To(vm => vm.BookingStatus);

            set.Bind(mapView)
            .For(v => v.TaxiLocation)
            .To(vm => vm.BookingStatus.TaxiLocation);

            set.Bind(mapView)
            .For(v => v.CancelAutoFollow)
            .To(vm => vm.BookingStatus.CancelAutoFollow);

            mapView.OverlayOffsetProvider = GetOverlayOffset;

            #endregion

            set.Apply();
        }
示例#9
0
        public void OnDialCodeSelectorClick()
        {
            if (!Enabled)
            {
                return;
            }

            var section = new Section();

            foreach (var countryCode in CountryCode.CountryCodes)
            {
                // this is to generate spaces between dial code number field and country name to align country name in one column
                // the first column has different size between 0 and 4 characters (1 char for "+" and 3 for country dial code), according
                // to width of this first column the code inserts additional spaces to align second column (country names) vertically
                // in currently used font one caracter (A-Z a-z) equals to 2 spaces in its width

                var prefixSpacing = new string(' ', (Math.Max(3 - countryCode.CountryDialCode.ToString().Length, 0)) * 2);
                var text          = countryCode.CountryDialCode != 0
                  ? $"{prefixSpacing}+{countryCode.CountryDialCode} {countryCode.CountryName}"
                  : $"         {countryCode.CountryName}";

                var item = new RadioElementWithId <CountryCode>(countryCode, text, null, false, 15);

                item.Tapped += () =>
                {
                    SelectedCountryCode = countryCode;

                    if (OnDialCodeChanged != null)
                    {
                        OnDialCodeChanged(_selectedCountryCode);
                    }

                    if (NotifyChanges != null)
                    {
                        NotifyChanges(null, new PhoneNumberChangedEventArgs()
                        {
                            Country = _selectedCountryCode.CountryISOCode
                        });
                    }
                };

                section.Add(item);
            }

            var rootElement = new RootElement(Localize.GetValue("DialCodeSelectorTitle"), new RadioGroup(CountryCode.GetCountryCodeIndexByCountryISOCode(SelectedCountryCode.CountryISOCode)));

            rootElement.Add(section);

            var dialCodeSelectorViewController = new TaxiHailDialogViewController(rootElement, true, false, 34);

            _navigationController.NavigationBar.Hidden             = false;
            _navigationController.NavigationItem.BackBarButtonItem = new UIBarButtonItem(Localize.GetValue("BackButton"), UIBarButtonItemStyle.Bordered, null, null);
            _navigationController.PushViewController(dialCodeSelectorViewController, true);
        }
示例#10
0
 public override void LoadMyComponent()
 {
     base.LoadMyComponent();
     myLocalization = GetComponent <Localize>();
 }
示例#11
0
        private void CreateSearchView(View view)
        {
            var searchViewLayout  = this.BindingInflate(Resource.Layout._template_search_view, null, false);
            var searchTextView    = searchViewLayout.FindViewById <Android.Widget.EditText>(Resource.Id.search_text);
            var searchCloseButton = searchViewLayout.FindViewById <Android.Widget.ImageButton>(Resource.Id.search_close_imageButton);
            var searchStartButton = searchViewLayout.FindViewById <Android.Widget.ImageButton>(Resource.Id.search_start_imageButton);

            searchTextView.Hint = Localize.GetText("LogsViewModel.Placeholders.Search");

            searchTextView.TextChanged += (sender, args) =>
            {
                ViewModel.SearchLine = searchTextView.Text;
            };

            searchCloseButton.Click += (sender, args) =>
            {
                ViewModel.SearchLine = searchTextView.Text = "";
                ViewModel.SearchHide = !ViewModel.SearchHide;

                if (searchViewLayout.LayoutParameters is Toolbar.LayoutParams parameters)
                {
                    parameters.Width   = ViewGroup.LayoutParams.WrapContent;
                    parameters.Height  = ViewGroup.LayoutParams.MatchParent;
                    parameters.Gravity = (int)GravityFlags.End;
                    searchViewLayout.LayoutParameters = parameters;
                }
            };

            searchStartButton.Click += (sender, args) =>
            {
                ViewModel.SearchHide = !ViewModel.SearchHide;

                var imm = Context.GetSystemService(Android.Content.Context.InputMethodService) as InputMethodManager;

                searchTextView.FocusChange += (sender, args) =>
                {
                    if (args.HasFocus)
                    {
                        return;
                    }
                    imm?.HideSoftInputFromWindow(view.WindowToken, HideSoftInputFlags.None);
                };

                searchTextView.RequestFocus();
                imm?.ToggleSoftInput(ShowFlags.Forced, HideSoftInputFlags.ImplicitOnly);

                if (searchViewLayout.LayoutParameters is Toolbar.LayoutParams parameters)
                {
                    parameters.Width  = ViewGroup.LayoutParams.MatchParent;
                    parameters.Height = ViewGroup.LayoutParams.MatchParent;
                    searchViewLayout.LayoutParameters = parameters;
                }
            };

            view.FindViewById <Toolbar>(Resource.Id.log_toolbar).AddView(searchViewLayout);

            if (searchViewLayout.LayoutParameters is Toolbar.LayoutParams parameters)
            {
                parameters.Width   = ViewGroup.LayoutParams.WrapContent;
                parameters.Height  = ViewGroup.LayoutParams.MatchParent;
                parameters.Gravity = (int)GravityFlags.End;
                searchViewLayout.LayoutParameters = parameters;
            }
        }
示例#12
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.FromRGB(242, 242, 242);

            tblPromotions.BackgroundView = new UIView {
                BackgroundColor = UIColor.Clear
            };
            tblPromotions.BackgroundColor      = UIColor.Clear;
            tblPromotions.SeparatorColor       = UIColor.Clear;
            tblPromotions.SeparatorStyle       = UITableViewCellSeparatorStyle.None;
            tblPromotions.DelaysContentTouches = false;

            lblInstruction.TextAlignment = UITextAlignment.Center;

            lblNoPromotions.Text   = Localize.GetValue("PromotionViewNoPromotionLabel");
            lblNoPromotions.Hidden = true;

            txtPromoCode.Placeholder     = Localize.GetValue("PromoCodeLabel");
            txtPromoCode.BackgroundColor = UIColor.FromRGB(229, 229, 229);

            FlatButtonStyle.Silver.ApplyTo(btnApplyPromo);
            btnApplyPromo.Font = UIFont.FromName(FontName.HelveticaNeueRegular, 28 / 2);
            btnApplyPromo.SetTitle(Localize.GetValue("PromoApply"), UIControlState.Normal);

            FlatButtonStyle.Silver.ApplyTo(btnAddPayment);
            btnAddPayment.SetTitle(Localize.GetValue("AddPaymentMethod"), UIControlState.Normal);

            var tableViewSource = new PromotionTableViewSource(tblPromotions);

            tblPromotions.Source = tableViewSource;

            var set = this.CreateBindingSet <PromotionView, PromotionViewModel> ();

            set.Bind(tblPromotions)
            .For("Visibility")
            .To(vm => vm.ActivePromotions)
            .WithConversion("Visibility");

            set.Bind(btnAddPayment)
            .For("Title")
            .To(vm => vm.AddPaymentMethodButtonTitle);

            set.Bind(btnAddPayment)
            .For("TouchUpInside")
            .To(vm => vm.ToPayment);

            set.Bind(btnAddPayment)
            .For("HiddenEx")
            .To(vm => vm.HasValidPaymentInformation);

            set.Bind(lblNoPromotions)
            .For("Visibility")
            .To(vm => vm.ActivePromotions)
            .WithConversion("NoValueToVisibility");

            set.Bind(lblInstruction)
            .To(vm => vm.PromoRequiresPaymentMethodText);

            set.Bind(tableViewSource)
            .For(v => v.ItemsSource)
            .To(vm => vm.ActivePromotions);

            set.Bind(txtPromoCode)
            .For(v => v.Text)
            .To(vm => vm.PromotionCode);

            set.Bind(btnApplyPromo)
            .For("TouchUpInside")
            .To(vm => vm.ApplyPromotion);

            set.Apply();
        }