예제 #1
0
        private Dialog SetupResultSummaryDialog()
        {
            Dialog dialog = new Dialog(new Size(App.ScreenWidth - 30, 410))
            {
                DialogBackgroundColor = _configuration.Theme.BackgroundColor,
                EnableCloseButton     = false,
            };

            Grid dialogLayout = new Grid()
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                RowSpacing        = 10,
            };

            dialogLayout.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(60, GridUnitType.Absolute)
            });
            dialogLayout.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(40, GridUnitType.Absolute)
            });
            dialogLayout.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(40, GridUnitType.Absolute)
            });
            dialogLayout.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(40, GridUnitType.Absolute)
            });
            dialogLayout.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(70, GridUnitType.Absolute)
            });
            dialogLayout.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(70, GridUnitType.Absolute)
            });

            int row = 0;

            summaryIcon = new Image()
            {
                Aspect            = Aspect.AspectFit,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
            };

            dialogLayout.Children.Add(summaryIcon, 0, row);
            row++;

            _resultSummaryDialogTitle = new Label()
            {
                HorizontalTextAlignment = TextAlignment.Center,
                FontAttributes          = FontAttributes.Bold,
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) + 4,
            };

            dialogLayout.Children.Add(_resultSummaryDialogTitle, 0, row);
            row++;

            _resultSummaryDialogPoints = new Label()
            {
                HorizontalTextAlignment = TextAlignment.Center,
                TextColor = Color.Red,
                FontSize  = Device.GetNamedSize(NamedSize.Large, typeof(Label)) + 4,
            };

            dialogLayout.Children.Add(_resultSummaryDialogPoints, 0, row);
            row++;

            Label anotherChallenge = new Label()
            {
                Text = "¿Qué quieres hacer?",
                HorizontalTextAlignment = TextAlignment.Center,
                FontSize       = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                FontAttributes = FontAttributes.Bold,
            };

            dialogLayout.Children.Add(anotherChallenge, 0, row);
            row++;

            var continueButton = new FrameButton("Seguir jugando", (e, s) => { OnChallengeEnd(true); })
            {
                BackgroundColor = Configuration.Theme.SecondaryBackgroundColor,
                TextColor       = Color.FromHex("#000078"),
                FontSize        = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                Margin          = new Thickness(35, 0),
            };

            dialogLayout.Children.Add(continueButton, 0, row);
            row++;

            var exitButton = new FrameButton("Salir", (e, s) => { OnChallengeEnd(false); })
            {
                BackgroundColor = Configuration.Theme.SecondaryBackgroundColor,
                TextColor       = Color.FromHex("#000078"),
                FontSize        = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                Margin          = new Thickness(35, 0),
            };

            dialogLayout.Children.Add(exitButton, 0, row);
            row++;

            dialog.Content = dialogLayout;

            return(dialog);
        }
