Exemple #1
0
        public void SetChallenge(ChallengeViewModel model)
        {
            Model = model;
            ItemView.FindViewById <TextView>(Resource.Id.challenge_days_left).Text         = $"{dayString} {model.DaysLeft}";
            ItemView.FindViewById <TextView>(Resource.Id.challenge_description).Text       = model.Desciption;
            ItemView.FindViewById <TextView>(Resource.Id.challenge_total_repetitions).Text = model.TotalRepetitions.ToString();


            monday    = ItemView.FindViewById <CustomToggleButton>(Resource.Id.monday);
            tuesday   = ItemView.FindViewById <CustomToggleButton>(Resource.Id.tuesday);
            wednesday = ItemView.FindViewById <CustomToggleButton>(Resource.Id.wednesday);
            thursday  = ItemView.FindViewById <CustomToggleButton>(Resource.Id.thursday);
            friday    = ItemView.FindViewById <CustomToggleButton>(Resource.Id.friday);
            saturday  = ItemView.FindViewById <CustomToggleButton>(Resource.Id.saturday);
            sunday    = ItemView.FindViewById <CustomToggleButton>(Resource.Id.sunday);

            SetSelectedWeekdays(model);
            SetMeasurements(model.Measurements);
        }
Exemple #2
0
        ///-------------------------------------------------------------------------
        /// <summary>起動処理</summary>
        ///-------------------------------------------------------------------------
        override public void Awake()
        {
            try
            {
                // ウィンドウスタイル
                this.windowStyle                               = new GUIStyle("box");
                this.windowStyle.alignment                     = TextAnchor.UpperLeft;
                this.windowStyle.normal.textColor              = this.windowStyle.onNormal.textColor =
                    this.windowStyle.hover.textColor           = this.windowStyle.onHover.textColor =
                        this.windowStyle.active.textColor      = this.windowStyle.onActive.textColor =
                            this.windowStyle.focused.textColor = this.windowStyle.onFocused.textColor = Color.white;

                // エフェクト設定トグルボタン
                this.effectSettingButton                 = new CustomToggleButton(false);
                this.effectSettingButton.FontSize        = this.FontSize;
                this.effectSettingButton.Text            = Translation.GetText("UI", "effectSetting");
                this.effectSettingButton.CheckedChanged += this.EffectSettingButton_CheckedChanged;

                // 環境設定トグルボタン
                this.envSettingButton                 = new CustomToggleButton(false);
                this.envSettingButton.FontSize        = this.FontSize;
                this.envSettingButton.Text            = Translation.GetText("UI", "envSetting");
                this.envSettingButton.CheckedChanged += this.EnvSettingButton_CheckedChanged;

                // データ設定トグルボタン
                this.dataSettingButton                 = new CustomToggleButton(false);
                this.dataSettingButton.FontSize        = this.FontSize;
                this.dataSettingButton.Text            = Translation.GetText("UI", "dataSetting");
                this.dataSettingButton.CheckedChanged += this.DataSettingButton_CheckedChanged;

                CustomToggleButton.SetPairButton(this.effectSettingButton, this.envSettingButton);
            }
            catch (Exception e)
            {
                Debug.LogError(e.ToString());
            }
        }
        protected override View ConstructPageView()
        {
            var stackLayout = FormsUtils.GetExpandingStackLayout();

            stackLayout.VerticalOptions = LayoutOptions.Start;

            var whatLabel = new Label
            {
                Text   = "I Am A:",
                Margin = new Thickness(0, 10, 0, 0),
                HorizontalTextAlignment = TextAlignment.Center,
                FontSize  = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                TextColor = Color.Gray
            };

            stackLayout.Children.Add(whatLabel);
            var whatAmILabel = FormsUtils.GetSimpleLabel(labelBindingPropertyName: nameof(IAnimalViewModelBase.WhatAmI), fontNamedSize: NamedSize.Large, fontAttributes: FontAttributes.Bold);

            whatAmILabel.HorizontalOptions = LayoutOptions.Center;
            stackLayout.Children.Add(whatAmILabel);

            var eatLabel = new Label
            {
                Text   = "I Like To Eat:",
                Margin = new Thickness(0, 10, 0, 0),
                HorizontalTextAlignment = TextAlignment.Center,
                FontSize  = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                TextColor = Color.Gray
            };

            stackLayout.Children.Add(eatLabel);
            var likeToEatLabel = FormsUtils.GetSimpleLabel(labelBindingPropertyName: nameof(IAnimalViewModelBase.LikeToEat), fontNamedSize: NamedSize.Large, fontAttributes: FontAttributes.Bold);

            likeToEatLabel.HorizontalOptions = LayoutOptions.Center;
            stackLayout.Children.Add(likeToEatLabel);

            var bigLabel = new Label
            {
                Text              = "I Am Big:",
                Margin            = new Thickness(0, 10, 0, 0),
                HorizontalOptions = LayoutOptions.Center,
                FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                TextColor         = Color.Gray
            };

            stackLayout.Children.Add(bigLabel);
            // var iAmBigSwitch = new Switch { HorizontalOptions = LayoutOptions.Center, WidthRequest = 75, HeightRequest = 30, InputTransparent = false };
            var iAmBigSwitch =
                new CustomToggleButton
            {
                HorizontalOptions = LayoutOptions.Center,
                WidthRequest      = 75,
                HeightRequest     = 30,
                CheckedImage      = ImageSource.FromFile("checked.png"),
                UnCheckedImage    = ImageSource.FromFile("unchecked.png")
            };

            iAmBigSwitch.SetUpBinding(CustomToggleButton.CheckedProperty, nameof(IAnimalViewModelBase.IAmBig), BindingMode.TwoWay);
            stackLayout.Children.Add(iAmBigSwitch);

            var imageLabel =
                new Label
            {
                Text              = "I Look Like This:",
                Margin            = new Thickness(0, 10, 0, 0),
                HorizontalOptions = LayoutOptions.Center,
                FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                TextColor         = Color.Gray
            };

            stackLayout.Children.Add(imageLabel);
            var myImage = FormsUtils.GetImage("", 100, 100);

            myImage.SetUpBinding(Image.SourceProperty, nameof(IAnimalViewModelBase.MyImageSource));
            myImage.HorizontalOptions = LayoutOptions.Center;
            stackLayout.Children.Add(myImage);

            var moveButton = new Button {
                Text = "Move", HorizontalOptions = LayoutOptions.Center
            };

            moveButton.SetUpBinding(Button.CommandProperty, nameof(IAnimalViewModelBase.MoveCommand));
            stackLayout.Children.Add(moveButton);

            var makeNoiseButton = new Button {
                Text = "Make Noise", HorizontalOptions = LayoutOptions.Center
            };

            moveButton.SetUpBinding(Button.CommandProperty, nameof(IAnimalViewModelBase.MakeNoiseCommand));
            stackLayout.Children.Add(makeNoiseButton);

            return(stackLayout);
        }