/// The static Preview View Model.\r
/// </param>\r
public MainViewModel(IUserSettingService userSettingService, IScan scanService, IEncode encodeService, IPresetService presetService,\r
- IErrorService errorService, IUpdateService updateService, INotificationService notificationService,\r
- IPrePostActionService whenDoneService, IWindowManager windowManager, IPictureSettingsViewModel pictureSettingsViewModel, IVideoViewModel videoViewModel, \r
+ IErrorService errorService, IUpdateService updateService, INotificationService notificationService,\r
+ IPrePostActionService whenDoneService, IWindowManager windowManager, IPictureSettingsViewModel pictureSettingsViewModel, IVideoViewModel videoViewModel,\r
IFiltersViewModel filtersViewModel, IAudioViewModel audioViewModel, ISubtitlesViewModel subtitlesViewModel,\r
IAdvancedViewModel advancedViewModel, IChaptersViewModel chaptersViewModel, IStaticPreviewViewModel staticPreviewViewModel)\r
{\r
{\r
return new List<PointToPointMode>\r
{\r
- PointToPointMode.Chapters, PointToPointMode.Seconds, PointToPointMode.Frames \r
+ PointToPointMode.Chapters, PointToPointMode.Seconds, PointToPointMode.Frames\r
};\r
}\r
}\r
\r
// Queue Recovery\r
QueueRecoveryHelper.RecoverQueue(this.queueProcessor, this.errorService);\r
- \r
+\r
this.SelectedPreset = this.presetService.DefaultPreset;\r
\r
// Log Cleaning\r
IQueueSelectionViewModel viewModel = IoC.Get<IQueueSelectionViewModel>();\r
\r
viewModel.Setup(this.ScannedSource, this.SourceName, (tasks) =>\r
+ {\r
+ foreach (SelectionTitle title in tasks)\r
{\r
- foreach (SelectionTitle title in tasks)\r
- {\r
- this.SelectedTitle = title.Title;\r
- this.AddToQueue();\r
- }\r
- });\r
+ this.SelectedTitle = title.Title;\r
+ this.AddToQueue();\r
+ }\r
+ });\r
\r
if (window != null)\r
{\r
public void FolderScan()\r
{\r
VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog { Description = Resources.Main_PleaseSelectFolder, UseDescriptionForTitle = true };\r
- dialog.ShowDialog();\r
+ bool? dialogResult = dialog.ShowDialog();\r
\r
- ShowSourceSelection = false;\r
+ if (dialogResult.HasValue && dialogResult.Value)\r
+ {\r
+ ShowSourceSelection = false;\r
\r
- this.StartScan(dialog.SelectedPath, this.TitleSpecificScan);\r
+ this.StartScan(dialog.SelectedPath, this.TitleSpecificScan);\r
+ }\r
}\r
\r
/// <summary>\r
public void FileScan()\r
{\r
OpenFileDialog dialog = new OpenFileDialog { Filter = "All files (*.*)|*.*" };\r
- dialog.ShowDialog();\r
+ bool? dialogResult = dialog.ShowDialog();\r
\r
- ShowSourceSelection = false;\r
+ if (dialogResult.HasValue && dialogResult.Value)\r
+ {\r
+ ShowSourceSelection = false;\r
\r
- this.StartScan(dialog.FileName, this.TitleSpecificScan);\r
+ this.StartScan(dialog.FileName, this.TitleSpecificScan);\r
+ }\r
}\r
\r
/// <summary>\r
public void BrowseDestination()\r
{\r
SaveFileDialog saveFileDialog = new SaveFileDialog\r
- {\r
- Filter = "mp4|*.mp4;*.m4v|mkv|*.mkv",\r
- CheckPathExists = true,\r
- AddExtension = true,\r
- DefaultExt = ".mp4",\r
- OverwritePrompt = true,\r
- };\r
+ {\r
+ Filter = "mp4|*.mp4;*.m4v|mkv|*.mkv",\r
+ CheckPathExists = true,\r
+ AddExtension = true,\r
+ DefaultExt = ".mp4",\r
+ OverwritePrompt = true,\r
+ };\r
\r
string extension = Path.GetExtension(this.CurrentTask.Destination);\r
\r
public void PresetImport()\r
{\r
OpenFileDialog dialog = new OpenFileDialog { Filter = "Preset Files|*.json;*.plist", CheckFileExists = true };\r
- dialog.ShowDialog();\r
- this.presetService.Import(dialog.FileName);\r
- this.NotifyOfPropertyChange(() => this.Presets);\r
+ bool? dialogResult = dialog.ShowDialog();\r
+ if (dialogResult.HasValue && dialogResult.Value)\r
+ {\r
+ this.presetService.Import(dialog.FileName);\r
+ this.NotifyOfPropertyChange(() => this.Presets);\r
+ }\r
}\r
\r
/// <summary>\r
public void PresetExport()\r
{\r
SaveFileDialog savefiledialog = new SaveFileDialog\r
- {\r
- Filter = "json|*.json",\r
- CheckPathExists = true,\r
- AddExtension = true,\r
- DefaultExt = ".json",\r
- OverwritePrompt = true,\r
- FilterIndex = 0\r
- };\r
+ {\r
+ Filter = "json|*.json",\r
+ CheckPathExists = true,\r
+ AddExtension = true,\r
+ DefaultExt = ".json",\r
+ OverwritePrompt = true,\r
+ FilterIndex = 0\r
+ };\r
if (this.selectedPreset != null)\r
{\r
savefiledialog.ShowDialog();\r
{\r
/* TODO Fix this. */\r
Execute.OnUIThread(() =>\r
- {\r
- // Copy all the Scan data into the UI\r
- scannedSource.CopyTo(this.ScannedSource);\r
- this.NotifyOfPropertyChange(() => this.ScannedSource);\r
- this.NotifyOfPropertyChange(() => this.ScannedSource.Titles);\r
+ {\r
+ // Copy all the Scan data into the UI\r
+ scannedSource.CopyTo(this.ScannedSource);\r
+ this.NotifyOfPropertyChange(() => this.ScannedSource);\r
+ this.NotifyOfPropertyChange(() => this.ScannedSource.Titles);\r
\r
- // Select the Users Title\r
- this.SelectedTitle = this.ScannedSource.Titles.FirstOrDefault();\r
- this.CurrentTask = new EncodeTask(queueEditTask);\r
- this.NotifyOfPropertyChange(() => this.CurrentTask);\r
- this.HasSource = true;\r
+ // Select the Users Title\r
+ this.SelectedTitle = this.ScannedSource.Titles.FirstOrDefault();\r
+ this.CurrentTask = new EncodeTask(queueEditTask);\r
+ this.NotifyOfPropertyChange(() => this.CurrentTask);\r
+ this.HasSource = true;\r
\r
- // Update the Main Window\r
- this.NotifyOfPropertyChange(() => this.Destination);\r
- this.NotifyOfPropertyChange(() => this.SelectedStartPoint);\r
- this.NotifyOfPropertyChange(() => this.SelectedEndPoint);\r
- this.NotifyOfPropertyChange(() => this.SelectedAngle);\r
- this.NotifyOfPropertyChange(() => this.SelectedPointToPoint);\r
- this.NotifyOfPropertyChange(() => this.SelectedOutputFormat);\r
- this.NotifyOfPropertyChange(() => IsMkv);\r
+ // Update the Main Window\r
+ this.NotifyOfPropertyChange(() => this.Destination);\r
+ this.NotifyOfPropertyChange(() => this.SelectedStartPoint);\r
+ this.NotifyOfPropertyChange(() => this.SelectedEndPoint);\r
+ this.NotifyOfPropertyChange(() => this.SelectedAngle);\r
+ this.NotifyOfPropertyChange(() => this.SelectedPointToPoint);\r
+ this.NotifyOfPropertyChange(() => this.SelectedOutputFormat);\r
+ this.NotifyOfPropertyChange(() => IsMkv);\r
\r
- // Update the Tab Controls\r
- this.PictureSettingsViewModel.UpdateTask(this.CurrentTask);\r
- this.VideoViewModel.UpdateTask(this.CurrentTask);\r
- this.FiltersViewModel.UpdateTask(this.CurrentTask);\r
- this.AudioViewModel.UpdateTask(this.CurrentTask);\r
- this.SubtitleViewModel.UpdateTask(this.CurrentTask);\r
- this.ChaptersViewModel.UpdateTask(this.CurrentTask);\r
- this.AdvancedViewModel.UpdateTask(this.CurrentTask);\r
-\r
- // Cleanup\r
- this.ShowStatusWindow = false;\r
- this.SourceLabel = this.SourceName;\r
- this.StatusLabel = Resources.Main_ScanCompleted;\r
- });\r
+ // Update the Tab Controls\r
+ this.PictureSettingsViewModel.UpdateTask(this.CurrentTask);\r
+ this.VideoViewModel.UpdateTask(this.CurrentTask);\r
+ this.FiltersViewModel.UpdateTask(this.CurrentTask);\r
+ this.AudioViewModel.UpdateTask(this.CurrentTask);\r
+ this.SubtitleViewModel.UpdateTask(this.CurrentTask);\r
+ this.ChaptersViewModel.UpdateTask(this.CurrentTask);\r
+ this.AdvancedViewModel.UpdateTask(this.CurrentTask);\r
+\r
+ // Cleanup\r
+ this.ShowStatusWindow = false;\r
+ this.SourceLabel = this.SourceName;\r
+ this.StatusLabel = Resources.Main_ScanCompleted;\r
+ });\r
}\r
\r
/// <summary>\r
}\r
\r
Execute.OnUIThread(() =>\r
+ {\r
+ if (e.Successful)\r
{\r
- if (e.Successful)\r
- {\r
- this.NotifyOfPropertyChange(() => this.ScannedSource);\r
- this.NotifyOfPropertyChange(() => this.ScannedSource.Titles);\r
- this.HasSource = true;\r
- this.SelectedTitle = this.ScannedSource.Titles.FirstOrDefault(t => t.MainTitle) ?? this.ScannedSource.Titles.FirstOrDefault();\r
- }\r
- else\r
- {\r
- this.OpenAlertWindow(Resources.Main_ScanNoTitlesFound, Resources.Main_ScanNoTitlesFoundMessage);\r
- }\r
+ this.NotifyOfPropertyChange(() => this.ScannedSource);\r
+ this.NotifyOfPropertyChange(() => this.ScannedSource.Titles);\r
+ this.HasSource = true;\r
+ this.SelectedTitle = this.ScannedSource.Titles.FirstOrDefault(t => t.MainTitle) ?? this.ScannedSource.Titles.FirstOrDefault();\r
+ }\r
+ else\r
+ {\r
+ this.OpenAlertWindow(Resources.Main_ScanNoTitlesFound, Resources.Main_ScanNoTitlesFoundMessage);\r
+ }\r
\r
- this.ShowStatusWindow = false;\r
- if (e.Successful)\r
- {\r
- this.SourceLabel = this.SourceName;\r
- this.StatusLabel = Resources.Main_ScanCompleted;\r
- }\r
- else if (e.Cancelled)\r
- {\r
- this.SourceLabel = Resources.Main_ScanCancelled;\r
- this.StatusLabel = Resources.Main_ScanCancelled;\r
- }\r
- else\r
- {\r
- this.SourceLabel = Resources.Main_ScanFailled_CheckLog;\r
- this.StatusLabel = Resources.Main_ScanFailled_CheckLog;\r
- }\r
- });\r
+ this.ShowStatusWindow = false;\r
+ if (e.Successful)\r
+ {\r
+ this.SourceLabel = this.SourceName;\r
+ this.StatusLabel = Resources.Main_ScanCompleted;\r
+ }\r
+ else if (e.Cancelled)\r
+ {\r
+ this.SourceLabel = Resources.Main_ScanCancelled;\r
+ this.StatusLabel = Resources.Main_ScanCancelled;\r
+ }\r
+ else\r
+ {\r
+ this.SourceLabel = Resources.Main_ScanFailled_CheckLog;\r
+ this.StatusLabel = Resources.Main_ScanFailled_CheckLog;\r
+ }\r
+ });\r
}\r
\r
/// <summary>\r
}\r
}\r
\r
+\r
#endregion\r
\r
#region Output Files\r
/// </summary>\r
public void BrowseSendFileTo()\r
{\r
- VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "All files (*.*)|*.*" };\r
- dialog.ShowDialog();\r
- this.SendFileTo = Path.GetFileNameWithoutExtension(dialog.FileName);\r
- this.sendFileToPath = dialog.FileName;\r
+ VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "All files (*.*)|*.*", FileName = this.sendFileToPath };\r
+ bool? dialogResult = dialog.ShowDialog();\r
+ if (dialogResult.HasValue && dialogResult.Value)\r
+ {\r
+ this.SendFileTo = Path.GetFileNameWithoutExtension(dialog.FileName);\r
+ this.sendFileToPath = dialog.FileName;\r
+ }\r
}\r
\r
/// <summary>\r
/// </summary>\r
public void BrowseAutoNamePath()\r
{\r
- VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog { Description = "Please select a folder.", UseDescriptionForTitle = true };\r
- dialog.ShowDialog();\r
- this.AutoNameDefaultPath = dialog.SelectedPath;\r
+ VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog { Description = "Please select a folder.", UseDescriptionForTitle = true, SelectedPath = this.AutoNameDefaultPath };\r
+ bool? dialogResult = dialog.ShowDialog();\r
+ if (dialogResult.HasValue && dialogResult.Value)\r
+ {\r
+ this.AutoNameDefaultPath = dialog.SelectedPath;\r
+ }\r
}\r
\r
/// <summary>\r
/// </summary>\r
public void BrowseVlcPath()\r
{\r
- VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "All files (*.exe)|*.exe" };\r
- dialog.ShowDialog();\r
- this.VLCPath = dialog.FileName;\r
+ VistaOpenFileDialog dialog = new VistaOpenFileDialog { Filter = "All files (*.exe)|*.exe", FileName = this.VLCPath };\r
+ bool? dialogResult = dialog.ShowDialog();\r
+ if (dialogResult.HasValue && dialogResult.Value)\r
+ {\r
+ this.VLCPath = dialog.FileName;\r
+ }\r
}\r
\r
/// <summary>\r
/// </summary>\r
public void BrowseLogPath()\r
{\r
- VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog { Description = "Please select a folder.", UseDescriptionForTitle = true };\r
- dialog.ShowDialog();\r
- this.LogDirectory = dialog.SelectedPath;\r
+ VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog { Description = "Please select a folder.", UseDescriptionForTitle = true, SelectedPath = this.LogDirectory };\r
+ bool? dialogResult = dialog.ShowDialog();\r
+ if (dialogResult.HasValue && dialogResult.Value)\r
+ {\r
+ this.LogDirectory = dialog.SelectedPath;\r
+ }\r
}\r
\r
/// <summary>\r
this.MinLength = this.userSettingService.GetUserSetting<int>(UserSettingConstants.MinScanDuration);\r
\r
// Use dvdnav\r
- this.DisableLibdvdNav = userSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav); \r
+ this.DisableLibdvdNav = userSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav);\r
}\r
\r
/// <summary>\r
\r
/* Previews */\r
this.userSettingService.SetUserSetting(UserSettingConstants.VLCPath, this.VLCPath);\r
- \r
+\r
/* Video */\r
this.userSettingService.SetUserSetting(UserSettingConstants.DisableQuickSyncDecoding, this.DisableQuickSyncDecoding);\r
this.userSettingService.SetUserSetting(UserSettingConstants.EnableDxva, this.EnableDxvaDecoding);\r