예제 #2
0
        protected override Layout SetupContentLayout()
        {
            Layout layout = base.SetupContentLayout();

            //challengeTypeIcon = FormsHelper.ConfigureImageButton($"{ challenge.Type.ToString().ToLower() }.png", null, SelectChallengeTypePage.ChallengeTypeIconSize);

            //_mainLayout.Children.Add(challengeTypeIcon, new Rectangle(0.5, 130 - 50, SelectChallengeTypePage.ChallengeTypeIconSize.Width, SelectChallengeTypePage.ChallengeTypeIconSize.Height), AbsoluteLayoutFlags.XProportional);

            SetupHintDialog();
            //SetupSkip3Dialog();

            SetupSkipChallengeLimitDialog();

            Grid optionsLayout = new Grid()
            {
                Margin = new Thickness(0, 10),
                //BackgroundColor = Color.Yellow,
                VerticalOptions = LayoutOptions.FillAndExpand,
                RowSpacing      = 15,
            };

            optionsLayout.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(1, GridUnitType.Star)
            });
            optionsLayout.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(1, GridUnitType.Star)
            });

            if (_showActionButtons)
            {
                optionsLayout.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(1, GridUnitType.Star)
                });
            }

            var row = 0;

            _clockLabel = new AutoFontSizeLabel()
            {
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
            };

            optionsLayout.Children.Add(_clockLabel, 0, row);
            row++;

            UpdateClock();

            _stopButton = FormsHelper.ConfigureImageButton("stop.png", (s, e) => { StopChallenge(); });

            _stopButton.WidthRequest      = 100;
            _stopButton.HorizontalOptions = LayoutOptions.Center;
            _stopButton.VerticalOptions   = LayoutOptions.FillAndExpand;
            _stopButton.Aspect            = Aspect.AspectFit;

            optionsLayout.Children.Add(_stopButton, 0, row);
            row++;

            if (_showActionButtons)
            {
                Grid actionButtons = new Grid()
                {
                    VerticalOptions = LayoutOptions.Center,
                    ColumnSpacing   = 10,
                    Margin          = new Thickness(0),
                    Padding         = new Thickness(0),
                };

                _hintButton = new FrameButton("Pista", (e, s) => ShowHint())
                {
                    BackgroundColor = Configuration.Theme.SelectedBackgroundColor,
                    TextColor       = Configuration.Theme.SelectedTextColor,
                    FontSize        = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) - 2,
                    //Margin = new Thickness(10, 0),
                };

                if (_challenge.Hint != "")
                {
                    actionButtons.Children.Add(_hintButton, 0, 0);
                }

                _skipButton = new FrameButton("Saltar prueba", (e, s) => SkipChallenge())
                {
                    BackgroundColor = Configuration.Theme.SelectedBackgroundColor,
                    TextColor       = Configuration.Theme.SelectedTextColor,
                    FontSize        = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) - 2,
                    //Margin = new Thickness(10, 0),
                };

                actionButtons.Children.Add(_skipButton, 1, 0);

                optionsLayout.Children.Add(actionButtons, 0, row);
                row++;
            }

            _bottomContent.Children.Add(optionsLayout);

            /*var grid = new Grid
             * {
             *  VerticalOptions = LayoutOptions.Fill,
             *  HorizontalOptions = LayoutOptions.Fill,
             *  Padding = new Thickness(0, 0, 0, 0),
             *  BackgroundColor = Color.Transparent,
             * };
             *
             * grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) });
             * grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) });
             *
             *
             * grid.Children.Add(new BoxView { Color = Color.Blue }, 0, 0);
             * grid.Children.Add(layout);
             *
             * _mainLayout.Children.Add(grid, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All);*/

            _bottomContent.Margin = new Thickness(0);

            _youveGotItDialog         = SetupYouveGotItDialog();
            _resultSummaryDialog      = SetupResultSummaryDialog();
            _finalResultSummaryDialog = SetupFinalResultSummaryDialog();
            _skip3Dialog            = SetupSkip3Dialog();
            _noMoreChallengesDialog = SetupnoMoreChallengesDialog();

            _mainLayout.Children.Add(_youveGotItDialog, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All);
            _mainLayout.Children.Add(_resultSummaryDialog, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All);
            _mainLayout.Children.Add(_finalResultSummaryDialog, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All);
            _mainLayout.Children.Add(_skip3Dialog, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All);
            _mainLayout.Children.Add(_noMoreChallengesDialog, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All);

            var grid = new Grid
            {
                BackgroundColor = Color.Transparent,
                RowSpacing      = 30
            };


            var gridButton = new Button {
                Text = "1!"
            };

            gridButton.VerticalOptions = LayoutOptions.End;
            gridButton.Clicked        += OnImageButtonClicked;

            var gridButton2 = new Button {
                Text = "2"
            };

            gridButton2.VerticalOptions = LayoutOptions.End;
            gridButton2.Clicked        += OnImageButtonClicked;

            var imageButton = new ImageButton
            {
                BackgroundColor = Color.Transparent,
                Padding         = 10,
                Source          = "home.png",
                //HorizontalOptions = LayoutOptions.End,
                //VerticalOptions = LayoutOptions.EndAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand
            };

            imageButton.Clicked += OnImageButtonClicked;

            var imageButton2 = new ImageButton
            {
                BackgroundColor = Color.Transparent,

                Padding           = 10,
                Source            = "info.png",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand
            };

            imageButton2.Clicked += OnImageButtonClicked2;

            var imageButton3 = new ImageButton
            {
                BackgroundColor   = Color.Transparent,
                Padding           = 10,
                Source            = "list.png",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand
            };

            imageButton3.Clicked += OnImageButtonClicked3;

            var imageButton4 = new ImageButton
            {
                BackgroundColor   = Color.Transparent,
                Padding           = 10,
                Source            = "person.png",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand
            };

            imageButton4.Clicked += OnImageButtonClicked4;

            grid.Children.Add(imageButton, 0, 0);
            grid.Children.Add(imageButton2, 1, 0);
            grid.Children.Add(imageButton3, 2, 0);
            grid.Children.Add(imageButton4, 3, 0);

            grid.VerticalOptions = LayoutOptions.End;

            _mainLayout.Children.Add(grid, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All);

            return(layout);
        }
