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 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); } }