示例#1
0
		public UPnPPageManager(UPnPPresenter presenter)
		{
			Presenter = presenter;
			_pages = new Stack<UPnPPage>();
			_pageDictionary = new Dictionary<Guid, UPnPPage>();
			CurrentPage = new UPnPPage(presenter);
		}
示例#2
0
 public void Push(Page.ePageType pageType)
 {
     lock (this)
     {
         _pages.Push(CurrentPage);
         _pageDictionary.Add(CurrentPage.Id, CurrentPage);
         CurrentPage = new UPnPPage(Presenter) { PageType = pageType };
         Presenter.OnPropertyChanged("CanGoBack");
         Presenter.OnPropertyChanged("Items");
     }
 }
示例#3
0
		/// <summary>
		/// Clears all pages and resets the CurrentPage to a new page.
		/// </summary>
		public void Clear()
		{
			_pages.Clear();
			_pageDictionary.Clear();
			CurrentPage = new UPnPPage(Presenter);
		}
		private void RequestItemActivation(UPnPItem item, UPnPPage page)
		{
			// send ItemActivated only if there is only one item in the Items
			//	list and it is the item that is selected. Otherwise just add
			//	the item that is 'activated'. doing this causes the Gallery
			//	to have an interim stage before calling for an activation of
			//	the item (sending the event)

			if (DoActivation(item, page))
				Open(item, page);
			else
				GoToDetails(item);
		}
		private void Open(AVItem item, UPnPPage page)
		{
			// change the item to a playback item so templating works without
			//	using the event
			if (page.Id != CurrentPage.Id)
				throw new InvalidOperationException(
					"Paging is out of sync. The requested page and the current page must be the same.");
			SetPageType(Page.ePageType.PlaybackActivated, CurrentPage.Id);
			SafeInvoke(() =>
				{
					page.Items.Clear();
					var playback = item.Copy<UPnPPlayback>();
					page.Items.Add(playback);
				});
			// activate after the item is in the list
			OnItemActivated(new ItemActivatedEventArgs(item));
			OnPropertyChanged("Items");
		}
		private bool DoActivation(AVItem item, UPnPPage page)
		{
			if (EnableDetailsPage)
				return page.Items.Count == 1 && page.Items[0].Equals(item);
			return true;
		}