private void BindingNavBarForPrevCatPage() { var navBarViewModel = new NavBarViewModel(); var categories = _feedManager.GetCategories(); categories.ForEach(c => { navBarViewModel.FirstBrothers.Add(new Brother() { Id = c.Id.ToString(), Name = c.Name, ImageUri = c.ImageUri.ToString().StartsWith("/") ? c.ImageUri : new Uri("/" + c.ImageUri.ToString(), UriKind.Relative), Stats = CategoryHelper.GetStatsString(c.Id), Selected = c.Id.Equals(_itemContainer.Id), PostAction = ViewModels.PostAction.Navigation, NavigateUri = new Uri(string.Format("/CategoryPage.xaml?categoryId={0}", c.Id), UriKind.Relative) }); }); NavBar.BindingNavBar(navBarViewModel); NavBar.Navigation = ((uri, id) => { DisposeAll(); if (!id.Equals(_itemContainer.Id)) { UserBehaviorManager.Instance.Log(UserAction.CatEnter, id); } NavigationService.Navigate(uri); }); NavBar.NavigateHome = (() => this.BackToMainPage()); }
private void BindingNavBar() { var navBarViewModel = new NavBarViewModel(); var categories = _feedManager.GetCategories(); categories.ForEach(c => { navBarViewModel.FirstBrothers.Add(new Brother() { Id = c.Id.ToString(), Name = c.Name, ImageUri = c.ImageUri.ToString().StartsWith("/") ? c.ImageUri : new Uri("/" + c.ImageUri.ToString(), UriKind.Relative), Stats = CategoryHelper.GetStatsString(c.Id), Selected = c.Id.Equals(_viewModel.Id), PostAction = ViewModels.PostAction.Binding, BindingData = new BindingData() { CategoryId = c.Id, PublisherId = default(Guid), FeedId = default(Guid) } }); }); NavBar.BindingNavBar(navBarViewModel); NavBar.SelectedEvent -= NavBar_SelectedEvent; NavBar.SelectedEvent += NavBar_SelectedEvent; NavBar.NavigateHome = (() => this.BackToMainPage()); }
void DisposeAll() { ActionOnChildControls <Grid>(llsItemList, Grid.NameProperty, "grdItem", ((c) => ContextMenuService.SetContextMenu(c, null))); llsItemList.ItemsSource = null; llsItemList.ItemTemplate = null; llsItemList.ItemRealized -= llsItemList_ItemRealized; ContentPanel.ManipulationCompleted -= ContentPanel_ManipulationCompleted; adControl = null; NavBar.SelectedEvent -= NavBar_SelectedEvent; NavBar.Dispose(); }
private void DisposeAll() { _wbContent.Navigating -= wbContent_Navigating; _wbContent.Navigated -= wbsContent_Navigated; _wbContent.LoadCompleted -= wbContent_LoadCompleted; _wbContent.IsScriptEnabled = false; _wbContent.NavigateToString("<html></html>"); WBContainer.Child = null; brdTitle.ManipulationCompleted -= Border_ManipulationCompleted; _itemContainer.Dispose(); adControl.StopAds(); adControl.Dispose(); NavBar.Dispose(); }
private void BindingNavBarForPrevStoredItemsPage() { var navBarViewModel = new NavBarViewModel(); navBarViewModel.SecondBrothers.Add(new Brother() { Id = null, Name = "tin đã lưu", ImageUri = null, Stats = "lưu các tin hay trên điện thoại", Selected = true, NavigateUri = null }); navBarViewModel.SecondBrothers.Add(new Brother() { Id = null, Name = "xem theo báo", ImageUri = null, Stats = "xem theo các đầu báo đã cài", Selected = true, PostAction = ViewModels.PostAction.Navigation, NavigateUri = new Uri("/HubTilePage.xaml", UriKind.Relative) }); navBarViewModel.SecondBrothers.Add(new Brother() { Id = null, Name = "xem theo mục", ImageUri = null, Stats = "xem nhóm các báo theo chuyên mục", Selected = true, PostAction = ViewModels.PostAction.Navigation, NavigateUri = new Uri("/CustomViewPage.xaml", UriKind.Relative) }); NavBar.BindingNavBar(navBarViewModel); NavBar.Navigation = ((uri, id) => { DisposeAll(); NavigationService.Navigate(uri); }); NavBar.NavigateHome = (() => this.BackToMainPage()); }
private void BindingNavBarForPrevFeedPage() { var navBarViewModel = new NavBarViewModel(); var item = _itemContainer.AllItemViewModels[_currentIndex]; var subscribedPublisher = _feedManager.GetSubscribedPublishers(); subscribedPublisher.Target.ForEach(p => { navBarViewModel.FirstBrothers.Add(new Brother() { Id = p.Id.ToString(), Name = p.Name, ImageUri = p.ImageUri.ToString().StartsWith("/") ? p.ImageUri : new Uri("/" + p.ImageUri.ToString(), UriKind.Relative), Stats = PublisherHelper.GetStatsString(p.Id), Selected = p.Id.Equals(_itemContainer.Publisher.Id), PostAction = ViewModels.PostAction.Navigation, NavigateUri = new Uri(string.Format("/FeedPage.xaml?publisherId={0}&feedId={1}", p.Id, p.FeedIds[0]), UriKind.Relative) }); }); navBarViewModel.FirstBrothers.Add(new Brother() { Id = string.Empty, Name = string.Empty, ImageUri = new Uri("/Images/publishers/install.png", UriKind.Relative), Stats = "cài thêm hoặc gỡ bớt báo", Selected = false, PostAction = PostAction.Navigation, NavigateUri = new Uri("/PublisherPickupPage.xaml", UriKind.Relative) }); _itemContainer.Publisher.FeedIds.ForEach(f => { var feedResult = _feedManager.GetSubscribedFeed(f); if (feedResult.HasError) { return; } navBarViewModel.SecondBrothers.Add(new Brother() { Id = f.ToString(), Name = feedResult.Target.Name, ImageUri = null, Stats = FeedHelper.GetStatsString(f), Selected = f.Equals(_itemContainer.Id), PostAction = ViewModels.PostAction.Navigation, NavigateUri = new Uri(string.Format("/FeedPage.xaml?publisherId={0}&feedId={1}", _itemContainer.Publisher.Id, f), UriKind.Relative) }); }); if (_itemContainer.Publisher.FeedIds.Count > 1) { navBarViewModel.SecondBrothers.Add(new Brother() { Id = string.Empty, Name = "Cài thêm chuyên mục", ImageUri = null, Stats = "hoặc gỡ bớt chuyên mục không thích", Selected = false, PostAction = PostAction.Navigation, NavigateUri = new Uri("/FeedPickupPage.xaml?publisherId=" + _itemContainer.Publisher.Id.ToString(), UriKind.Relative) }); } NavBar.BindingNavBar(navBarViewModel); NavBar.Navigation = ((uri, id) => { DisposeAll(); if (!id.Equals(_itemContainer.Publisher.Id)) { UserBehaviorManager.Instance.Log(UserAction.PubEnter, _itemContainer.Publisher.Id.ToString()); } if (!id.Equals(_itemContainer.Id)) { UserBehaviorManager.Instance.Log(UserAction.FeedEnter, _itemContainer.Id.ToString()); } NavigationService.Navigate(uri); }); NavBar.NavigateHome = (() => this.BackToMainPage()); }
private void BindingNavBar() { var navBarViewModel = new NavBarViewModel(); var subscribedPublisher = _feedManager.GetSubscribedPublishers(); subscribedPublisher.Target.ForEach(p => { navBarViewModel.FirstBrothers.Add(new Brother() { Id = p.Id.ToString(), Name = p.Name, ImageUri = p.ImageUri.ToString().StartsWith("/") ? p.ImageUri : new Uri("/" + p.ImageUri.ToString(), UriKind.Relative), Stats = PublisherHelper.GetStatsString(p.Id), Selected = p.Id.Equals(_viewModel.Publisher.Id), PostAction = ViewModels.PostAction.Binding, BindingData = new BindingData() { PublisherId = p.Id, FeedId = p.FeedIds[0], CategoryId = default(Guid) } }); }); navBarViewModel.FirstBrothers.Add(new Brother() { Id = string.Empty, Name = string.Empty, ImageUri = new Uri("/Images/publishers/install.png", UriKind.Relative), Stats = "cài thêm hoặc gỡ bớt báo", Selected = false, PostAction = PostAction.Navigation, NavigateUri = new Uri("/PublisherPickupPage.xaml", UriKind.Relative) }); _currentPublisher.FeedIds.ForEach(f => { var feedResult = _feedManager.GetSubscribedFeed(f); if (feedResult.HasError) { return; } navBarViewModel.SecondBrothers.Add(new Brother() { Id = f.ToString(), Name = feedResult.Target.Name, ImageUri = null, Stats = FeedHelper.GetStatsString(f), Selected = f.Equals(_viewModel.Id), PostAction = ViewModels.PostAction.Binding, BindingData = new BindingData() { PublisherId = feedResult.Target.Publisher.Id, FeedId = f, CategoryId = default(Guid) } }); }); if (_currentPublisher.FeedIds.Count > 1) { navBarViewModel.SecondBrothers.Add(new Brother() { Id = string.Empty, Name = "Cài thêm chuyên mục", ImageUri = null, Stats = "hoặc gỡ bớt chuyên mục không thích", Selected = false, PostAction = PostAction.Navigation, NavigateUri = new Uri("/FeedPickupPage.xaml?publisherId=" + _currentPublisher.Id.ToString(), UriKind.Relative) }); } NavBar.BindingNavBar(navBarViewModel); NavBar.SelectedEvent -= NavBar_Selected; NavBar.SelectedEvent += NavBar_Selected; NavBar.Navigation = ((uri, id) => NavigationService.Navigate(uri)); NavBar.NavigateHome = (() => this.BackToMainPage()); }