コード例 #1
0
		public UPnPPageManager(UPnPPresenter presenter)
		{
			Presenter = presenter;
			_pages = new Stack<UPnPPage>();
			_pageDictionary = new Dictionary<Guid, UPnPPage>();
			CurrentPage = new UPnPPage(presenter);
		}
コード例 #2
0
		public MainWindowViewModel()
		{
			Constants.SetApplicationName("onCoreTestingClient");
			TraceLevel = TraceLevel.Info;
			DebugMessages = new ObservableCollection<string>();
			SendLogFileMessages = new ObservableCollection<string>();
			_refreshLock = new object();
			Utility.SetupLogging();
			Presenter = new UPnPPresenter();
			Presenter.BrowseResultsReceived +=
				(o, args) =>
				SafeInvoke(() =>
					{
						ViewMessage = string.Format("{0} characters received.", args.BrowseResults.Length);
						DidlData = args.BrowseResults;
					});
			//Presenter.DeviceConnected += (o, args) => SafeInvoke(() => { Device = args.Device; });
			Presenter.ParseBegin += (o, args) => SafeInvoke(() =>
				{
					Status = "parsing data...";
					IsParsing = true;
				});
			Presenter.ParseEnd += (o, args) => SafeInvoke(() =>
				{
					Status = "done parsing data.";
					IsParsing = false;
				});
			Presenter.GoToPathStarted += (s, args) => SafeInvoke(() => Status = string.Format("going to {0}...", args.Path));
			Presenter.GoToPathProgress +=
				(s, args) => SafeInvoke(() => Status = string.Format("Step {0} of {1}: {2}", args.Step, args.Steps, args.Title));
			Presenter.GoToPathCompleted += (s, args) => SafeInvoke(() =>
				{
					var title = "unknown item";
					if (args.Item != null)
					{
						SavePath(Presenter.CurrentPath);
						title = args.Item.Title;
					}
					Status = "at " + title;
				});
			TraceLevel = TraceLevel.Error;
			AutoScroll = true;
			_watcher = Utility.CreateUtilityDataWatcher((o, args) => RefreshModelData());
			Utility.TriggerUtilityDataWatchers();
		}
コード例 #3
0
		public PrimaryViewModel()
		{
			//Utility.AlternateStorageFolder = @"C:\Users\Public\Documents\";
			//Utility.AlternateExecutableFolder = @"C:\Users\Public\Documents\";
			Constants.SetApplicationName("onCoreTestingClient");
			DebugMessages = new ObservableCollection<string>();
			Downloads = new ObservableCollection<Download>();
			Favorites = new ObservableCollection<Favorite>();
			_refreshLock = new object();
			_refreshTimer = new Timer(RefreshModelData, this, TimeSpan.Zero, TimeSpan.FromSeconds(5D));
			SetupLogging();
			Presenter = new UPnPPresenter();
			Presenter.RawDataReceived += (o, args) => SafeInvoke(() =>
																	{
																		ViewMessage = string.Format("{0} characters received.",
																									args.RawData.Length);
																	});
		}
コード例 #4
0
ファイル: UPnPPage.cs プロジェクト: CarverLab/onCore.root
		internal UPnPPage(UPnPPresenter presenter)
		{
			Presenter = presenter;
			Id = Guid.NewGuid();
			_items = new ObservableCollection<AVItemBase>();
		}
コード例 #5
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");
												}
											};
		}