public virtual void RemovePage <T>() where T : FreshBasePageModel { if (Pages.Count > 2) { LazyLoadedPage pageToRemoved = null; foreach (var page in Pages) { if (page.ViewModelType == typeof(T)) { pageToRemoved = page; break; } } Pages.Remove(pageToRemoved); if (Pages.Count == 1) { Detail = ResolvePage(Pages.First()); } _listView.ItemsSource = Pages.GroupBy(item => item.Group) .Select(item => new Grouping <string, LazyLoadedPage>(item.Key, item.ToList())).ToList(); } }
protected virtual Page ResolvePage(LazyLoadedPage lazyLoadedPage) { var innerPage = FreshPageModelResolver.ResolvePageModel(lazyLoadedPage.ViewModelType, lazyLoadedPage.Data); innerPage.GetModel().CurrentNavigationServiceName = NavigationServiceName; return(CreateContainerPage(innerPage)); }
public virtual void AddPage(string modelName, string title, string icon = null, Color?iconColor = null, object data = null) { if (iconColor == null) { iconColor = Color.Black;; } var pageToAdd = new LazyLoadedPage { ViewModelType = Type.GetType(modelName), Data = data, IconColor = iconColor, Title = title, Icon = icon }; Pages.Add(pageToAdd); if (Pages.Count == 1) { Detail = ResolvePage(pageToAdd); } }
public virtual void AddPage <T>(string title, string group, string icon = null, Color?iconColor = null, object data = null) where T : FreshBasePageModel { if (iconColor == null) { iconColor = Color.Black;; } var pageToAdd = new LazyLoadedPage { ViewModelType = typeof(T), Data = data, IconColor = iconColor, Title = title, Icon = icon, Group = group }; Pages.Add(pageToAdd); if (Pages.Count == 1) { Detail = ResolvePage(pageToAdd); } _listView.ItemsSource = Pages.GroupBy(item => item.Group).Select(item => new Grouping <string, LazyLoadedPage>(item.Key, item.ToList())).ToList(); }