예제 #3
0
        private Dialog SetupnoMoreChallengesDialog()
        {
            Dialog dialog = new Dialog(new Size(App.ScreenWidth - 30, 300))
            {
                DialogBackgroundColor = _configuration.Theme.BackgroundColor,
                EnableCloseButton     = false,
            };

            Grid dialogLayout = new Grid()
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                RowSpacing        = 20,
            };

            int row = 0;

            var summaryIcon = FormsHelper.ConfigureImageButton("info.png");

            dialogLayout.Children.Add(summaryIcon, 0, row);
            row++;

            Label anotherChallenge = new Label()
            {
                Text = "Se han acabado las pruebas de esta categoria...ves al Inicio o al apartado de Filtros que se encuentra en Perfil.",
                HorizontalTextAlignment = TextAlignment.Center,
                FontSize       = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                FontAttributes = FontAttributes.Bold,
            };

            dialogLayout.Children.Add(anotherChallenge, 0, row);
            row++;

            Button buttonI = new Button
            {
                Text              = "Volver a Inicio",
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.Center,
                BackgroundColor   = Configuration.Theme.SecondaryBackgroundColor,
                TextColor         = Color.FromHex("#000078"),
                FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                Margin            = new Thickness(35, 0),
            };

            ImageButton imageButton = new ImageButton
            {
                Source            = "info.png",
                BackgroundColor   = Color.Transparent,
                HorizontalOptions = LayoutOptions.Center,
                HeightRequest     = 60,
                VerticalOptions   = LayoutOptions.CenterAndExpand
            };

            buttonI.Clicked += OnImageButtonClicked;

            var continueButton = new FrameButton("Ir a Inicio", (e, s) => { OnChallengeEnd(true); })
            {
                BackgroundColor = Configuration.Theme.SecondaryBackgroundColor,
                TextColor       = Color.FromHex("#000078"),
                FontSize        = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                Margin          = new Thickness(35, 0),
            };

            dialogLayout.Children.Add(buttonI, 0, row);
            row++;

            dialog.Content = dialogLayout;
            return(dialog);
        }
