protected override void OnAppearing() { base.OnAppearing(); FUtils.InvokeOnMainThread(200, () => { DisplayAlert("Pepe", "Pepep", "Cancelar"); }); }
protected override void OnParentSet() { base.OnParentSet(); if (Parent != null) { FUtils.InvokeOnMainThread(100, () => OnAppearing()); } else { OnDisappearing(); } }
void TxtField_Unfocused(object sender, FocusEventArgs e) { FUtils.InvokeOnMainThread(TimeSpan.FromMilliseconds(100), () => { if (Entry.IsFocused) { return; } var result = Field.Validate(); ShowError(result); }); }
protected override void OnBindingContextChanged() { base.OnBindingContextChanged(); if (ViewModel != null) { ViewModel.NavigateToDelegate = NavigateTo; ViewModel.NavigateModalToDelegate = NavigateModalTo; ViewModel.NavigateCloseDelegate = NavigateClose; ViewModel.NavigateBackDelegate = NavigateBack; ViewModel.AskAsyncDelegate = AskAsync; FUtils.InvokeOnMainThread(100, () => { ViewModel.InvokeLoaded(); }); } }
protected override void OnAppearing() { base.OnAppearing(); foreach (var key in Fields.Keys) { var field = Fields[key].Field; var control = Fields[key].Control; field.ValueChanged += Field_ValueChanged; field.Validated += Field_Validated; if (control is WEntry) { var entry = control as WEntry; entry.TextChanged += Entry_TextChanged; entry.Text = (string)field.Value; entry.Placeholder = field.Placeholder; entry.IsEnabled = field.IsEnabled; if (field.Rules != null) { if (field.Rules != null) { var rule = field.Rules.FindRule <LengthRule>(); if (rule != null) { entry.MaxLength = rule.Max; } } } Entry_TextChanged(entry, null); } else if (control is Picker) { var picker = control as WPicker; picker.ItemsSource = field.Options.Select(p => p.Text).ToList(); if (field.Value == null) { picker.SelectedIndex = -1; } else { if (field.Value is string) { if (picker.SelectedItem != field.Value) { picker.SelectedItem = field.Value; } } else { var option = field.Options.Where(p => p.Source == field.Value).FirstOrDefault(); if ((string)picker.SelectedItem != option.Text) { picker.SelectedItem = option.Text; } } } picker.IsEnabled = field.IsEnabled; picker.Placeholder = "picker"; FUtils.InvokeOnMainThread(TimeSpan.FromMilliseconds(100), () => { picker.Placeholder = field.Placeholder; }); picker.SelectedIndexChanged += Picker_SelectedIndexChanged; Picker_SelectedIndexChanged(picker, null); } if (Fields[key].LblTitle != null) { Fields[key].LblTitle.Text = field.Title; } } }