private async void btnPin_Clicked(object sender, EventArgs e) { slPin.IsVisible = false; slLoading.IsVisible = true; var response = await RockClient.LogIn("__PHONENUMBER__+1" + phoneNumber, ePin.Text); switch (response) { case LoginResponse.Error: App.Current.MainPage.DisplayAlert("Log-in Error", "There was an issue with your log-in attempt. Please try again later. (Sorry)", "OK"); slPin.IsVisible = true; slLoading.IsVisible = false; break; case LoginResponse.Failure: App.Current.MainPage.DisplayAlert("Log-in Error", "Phone number and pin did not match. Please try again.", "OK"); slPin.IsVisible = true; slLoading.IsVisible = false; break; case LoginResponse.Success: AvalancheNavigation.Footer = null; App.Current.MainPage = new AvalanchePage(); AvalancheNavigation.RequestNewRckipid(); break; default: break; } }
private async void btnSubmit_Clicked(object sender, EventArgs e) { slForm.IsVisible = false; aiActivity.IsRunning = true; var response = await RockClient.LogIn(username.Text, password.Text); switch (response) { case LoginResponse.Error: aiActivity.IsRunning = false; slForm.IsVisible = true; App.Current.MainPage.DisplayAlert("Log-in Error", "There was an issue with your log-in attempt. Please try again later. (Sorry)", "OK"); break; case LoginResponse.Failure: aiActivity.IsRunning = false; slForm.IsVisible = true; App.Current.MainPage.DisplayAlert("Log-in Error", "Your username or password was incorrect.", "OK"); break; case LoginResponse.Success: AvalancheNavigation.Footer = null; App.Current.MainPage = new AvalanchePage(); AvalancheNavigation.RequestNewRckipid(); break; default: break; } }
public static void HandleActionItem(Dictionary <string, string> Attributes) { if (!Attributes.ContainsKey("ActionType") || Attributes["ActionType"] == "0") { return; } var resource = ""; if (Attributes.ContainsKey("Resource")) { resource = Attributes["Resource"]; } var parameter = ""; if (Attributes.ContainsKey("Parameter")) { parameter = Attributes["Parameter"]; } if (Attributes["ActionType"] == "1" && !string.IsNullOrWhiteSpace(resource)) //push new page { AvalancheNavigation.GetPage(Attributes["Resource"], parameter); } else if (Attributes["ActionType"] == "2" && !string.IsNullOrWhiteSpace(resource)) //replace { AvalancheNavigation.ReplacePage(Attributes["Resource"], parameter); } else if (Attributes["ActionType"] == "3") //pop page { AvalancheNavigation.RemovePage(); } else if (Attributes["ActionType"] == "4" && !string.IsNullOrWhiteSpace(resource)) { if (!string.IsNullOrWhiteSpace(parameter)) { if (resource.Contains("?")) { resource += "&rckipid=" + parameter; } else { resource += "?rckipid=" + parameter; } } Device.OpenUri(new Uri(resource)); } }
private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e) { if (e.SelectedItem == null) { return; } var item = listViewComponent.SelectedItem as ListElement; if (item == null) { return; } //see if a parameter has been provided //if not use the item's id var parameter = item.Id; if (!string.IsNullOrWhiteSpace(item.Parameter)) { parameter = item.Parameter; } //if the individual item determins it's action type and resource if (!string.IsNullOrWhiteSpace(item.Resource) && !string.IsNullOrWhiteSpace(item.ActionType)) { var actionDictionary = new Dictionary <string, string> { { "Resource", item.Resource }, { "ActionType", item.ActionType }, { "Parameter", parameter } }; AvalancheNavigation.HandleActionItem(actionDictionary); return; } //default to the block is supplying the action type and resource listViewComponent.SelectedItem = null; Attributes["Parameter"] = parameter; AvalancheNavigation.HandleActionItem(Attributes); }
private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e) { if (e.SelectedItem == null) { return; } var item = listViewComponent.SelectedItem as ListElement; if (!string.IsNullOrWhiteSpace(item.Resource) && !string.IsNullOrWhiteSpace(item.ActionType)) { var actionDictionary = new Dictionary <string, string> { { "Resource", item.Resource }, { "ActionType", item.ActionType }, { "Parameter", item.Id } }; AvalancheNavigation.HandleActionItem(actionDictionary); return; } listViewComponent.SelectedItem = null; Attributes["Parameter"] = item.Id; AvalancheNavigation.HandleActionItem(Attributes); }
private void MessageHandler_Response( object sender, MobileBlockResponse e ) { FormResponse formResponse = null; var response = e.Response; try { formResponse = JsonConvert.DeserializeObject<FormResponse>( response ); } catch { activityIndicator.IsRunning = false; activityIndicator.IsVisible = false; formLayout.IsVisible = true; slValidationMessage.IsVisible = true; lbValidationMessage.Text = "There was a problem with your request."; lbValidationMessage.TextColor = ErrorTextColor; slValidationMessage.BackgroundColor = ErrorBackgroundColor; return; } activityIndicator.IsRunning = false; if ( formResponse == null ) { activityIndicator.IsRunning = false; activityIndicator.IsVisible = false; formLayout.IsVisible = true; slValidationMessage.IsVisible = true; lbValidationMessage.Text = "There was a problem with your request."; lbValidationMessage.TextColor = ErrorTextColor; slValidationMessage.BackgroundColor = ErrorBackgroundColor; return; } //Handle a failed form if ( !formResponse.Success ) { activityIndicator.IsRunning = false; activityIndicator.IsVisible = false; formLayout.IsVisible = true; slValidationMessage.IsVisible = true; lbValidationMessage.Text = formResponse.Message; slValidationMessage.BackgroundColor = ErrorBackgroundColor; lbValidationMessage.TextColor = ErrorTextColor; return; } //Rebuild form if needed if ( formResponse.FormElementItems.Any() ) { formElements.Clear(); formLayout.Children.Clear(); formLayout.IsVisible = true; RenderForm( formResponse.FormElementItems ); activityIndicator.IsRunning = false; activityIndicator.IsVisible = false; } if ( !string.IsNullOrWhiteSpace( formResponse.Message ) ) { activityIndicator.IsRunning = false; activityIndicator.IsVisible = false; slValidationMessage.IsVisible = true; lbValidationMessage.Text = formResponse.Message; lbValidationMessage.TextColor = InfoTextColor; slValidationMessage.BackgroundColor = InfoBackgroundColor; } AvalancheNavigation.HandleActionItem( new Dictionary<string, string> { { "ActionType", formResponse.ActionType }, { "Resource", formResponse.Resource }, { "Parameter", formResponse.Parameter } } ); }
private void AddTitleBar(ContentView layout, MobilePage page) { nav = ( StackLayout )layoutManager.GetElement("NavBar"); if (nav != null) { nav.IsVisible = true; if (page.Attributes.ContainsKey("AccentColor") && !string.IsNullOrEmpty(page.Attributes["AccentColor"])) { nav.BackgroundColor = (Color) new ColorTypeConverter().ConvertFromInvariantString(page.Attributes["AccentColor"]); } StackLayout stackLayout = new StackLayout { HeightRequest = 44, Orientation = StackOrientation.Horizontal, VerticalOptions = LayoutOptions.Center }; nav.Children.Add(stackLayout); if (App.Navigation.Navigation.NavigationStack.Count > 1) { IconLabel icon = new IconLabel { Text = "fa fa-chevron-left", HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Center, FontSize = 30, Margin = new Thickness(10, 7, 0, 0), TextColor = Color.Black }; TapGestureRecognizer tgr = new TapGestureRecognizer() { NumberOfTapsRequired = 1 }; tgr.Tapped += (s, ee) => { AvalancheNavigation.RemovePage(); }; nav.GestureRecognizers.Add(tgr); stackLayout.Children.Add(icon); } Label label = new Label { Text = page.Title, HorizontalTextAlignment = TextAlignment.Center, HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.Center, FontSize = 20, Margin = new Thickness(0, 6, 0, 0), TextColor = Color.Black }; stackLayout.Children.Add(label); BoxView boxview = new BoxView { HeightRequest = 0.5, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Black }; nav.Children.Add(boxview); } }
private void ButtonBlock_Clicked(object sender, EventArgs e) { AvalancheNavigation.HandleActionItem(Attributes); }
private void Tgr_Tapped(object sender, EventArgs e) { AvalancheNavigation.HandleActionItem(Attributes); }