コード例 #1
0
ファイル: MainViewModel.cs プロジェクト: Runcy/VidCoder
		private void UpdateFromNewVideoSource()
		{
			Title selectTitle = null;

			if (this.sourceData != null && this.sourceData.Titles != null && this.sourceData.Titles.Count > 0)
			{
				selectTitle = Utilities.GetFeatureTitle(this.sourceData.Titles, this.sourceData.FeatureTitle);
			}

			if (selectTitle != null)
			{
				this.ScanError = false;
				this.SelectedTitle = selectTitle;
				this.RaisePropertyChanged(() => this.Titles);
				this.RaisePropertyChanged(() => this.TitleVisible);
				this.CloseVideoSourceCommand.RaiseCanExecuteChanged();
				this.RaisePropertyChanged(() => this.CanCloseVideoSource);
				this.RaisePropertyChanged(() => this.HasVideoSource);
				this.RaisePropertyChanged(() => this.SourceOptionsVisible);
			}
			else
			{
				this.sourceData = null;
				this.CloseVideoSourceCommand.RaiseCanExecuteChanged();
				this.RaisePropertyChanged(() => this.CanCloseVideoSource);
				this.RaisePropertyChanged(() => this.HasVideoSource);
				this.RaisePropertyChanged(() => this.SourceOptionsVisible);
				this.RaisePropertyChanged(() => this.SourcePicked);
				this.ScanError = true;
			}

			DispatchService.BeginInvoke(() => Messenger.Default.Send(new VideoSourceChangedMessage()));
		}
コード例 #2
0
ファイル: MainViewModel.cs プロジェクト: Runcy/VidCoder
		private void ClearVideoSource()
		{
			this.sourceData = null;
			this.SourceSelectionExpanded = false;
			this.CloseVideoSourceCommand.RaiseCanExecuteChanged();
			this.RaisePropertyChanged(() => this.CanCloseVideoSource);
			this.RaisePropertyChanged(() => this.HasVideoSource);
			this.RaisePropertyChanged(() => this.SourceOptionsVisible);
			this.RaisePropertyChanged(() => this.SourcePicked);

			DispatchService.BeginInvoke(() => Messenger.Default.Send(new VideoSourceChangedMessage()));
			Messenger.Default.Send(new RefreshPreviewMessage());
		}
コード例 #3
0
ファイル: MainViewModel.cs プロジェクト: Runcy/VidCoder
		public void UpdateDriveCollection()
		{
			// Get new set of drives
			IList<DriveInformation> newDriveCollection = this.driveService.GetDiscInformation();

			// If our currently selected source is a DVD drive, see if it needs to be updated
			if (this.SelectedSource != null && this.SelectedSource.Type == SourceType.Dvd)
			{
				string currentRootDirectory = this.SelectedSource.DriveInfo.RootDirectory;
				bool currentDrivePresent = newDriveCollection.Any(driveInfo => driveInfo.RootDirectory == currentRootDirectory);

				if (this.SelectedSource.DriveInfo.Empty && currentDrivePresent)
				{
					// If we were empty and the drive is now here, update and scan it
					this.SelectedSource.DriveInfo.Empty = false;
					this.SelectedSource.DriveInfo.VolumeLabel = newDriveCollection.Single(driveInfo => driveInfo.RootDirectory == currentRootDirectory).VolumeLabel;
					this.SetSourceFromDvd(this.SelectedSource.DriveInfo);
					this.RaisePropertyChanged(() => this.HasVideoSource);
					this.RaisePropertyChanged(() => this.SourceText);
				}
				else if (!this.SelectedSource.DriveInfo.Empty && !currentDrivePresent)
				{
					// If we had an item and the drive is now gone, update and remove the video source.
					DriveInformation emptyDrive = this.SelectedSource.DriveInfo;
					emptyDrive.Empty = true;

					this.sourceData = null;
					this.SelectedTitle = null;
					this.RaisePropertyChanged(() => this.HasVideoSource);
					this.RaisePropertyChanged(() => this.SourceText);
				}
			}

			this.DriveCollection = newDriveCollection;
		}