Esempio n. 1
0
		private void Initialization()
		{
			SetupLogging();
			if (Helper.InDesignerMode)
			{
				DebugMessage = "Mockup Mode";
				Presenter = new MockPresenter(Page.ePageType.AVItemCollectionGallery, Settings.Default.Excluded_Folder_Names);
			}
			else
			{
				Presenter = new UPnPPresenter
								{
									TitlesExcludedFromImageReplacement = Settings.Default.Excluded_Folder_Names,
									ImageWidth = Settings.Default.DefaultImageWidth,
									ImageHeight = Settings.Default.DefaultImageHeight,
									EnableDetailsPage = true,
								};
				DebugMessage = string.Empty;
			}
			Presenter.ParseBegin += OnParseBegin;
			Presenter.ParseEnd += OnParseEnd;

			GalleryViewModel = new GalleryViewModel(_commandSink);
			GalleryViewModel.ExecuteInUIThread += OnExecuteInUIThread;
			PlaybackViewModel = new PlaybackViewModel(_commandSink);
			PlaybackViewModel.ExecuteInUIThread += OnExecuteInUIThread;

			CommandsEnabled = true;

			NavigationCommandList = new ObservableCollection<RoutedCommand>
			                        	{
			                        		AppNavigationCommands.BuyNowCommand,
			                        		AppNavigationCommands.GoToSettingsCommand,
			                        		AppNavigationCommands.GoToSupportCommand,
			                        	};

			//Downloads = new ObservableCollection<Download>();
			//Favorites = new ObservableCollection<Favorite>();
			//PlaylistPaths = new ObservableCollection<PlaylistPath>();

			DataModel = UtilityDataModel.NewContext();
			DataModel.SavedChanges += (sender, args) => RefreshData(null);

			if (!Helper.InDesignerMode)
			{
				StartDataRefresher();
			}

			ReplacementPlaybackExtension = DefaultReplacementPlaybackExtension;
			ReplacePlaybackExtension = Settings.Default.ForceWmvPlayback;
			ShowNavigationZone = Settings.Default.ShowNavigationZone;
			ShowFeedbackZone = Settings.Default.ShowFeedbackZone;
			ShowTitleZone = Settings.Default.ShowTitleZone;

			_commandSink = new CommandSink();
			RegisterCommands();
			CommandsReceived = new ObservableCollection<RoutedCommand>();
			Presenter.PropertyChanged += (o, e) =>
											{
												if (e.PropertyName == "ActivePageType")
												{
													_activePageType = Presenter.ActivePageType;
													OnPropertyChanged("ActivePageType");
												}
											};
		}
Esempio n. 2
0
		public PlaybackViewModel(CommandSink commandSink)
		{
			_commandSink = commandSink;
			RegisterCommands();
		}