public menupage() { InitializeComponent(); this.menuList.ItemsSource = new MenuItem[] { new MenuItem { Title = "Home", Type = typeof(HomePage) }, new MenuItem { Title = "Multiple List Example", Type = typeof(multipleList) }, new MenuItem { Title = "List Example", Type = typeof(listViewexample) }, }; this.menuList.ItemSelected += (object sender, SelectedItemChangedEventArgs e) => { MenuItem item = (MenuItem)e.SelectedItem; RootPage.Navigate(item.Type); }; }
public MenuPage() { InitializeComponent(); var items = new MenuItem[] { new MenuItem { Category = "Home", Title = "Home", Type = typeof(HomePage) }, //new MenuItem{ Category ="Home", Title = "Album", Type = typeof(AlbumChooserDemoPage) }, new MenuItem { Category = "Form", Title = "Forms", Type = typeof(FormDemoPage) }, new MenuItem { Category = "Form", Title = "Navigator List", Type = typeof(NavigatorListSample) }, new MenuItem { Category = "Form", Title = "Image", Type = typeof(ImagePage) }, new MenuItem { Category = "Form", Title = "Chooser", Type = typeof(ComboBoxSample) }, new MenuItem { Category = "Calendar", Title = "Date Picker", Type = typeof(CalendarPage) }, new MenuItem { Category = "Calendar", Title = "Calendar", Type = typeof(AtomCalendarPage) }, new MenuItem { Category = "Media", Title = "Video Player", Type = typeof(MediaPlayerPage) } }; this.menuList.ItemsSource = items.GroupBy(x => x.Category).ToList(); this.menuList.TapCommand = new AtomCommand <MenuItem>((item) => { RootPage.Navigate(item.Type); return(Task.CompletedTask); }); }
public static async void OpenLink(string str) { if (str is null) { return; } if (str.IndexOf("/u/") == 0) { string u = str.Replace("/u/", string.Empty); if (u.Contains('?')) { u = u.Substring(0, u.IndexOf('?')); } if (u.Contains('%')) { u = u.Substring(0, u.IndexOf('%')); } if (int.TryParse(u, out int uu)) { rootPage.Navigate(typeof(UserPage), u); } else { rootPage.Navigate(typeof(UserPage), await GetUserIDByName(u)); } } else if (str.IndexOf("/feed/") == 0) { string u = str.Replace("/feed/", string.Empty); if (u.Contains('?')) { u = u.Substring(0, u.IndexOf('?')); } if (u.Contains('%')) { u = u.Substring(0, u.IndexOf('%')); } rootPage.Navigate(typeof(FeedDetailPage), u); } else if (str.IndexOf("/t/") == 0) { string u = str.Replace("/t/", string.Empty); if (u.Contains('?')) { u = u.Substring(0, u.IndexOf('?')); } if (u.Contains('%')) { u = u.Substring(0, u.IndexOf('%')); } rootPage.Navigate(typeof(TopicPage), u); } else if (str.IndexOf("/dyh/") == 0) { string u = str.Replace("/dyh/", string.Empty); if (u.Contains('?')) { u = u.Substring(0, u.IndexOf('?')); } if (u.Contains('%')) { u = u.Substring(0, u.IndexOf('%')); } rootPage.Navigate(typeof(DyhPage), u); } else if (str.IndexOf("/apk/") == 0) { string u = "http://www.coolapk.com" + str; if (u.Contains('?')) { u = u.Substring(0, u.IndexOf('?')); } if (u.Contains('%')) { u = u.Substring(0, u.IndexOf('%')); } if (u.Contains('&')) { u = u.Substring(0, u.IndexOf('&')); } rootPage.Navigate(typeof(Pages.AppPages.AppPage), u); } else if (str.IndexOf("https") == 0) { if (str.Contains("coolapk.com")) { OpenLink(str.Replace("https://www.coolapk.com", string.Empty)); } else { await Launcher.LaunchUriAsync(new Uri(str)); } } else if (str.IndexOf("http") == 0) { if (str.Contains("coolapk.com")) { OpenLink(str.Replace("http://www.coolapk.com", string.Empty)); } else { await Launcher.LaunchUriAsync(new Uri(str)); } } }