}\r
set\r
{\r
- this.CurrentTask.Destination = value;\r
- this.NotifyOfPropertyChange(() => this.Destination);\r
+ if (!object.Equals(this.CurrentTask.Destination, value))\r
+ {\r
+ this.CurrentTask.Destination = value;\r
+ this.NotifyOfPropertyChange(() => this.Destination);\r
+\r
+ if (!string.IsNullOrEmpty(this.CurrentTask.Destination))\r
+ {\r
+ switch (Path.GetExtension(this.CurrentTask.Destination))\r
+ {\r
+ case ".mkv":\r
+ this.SelectedOutputFormat = OutputFormat.Mkv;\r
+ break;\r
+ case ".mp4":\r
+ this.SelectedOutputFormat = OutputFormat.Mp4;\r
+ break;\r
+ case ".m4v":\r
+ this.SelectedOutputFormat = OutputFormat.Mp4;\r
+ break;\r
+ case ".x265":\r
+ this.SelectedOutputFormat = OutputFormat.X265;\r
+ break;\r
+ }\r
+ }\r
+ }\r
}\r
}\r
\r
\r
set\r
{\r
- this.selectedOutputFormat = value;\r
- this.CurrentTask.OutputFormat = value;\r
- this.NotifyOfPropertyChange(() => SelectedOutputFormat);\r
- this.NotifyOfPropertyChange(() => this.CurrentTask.OutputFormat);\r
- this.NotifyOfPropertyChange(() => IsMkv);\r
- this.SetExtension(string.Format(".{0}", this.selectedOutputFormat.ToString().ToLower()));\r
+ if (!object.Equals(this.selectedOutputFormat, value))\r
+ {\r
+ this.selectedOutputFormat = value;\r
+ this.CurrentTask.OutputFormat = value;\r
+ this.NotifyOfPropertyChange(() => SelectedOutputFormat);\r
+ this.NotifyOfPropertyChange(() => this.CurrentTask.OutputFormat);\r
+ this.NotifyOfPropertyChange(() => IsMkv);\r
+ this.SetExtension(string.Format(".{0}", this.selectedOutputFormat.ToString().ToLower()));\r
\r
- this.VideoViewModel.RefreshTask();\r
- this.AudioViewModel.RefreshTask();\r
+ this.VideoViewModel.RefreshTask();\r
+ this.AudioViewModel.RefreshTask();\r
+ }\r
}\r
}\r
\r
}\r
\r
QueueTask task = new QueueTask(new EncodeTask(this.CurrentTask), HBConfigurationFactory.Create());\r
- \r
+\r
if (!this.queueProcessor.CheckForDestinationPathDuplicates(task.Task.Destination))\r
{\r
this.queueProcessor.Add(task);\r
AddExtension = true,\r
DefaultExt = ".mp4",\r
OverwritePrompt = true,\r
- FilterIndex = this.CurrentTask.OutputFormat == OutputFormat.Mkv ? 1 : 0,\r
};\r
\r
+ string extension = Path.GetExtension(this.CurrentTask.Destination);\r
+\r
+ saveFileDialog.FilterIndex = !string.IsNullOrEmpty(this.CurrentTask.Destination)\r
+ && !string.IsNullOrEmpty(extension)\r
+ ? (extension == ".mp4" || extension == ".m4v" ? 1 : 2)\r
+ : (this.CurrentTask.OutputFormat == OutputFormat.Mkv ? 2 : 0);\r
+\r
if (this.CurrentTask != null && !string.IsNullOrEmpty(this.CurrentTask.Destination))\r
{\r
saveFileDialog.InitialDirectory = Directory.Exists(Path.GetDirectoryName(this.CurrentTask.Destination))\r
saveFileDialog.FileName = Path.GetFileName(this.CurrentTask.Destination);\r
}\r
\r
- saveFileDialog.ShowDialog();\r
- this.Destination = saveFileDialog.FileName;\r
-\r
- // Set the Extension Dropdown. This will also set Mp4/m4v correctly.\r
- if (!string.IsNullOrEmpty(saveFileDialog.FileName))\r
+ bool? result = saveFileDialog.ShowDialog();\r
+ if (result.HasValue && result.Value)\r
{\r
- switch (Path.GetExtension(saveFileDialog.FileName))\r
+ this.Destination = saveFileDialog.FileName;\r
+\r
+ // Set the Extension Dropdown. This will also set Mp4/m4v correctly.\r
+ if (!string.IsNullOrEmpty(saveFileDialog.FileName))\r
{\r
- case ".mkv":\r
- this.SelectedOutputFormat = OutputFormat.Mkv;\r
- break;\r
- case ".mp4":\r
- this.SelectedOutputFormat = OutputFormat.Mp4;\r
- break;\r
- case ".m4v":\r
- this.SelectedOutputFormat = OutputFormat.M4V;\r
- break;\r
- case ".x265":\r
- this.SelectedOutputFormat = OutputFormat.X265;\r
- break;\r
- }\r
+ switch (Path.GetExtension(saveFileDialog.FileName))\r
+ {\r
+ case ".mkv":\r
+ this.SelectedOutputFormat = OutputFormat.Mkv;\r
+ break;\r
+ case ".mp4":\r
+ this.SelectedOutputFormat = OutputFormat.Mp4;\r
+ break;\r
+ case ".m4v":\r
+ this.SelectedOutputFormat = OutputFormat.M4V;\r
+ break;\r
+ case ".x265":\r
+ this.SelectedOutputFormat = OutputFormat.X265;\r
+ break;\r
+ }\r
\r
- this.NotifyOfPropertyChange(() => this.CurrentTask);\r
+ this.NotifyOfPropertyChange(() => this.CurrentTask);\r
+ }\r
}\r
}\r
\r