예제 #4
0
        protected override Layout SetupContentLayout()
        {
            BackgroundColor = Configuration.Theme.BackgroundColor;

            Grid mainLayout = new Grid();

            StackLayout contentLayout = new StackLayout()
            {
                Padding         = new Thickness(20, 100),
                VerticalOptions = LayoutOptions.Start,
            };

            //contentLayout.Children.Add(new Label()
            //{
            //    Text = "Escanea el código QR de tu invitación",
            //    FontSize = Configuration.Theme.BigFontSize,
            //    TextColor = Configuration.Theme.TextColor,
            //    HorizontalTextAlignment = TextAlignment.Center,
            //});

            //contentLayout.Children.Add(new Image { Source = "logo__new.png" });

            contentLayout.Children.Add(new Label()
            {
                Text                    = "Introduce el código que se te ha enviado por email y escribe tu nombre de usuario",
                FontSize                = Configuration.Theme.SmallFontSize,
                TextColor               = Configuration.Theme.TextColor,
                VerticalTextAlignment   = TextAlignment.Start,
                HorizontalTextAlignment = TextAlignment.Center,
            });

            Grid introduceCodeLayout = new Grid()
            {
                Padding = new Thickness(10),
                Margin  = new Thickness(10, 5, 10, 5),
            };

            introduceCodeLayout.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(5, GridUnitType.Star)
            });
            introduceCodeLayout.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(10, GridUnitType.Absolute)
            });
            introduceCodeLayout.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Star)
            });

            _codeEntry = new Entry()
            {
                //BackgroundColor = Configuration.Theme.SecondaryBackgroundColor,
                FontSize  = Configuration.Theme.MediumFontSize,
                TextColor = Configuration.Theme.TextColor,
            };

            introduceCodeLayout.Children.Add(_codeEntry, 0, 0);

            introduceCodeLayout.Children.Add(FormsHelper.ConfigureImageButton("settings.png", (e, s) => { return; }, new Size(4, 4), true, Assembly.GetCallingAssembly()), 2, 0);

            contentLayout.Children.Add(introduceCodeLayout);

            Grid introduceCodeLayout2 = new Grid()
            {
                Margin  = new Thickness(10, 5, 10, 5),
                Padding = new Thickness(10),
            };

            introduceCodeLayout2.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(5, GridUnitType.Star)
            });
            introduceCodeLayout2.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(10, GridUnitType.Absolute)
            });
            introduceCodeLayout2.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Star)
            });

            _codeEntry2 = new Entry()
            {
                //BackgroundColor = Configuration.Theme.SecondaryBackgroundColor,
                FontSize  = Configuration.Theme.MediumFontSize,
                TextColor = Configuration.Theme.TextColor,
            };

            introduceCodeLayout2.Children.Add(_codeEntry2, 0, 0);

            introduceCodeLayout2.Children.Add(FormsHelper.ConfigureImageButton("person.png", (e, s) => { return; }, new Size(4, 4), true, Assembly.GetCallingAssembly()), 2, 0);

            contentLayout.Children.Add(introduceCodeLayout2);

            EventHandler scanButtonAction = (sender, e) =>
            {
                /*
                 * var emailPattern = @"^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$";
                 * if (Regex.IsMatch(email, emailPattern))
                 * {
                 *  ErrorLabel.Text = "Email is valid";
                 * }
                 * else
                 * {
                 *  ErrorLabel.Text = "EMail is InValid";
                 * }
                 */



                var code_Input = _codeEntry.Text;
                var name_Input = _codeEntry2.Text;
                if (code_Input == null)
                {
                    DisplayAlert("Cuidado", "Entra un código válido o consulte con su médico", "ok");
                }
                else if (name_Input == null)
                {
                    DisplayAlert("Falta un campo", "Rellena el campo con un nombre de referencia.", "Rellenar");

                    /*var answer = await DisplayAlert("Exit", "Do you wan't to exit the App?", "Yes", "No");
                     * if(answer)
                     * {
                     *  _canClose = false;
                     *  OnBackButtonPressed;
                     * }*/
                }

                else
                {
                    _configuration.SaveProperty("name", name_Input);
                    _configuration.SaveProperty("docId", code_Input);
                    CheckCode(_codeEntry.Text);
                    _codeEntry.Text  = string.Empty;
                    _codeEntry2.Text = string.Empty;
                }


                /*if (!string.IsNullOrWhiteSpace(_codeEntry.Text) && !string.IsNullOrWhiteSpace(_codeEntry2.Text))
                 * {
                 *  firebaseHelper.AddPerson(Convert.ToInt32(_codeEntry.Text.Substring(5)), _codeEntry2.Text, _codeEntry.Text);
                 *  DisplayAlert("Success", "Person Added Successfully", "OK");
                 *  var allPersons =  firebaseHelper.GetAllPersons();
                 *  //lstPersons.ItemsSource = allPersons;
                 *  CheckCode(_codeEntry.Text);
                 *  _codeEntry.Text = string.Empty;
                 *  _codeEntry2.Text = string.Empty;
                 * }
                 * else
                 * {
                 *  DisplayAlert("Alert", "Consulta a tu médico para que te de un código o rellena el campo de nombre.", "OK");
                 * }*/
            };

            var scanButton = new FrameButton("Acceder", scanButtonAction)
            {
                Margin          = new Thickness(40),
                BackgroundColor = Configuration.Theme.SelectedBackgroundColor,
                FontSize        = Configuration.Theme.SmallFontSize,
                TextColor       = Color.White,
            };

            contentLayout.Children.Add(scanButton);

            mainLayout.Children.Add(contentLayout);

            _dialog = new Dialog(new Size(300, 300))
            {
                Content = new Label()
                {
                    Text                    = "Código incorrecto. Vuelva a intentarlo o comuníquese con el organizador.",
                    FontSize                = Configuration.Theme.MediumFontSize,
                    TextColor               = Configuration.Theme.TextColor,
                    VerticalTextAlignment   = TextAlignment.Center,
                    HorizontalTextAlignment = TextAlignment.Center,
                    LineBreakMode           = LineBreakMode.WordWrap,
                    VerticalOptions         = LayoutOptions.FillAndExpand,
                    HorizontalOptions       = LayoutOptions.FillAndExpand,
                    MaxLines                = 10,
                },
                DialogBackgroundColor = Configuration.Theme.SecondaryBackgroundColor,
                DialogSize            = new Size(300, 300),
                DialogHeight          = 300,
            };

            mainLayout.Children.Add(_dialog);

            return(mainLayout);
        }