/// <summary>
        /// Handles the event indicating a property value is changed.
        /// </summary>
        /// <param name="sender">The instance where the event handler is attached.</param>
        /// <param name="e">The event data.</param>
        private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
            case "IsIdle":
                this.OverrideCursor(this.IsIdle ? null : Cursors.Wait);
                break;

            case "LastWorkNumber":
                this.converter = ThConverterFactory.Create(Settings.Instance.LastTitle);
                this.converter.ConvertFinished    += this.OnConvertFinished;
                this.converter.ConvertAllFinished += this.OnConvertAllFinished;
                this.converter.ExceptionOccurred  += this.OnExceptionOccurred;
                this.IsIdle = true;
                this.Log    = string.Empty;

                this.OnPropertyChanged(() => this.SupportedVersions);
                this.OnPropertyChanged(() => this.ScoreFile);
                this.OnPropertyChanged(() => this.CanHandleBestShot);
                this.OnPropertyChanged(() => this.BestShotDirectory);
                this.OnPropertyChanged(() => this.TemplateFiles);
                this.OnPropertyChanged(() => this.OutputDirectory);
                this.OnPropertyChanged(() => this.ImageOutputDirectory);
                this.OnPropertyChanged(() => this.CanReplaceCardNames);
                this.OnPropertyChanged(() => this.HidesUntriedCards);

                this.ConvertCommand.RaiseCanExecuteChanged();
                break;

            case "ScoreFile":
                this.OnPropertyChanged(() => this.OpenScoreFileDialogInitialDirectory);
                this.ConvertCommand.RaiseCanExecuteChanged();
                break;

            case "BestShotDirectory":
                this.ConvertCommand.RaiseCanExecuteChanged();
                break;

            case "TemplateFiles":
                this.OnPropertyChanged(() => this.OpenTemplateFilesDialogInitialDirectory);
                this.DeleteTemplateFilesCommand.RaiseCanExecuteChanged();
                this.DeleteAllTemplateFilesCommand.RaiseCanExecuteChanged();
                this.ConvertCommand.RaiseCanExecuteChanged();
                break;

            case "OutputDirectory":
                this.ConvertCommand.RaiseCanExecuteChanged();
                break;

            case "ImageOutputDirectory":
                this.ConvertCommand.RaiseCanExecuteChanged();
                break;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindowViewModel"/> class.
        /// </summary>
        public MainWindowViewModel()
        {
            this.converter = null;

            this.Title = Assembly.GetExecutingAssembly().GetName().Name;
            this.Works = WorksImpl;

            this.SelectScoreFileCommand =
                new DelegateCommand <OpenFileDialogActionResult>(this.SelectScoreFile);
            this.SelectBestShotDirectoryCommand =
                new DelegateCommand <FolderBrowserDialogActionResult>(this.SelectBestShotDirectory);
            this.TemplateFilesSelectionChangedCommand =
                new DelegateCommand(this.OnTemplateFilesSelectionChanged);
            this.AddTemplateFilesCommand =
                new DelegateCommand <OpenFileDialogActionResult>(this.AddTemplateFiles);
            this.DeleteTemplateFilesCommand =
                new DelegateCommand <IList>(this.DeleteTemplateFiles, this.CanDeleteTemplateFiles);
            this.DeleteAllTemplateFilesCommand =
                new DelegateCommand(this.DeleteAllTemplateFiles, this.CanDeleteAllTemplateFiles);
            this.SelectOutputDirectoryCommand =
                new DelegateCommand <FolderBrowserDialogActionResult>(this.SelectOutputDirectory);
            this.ConvertCommand =
                new DelegateCommand(this.Convert, this.CanConvert);

            this.DraggingCommand =
                new DelegateCommand <DragEventArgs>(this.OnDragging);
            this.DropScoreFileCommand =
                new DelegateCommand <DragEventArgs>(this.OnDropScoreFile);
            this.DropBestShotDirectoryCommand =
                new DelegateCommand <DragEventArgs>(this.OnDropBestShotDirectory);
            this.DropTemplateFilesCommand =
                new DelegateCommand <DragEventArgs>(this.OnDropTemplateFiles);
            this.DropOutputDirectoryCommand =
                new DelegateCommand <DragEventArgs>(this.OnDropOutputDirectory);

            this.OpenAboutWindowCommand   = new DelegateCommand(this.OpenAboutWindow);
            this.OpenSettingWindowCommand = new DelegateCommand(this.OpenSettingWindow);

            this.PropertyChanged += this.OnPropertyChanged;

            if (string.IsNullOrEmpty(this.LastWorkNumber))
            {
                this.LastWorkNumber = WorksImpl.First().Number;
            }
            else
            {
                this.OnPropertyChanged(() => this.LastWorkNumber);
            }
        }