示例#1
0
        private void configureMarital()
        {
            if (maritalConfigured == true)
            {
                return;
            }

            var groupKey = new SfRadioGroupKey();

            var translator = new TranslateExtension();

            translator.Text = "EnumMaritalSingle";

            this.singleRadio = new SfRadioButton {
                Text = (string)translator.ProvideValue(null)
            };
            singleRadio.GroupKey = groupKey;

            translator.Text   = "EnumMaritalMarried";
            this.marriedRadio = new SfRadioButton {
                Text = (string)translator.ProvideValue(null)
            };
            marriedRadio.GroupKey = groupKey;

            translator.Text    = "EnumMaritalDivorced";
            this.divorcedRadio = new SfRadioButton {
                Text = (string)translator.ProvideValue(null)
            };
            divorcedRadio.GroupKey = groupKey;

            translator.Text = "EnumMaritaWidow";
            this.widowRadio = new SfRadioButton {
                Text = (string)translator.ProvideValue(null)
            };
            widowRadio.GroupKey = groupKey;


            //var flex = new FlexLayout();
            flex.Wrap           = FlexWrap.Wrap;
            flex.Direction      = FlexDirection.Row;
            flex.JustifyContent = FlexJustify.SpaceBetween;

            flex.Children.Add(singleRadio);
            flex.Children.Add(marriedRadio);
            flex.Children.Add(divorcedRadio);
            flex.Children.Add(widowRadio);

            var context = registerTbView.BindingContext as SignUpPageViewModel;

            maritalConfigured = true;

            if (context == null)
            {
                return;
            }

            widowRadio.IsChecked     = context.Marital == Backend.Core.Types.MaritalStatus.Widow;
            widowRadio.StateChanged += (src, arg) =>
            {
                if (widowRadio.IsChecked == true)
                {
                    context.Marital = Backend.Core.Types.MaritalStatus.Widow;
                }
            };

            divorcedRadio.IsChecked     = context.Marital == Backend.Core.Types.MaritalStatus.Divorced;
            divorcedRadio.StateChanged += (src, arg) =>
            {
                if (divorcedRadio.IsChecked == true)
                {
                    context.Marital = Backend.Core.Types.MaritalStatus.Divorced;
                }
            };

            marriedRadio.IsChecked     = context.Marital == Backend.Core.Types.MaritalStatus.Married;
            marriedRadio.StateChanged += (src, arg) =>
            {
                if (marriedRadio.IsChecked == true)
                {
                    context.Marital = Backend.Core.Types.MaritalStatus.Married;
                }
            };

            singleRadio.IsChecked     = context.Marital == Backend.Core.Types.MaritalStatus.Single;
            singleRadio.StateChanged += (src, arg) =>
            {
                if (singleRadio.IsChecked == true)
                {
                    context.Marital = Backend.Core.Types.MaritalStatus.Single;
                }
            };
        }
        private void InitializeBase()
        {
            // ChildForm child_form = new ChildForm();
            // OnAppearing();
            // radiogroupLayout = new StackLayout();
            habit_      = null;
            habit_data  = null;
            all_content = new StackLayout();
            Base_Stack.Children.Insert(1, all_content);

            child_form = new One_Time();
            Variable_Content.Content = child_form.Content;
            SfRadioGroupKey radioGroup = new SfRadioGroupKey();
            SfRadioButton   one_time   = new SfRadioButton();

            one_time.IsChecked                 = true;
            one_time.Text                      = "One Time";
            nameEntry                          = new Entry();
            nameEntry.Placeholder              = "I made the decision to";
            radiogrouplayout                   = new StackLayout();
            radiogrouplayout.Orientation       = Xamarin.Forms.StackOrientation.Horizontal;
            radiogroupLayout.HorizontalOptions = Xamarin.Forms.LayoutOptions.FillAndExpand;
            all_content.Children.Insert(0, nameEntry);
            all_content.Children.Insert(1, radiogroupLayout);


            SfRadioButton recurring = new SfRadioButton();

            recurring.Text = "Recurring";
            SfRadioButton bulk = new SfRadioButton();

            bulk.Text = "Bulk Purchase";

            one_time.GroupKey                  = radioGroup;
            recurring.GroupKey                 = radioGroup;
            bulk.GroupKey                      = radioGroup;
            bulk.HorizontalOptions             = Xamarin.Forms.LayoutOptions.FillAndExpand;
            radiogroupLayout.HorizontalOptions = Xamarin.Forms.LayoutOptions.FillAndExpand;
            radiogroupLayout.Children.Add(one_time);
            radiogroupLayout.Children.Add(recurring);
            radiogroupLayout.Children.Add(bulk);
            radiogroupcontrollers = new Dictionary <string, SfRadioButton> {
            };
            foreach (SfRadioButton child in radiogroupLayout.Children)
            {
                radiogroupcontrollers[child.Text] = child;
            }
            radiogroupLayout.HorizontalOptions = Xamarin.Forms.LayoutOptions.FillAndExpand;
            one_time.StateChanged  += RadioButton_StateChanged;
            recurring.StateChanged += RadioButton_StateChanged;
            bulk.StateChanged      += RadioButton_StateChanged;
            nameEntry.Text          = string.Empty;
            typePicker.IsVisible    = false;


            moneySaved.TextChanged += let_refresh;
            nameEntry.TextChanged  += let_refresh;
            this.set_helper();


            //Add_stash.Clicked += btnPopupButton_Clicked;
            //child_form.refresh();
        }