protected override Layout SetupContentLayout() { emotionalIcon = FormsHelper.ConfigureImageButton($"{ _emotionalStatus.ToString().ToLower() }.png", null, SelectEmotionalStatusPage.EmotionalIconSize); // new Size(85, 85)); _mainLayout.Children.Add(emotionalIcon, new Rectangle(0.5, 130, SelectEmotionalStatusPage.EmotionalIconSize.Width, SelectEmotionalStatusPage.EmotionalIconSize.Height), AbsoluteLayoutFlags.XProportional); return(base.SetupContentLayout()); }
protected override void OnAppearing() { try { IsBusy = true; base.OnAppearing(); MessagingCenter.Send(this, "allowLandScapePortrait"); NavigationPage.SetHasNavigationBar(this, false); AbsoluteLayout pageLayout = new AbsoluteLayout() { BackgroundColor = Color.Black, }; videoPlayer = new VideoPlayer { AutoPlay = true, BackgroundColor = Color.Black, FillMode = FillMode.ResizeAspect, }; videoPlayer.Failed += Vp_Failed; videoPlayer.Completed += Vp_Completed; videoPlayer.Source = VideoSourceFromType(videoSource, videoType); videoPlayer.AnchorX = 0.5; videoPlayer.AnchorY = 0.5; videoPlayer.DisplayControls = displayControls; pageLayout.Children.Add(videoPlayer, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All); if (enableClose) { var closeButton = FormsHelper.ConfigureImageButton("UOCApps.CommonLibrary.Images.closevideo.png", (s, e) => { Close(); }, new Size(32, 32), false); closeButton.AnchorX = 0.5; closeButton.AnchorY = 0.5; pageLayout.Children.Add(closeButton, new Rectangle(0.95, 0, 32, 32), AbsoluteLayoutFlags.XProportional); } Content = pageLayout; IsBusy = false; } catch { Close(); } }
private Image ConfigureOptionButton(ChallengeType challengeType, Size?size = null) { Image imageButton = FormsHelper.ConfigureImageButton($"{ challengeType.ToString().ToLower() }.png", (s, e) => { var t = OnChallengeTypeSelected(challengeType); }, size); //imageButton.WidthRequest = 100; imageButton.HorizontalOptions = LayoutOptions.Center; imageButton.VerticalOptions = LayoutOptions.FillAndExpand; imageButton.Aspect = Aspect.AspectFit; return(imageButton); }
private Image ConfigureEmotionalStatusButton(EmotionalStatus emotionalStatus, char set, Size?size = null) { Image imageButton = FormsHelper.ConfigureImageButton($"{ emotionalStatus.ToString().ToLower() }.png", (s, e) => { var t = OnEmotionalStatusSelected(emotionalStatus); }, size); imageButton.WidthRequest = 100; imageButton.HorizontalOptions = LayoutOptions.Center; imageButton.VerticalOptions = LayoutOptions.FillAndExpand; imageButton.Aspect = Aspect.AspectFit; return(imageButton); }
private Image SetupNavigationButton(string type, bool enable, Func <bool> action) { Image navigationButton = FormsHelper.ConfigureImageButton($"{ type }.png", (e, s) => { action(); }, new Size(40, 40)); navigationButton.IsEnabled = enable; navigationButton.VerticalOptions = LayoutOptions.End; navigationButton.HorizontalOptions = LayoutOptions.Start; navigationButton.Margin = new Thickness(10); return(navigationButton); }
private void SetupHintDialog() { _hintDialog = new Dialog(new Size(App.ScreenWidth - 30, _challenge.Hint != null ? 530 : 440)) { DialogBackgroundColor = Configuration.Theme.BackgroundColor, DialogVerticalAlignment = LayoutOptions.FillAndExpand, //DialogMargin = new Thickness (0,250,0,0), //EnableCloseButton = false, ShowOverlay = false, //AutoCloseTime = 5000, }; Grid hintLayout = new Grid() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, RowSpacing = 20, }; hintLayout.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(50, GridUnitType.Absolute) }); hintLayout.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); hintLayout.Children.Add(FormsHelper.ConfigureImageButton("hint.png"), 0, 0); hintLayout.Children.Add(new Label() { FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) + 2, Text = _challenge.Hint ?? "¡Sólo tienes que ir más rápido para acabar la prueba!", TextColor = Configuration.Theme.TextColor, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, }, 1, 0); _hintDialog.Content = hintLayout; _hintDialog.Closed += () => Device.BeginInvokeOnMainThread(() => EnableButtons(true)); _mainLayout.Children.Add(_hintDialog, new Rectangle(0, 250, 1, 350), AbsoluteLayoutFlags.XProportional | AbsoluteLayoutFlags.WidthProportional); }
private void SetupSkipChallengeLimitDialog() { _skipChallengeLimitDialog = new Dialog(new Size(App.ScreenWidth - 30, 250)) { DialogBackgroundColor = Configuration.Theme.SecondaryBackgroundColor, DialogVerticalAlignment = LayoutOptions.StartAndExpand, //DialogMargin = new Thickness (0,250,0,0), //EnableCloseButton = false, ShowOverlay = false, AutoCloseTime = 6000, }; Grid skipChallengeLimitLayout = new Grid(); skipChallengeLimitLayout.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(50, GridUnitType.Absolute) }); skipChallengeLimitLayout.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); skipChallengeLimitLayout.Children.Add(FormsHelper.ConfigureImageButton("hint.png"), 0, 0); skipChallengeLimitLayout.Children.Add(new Label() { FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) + 2, Text = "Sólo puedes saltar de prueba tres veces.", TextColor = Configuration.Theme.TextColor, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, }, 1, 0); _skipChallengeLimitDialog.Content = skipChallengeLimitLayout; _mainLayout.Children.Add(_skipChallengeLimitDialog, new Rectangle(0, 250, 1, 250), AbsoluteLayoutFlags.XProportional | AbsoluteLayoutFlags.WidthProportional); }
private Dialog SetupFinalResultSummaryDialog() { Dialog dialog = new Dialog(new Size(App.ScreenWidth - 30, 540)) { DialogBackgroundColor = _configuration.Theme.SecondaryBackgroundColor, EnableCloseButton = false, }; Grid dialogLayout = new Grid() { VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, RowSpacing = 10, Padding = new Thickness(15), }; dialogLayout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(200, 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(100, GridUnitType.Absolute) }); int row = 0; var prizeIcon = FormsHelper.ConfigureImageButton("ivegotit.png"); dialogLayout.Children.Add(prizeIcon, 0, row); row++; var title = new Label() { Text = "Has acumulado", HorizontalTextAlignment = TextAlignment.Center, FontAttributes = FontAttributes.Bold, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) + 4, }; dialogLayout.Children.Add(title, 0, row); row++; _finalResultSummaryDialogPoints = new Label() { HorizontalTextAlignment = TextAlignment.Center, TextColor = Color.Red, FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)) + 4, }; dialogLayout.Children.Add(_finalResultSummaryDialogPoints, 0, row); row++; _finalResultSummaryDialogRanking = new Label() { HorizontalTextAlignment = TextAlignment.Center, //TextColor = Color.Red, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), }; dialogLayout.Children.Add(_finalResultSummaryDialogRanking, 0, row); row++; dialog.Content = dialogLayout; return(dialog); }
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); }
private Dialog SetupYouveGotItDialog() { Dialog dialog = new Dialog(new Size(App.ScreenWidth - 30, _challenge.Solution != null ? 430 : 340)) { DialogBackgroundColor = _configuration.Theme.BackgroundColor, EnableCloseButton = false, }; Grid dialogLayout = new Grid() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, RowSpacing = 20, }; dialogLayout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(60, GridUnitType.Absolute) }); if (_challenge.Solution != null) { dialogLayout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); } 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; var summaryIcon = FormsHelper.ConfigureImageButton("timestopped.png"); dialogLayout.Children.Add(summaryIcon, 0, row); row++; if (_challenge.Solution != null) { dialogLayout.Children.Add(new AutoFontSizeLabel() { Text = $"Solución: { _challenge.Solution }", HorizontalTextAlignment = TextAlignment.Center }, 0, row); row++; } dialogLayout.Children.Add(new Label() { Text = $"¿Lo has conseguido?", HorizontalTextAlignment = TextAlignment.Center, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), FontAttributes = FontAttributes.Bold, }, 0, row); row++; dialogLayout.Children.Add(new FrameButton("SÍ", (e, s) => { ShowResultSummary(false, true); }) { FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), BackgroundColor = _configuration.Theme.SecondaryBackgroundColor, TextColor = Color.FromHex("#000078"), Margin = new Thickness(35, 0), }, 0, row); row++; dialogLayout.Children.Add(new FrameButton("NO", (e, s) => { ShowResultSummary(false, false); }) { FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), BackgroundColor = _configuration.Theme.SecondaryBackgroundColor, TextColor = Color.FromHex("#000078"), Margin = new Thickness(35, 0), }, 0, row); row++; dialog.Content = dialogLayout; return(dialog); }
private Dialog SetupSkip3Dialog() { Dialog dialog = new Dialog(new Size(App.ScreenWidth - 30, _challenge.Solution != null ? 430 : 340)) { DialogBackgroundColor = _configuration.Theme.BackgroundColor, EnableCloseButton = false, }; Grid dialogLayout = new Grid() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, RowSpacing = 20, }; 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(70, GridUnitType.Absolute) }); dialogLayout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(70, GridUnitType.Absolute) }); int row = 0; var infoIcon = FormsHelper.ConfigureImageButton("info.png"); dialogLayout.Children.Add(infoIcon, 0, row); row++; dialogLayout.Children.Add(new Label() { Text = $"Sólo puedes saltar de prueba tres veces.", HorizontalTextAlignment = TextAlignment.Center, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), FontAttributes = FontAttributes.Bold, }, 0, row); row++; dialogLayout.Children.Add(new FrameButton("VOLVER", (e, s) => { dialog.Close(); EnableButtonsAfter3Times(true); }) { FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), BackgroundColor = _configuration.Theme.SecondaryBackgroundColor, TextColor = _configuration.Theme.SelectedTextColor, Margin = new Thickness(35, 0), }, 0, row); row++; dialogLayout.Children.Add(new FrameButton("PASAR", (e, s) => { ShowResultSummary(false, false); }) { FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), BackgroundColor = _configuration.Theme.SecondaryBackgroundColor, TextColor = _configuration.Theme.SelectedTextColor, Margin = new Thickness(35, 0), }, 0, row); row++; dialog.Content = dialogLayout; //_mainLayout.Children.Add(dialog, new Rectangle(0, 250, 1, 350), AbsoluteLayoutFlags.XProportional | AbsoluteLayoutFlags.WidthProportional); return(dialog); }
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); }
protected override Layout SetupContentLayout() { Layout layout = base.SetupContentLayout(); if (emotionalStatus != null) { emotionalIcon = FormsHelper.ConfigureImageButton($"{ emotionalStatus.ToString().ToLower() }.png", null, SelectEmotionalStatusPage.EmotionalIconSize); // new Size(85, 85)); _mainLayout.Children.Add(emotionalIcon, new Rectangle(0.5, 130 - 50, SelectEmotionalStatusPage.EmotionalIconSize.Width, SelectEmotionalStatusPage.EmotionalIconSize.Height), AbsoluteLayoutFlags.XProportional); } ActivityIndicator activityIndicator = new ActivityIndicator { IsRunning = true }; _mainLayout.Children.Add(activityIndicator, new Rectangle(0, 0, SelectEmotionalStatusPage.EmotionalIconSize.Width, 50), AbsoluteLayoutFlags.XProportional); _challengeTypesIconsLayout = new Grid() { Margin = new Thickness(0, 10), VerticalOptions = LayoutOptions.FillAndExpand, ColumnSpacing = 10, //RowSpacing = 10, }; _challengeTypesIconsLayout.ColumnDefinitions.Add(new ColumnDefinition()); _challengeTypesIconsLayout.ColumnDefinitions.Add(new ColumnDefinition()); _challengeTypesIconsLayout.RowDefinitions.Add(new RowDefinition()); _challengeTypesIconsLayout.RowDefinitions.Add(new RowDefinition()); _challengeTypesIcons = new List <ChallengeTypeIcon>(); var icon = ConfigureOptionButton(ChallengeType.Social); icon.VerticalOptions = LayoutOptions.End; icon.HorizontalOptions = LayoutOptions.End; _challengeTypesIcons.Add(new ChallengeTypeIcon() { ChallengeType = ChallengeType.Social, Image = icon }); _challengeTypesIconsLayout.Children.Add(icon, 0, 0); icon = ConfigureOptionButton(ChallengeType.Cognitive); icon.VerticalOptions = LayoutOptions.End; icon.HorizontalOptions = LayoutOptions.Start; _challengeTypesIcons.Add(new ChallengeTypeIcon() { ChallengeType = ChallengeType.Cognitive, Image = icon }); _challengeTypesIconsLayout.Children.Add(icon, 1, 0); icon = ConfigureOptionButton(ChallengeType.Behavioral); icon.VerticalOptions = LayoutOptions.Start; icon.HorizontalOptions = LayoutOptions.End; _challengeTypesIcons.Add(new ChallengeTypeIcon() { ChallengeType = ChallengeType.Behavioral, Image = icon }); _challengeTypesIconsLayout.Children.Add(icon, 0, 1); icon = ConfigureOptionButton(ChallengeType.CreateCustomChallenge); icon.VerticalOptions = LayoutOptions.Start; icon.HorizontalOptions = LayoutOptions.Start; _challengeTypesIcons.Add(new ChallengeTypeIcon() { ChallengeType = ChallengeType.CreateCustomChallenge, Image = icon }); _challengeTypesIconsLayout.Children.Add(icon, 1, 1); _bottomContent.Children.Add(_challengeTypesIconsLayout, 0, 0); return(layout); }
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); }