using System.IO;\r
using System.Text;\r
using System.Linq;\r
+ using System.Windows;\r
using System.Windows.Forms;\r
\r
using Caliburn.Micro;\r
using ChapterMarker = HandBrakeWPF.Services.Encode.Model.Models.ChapterMarker;\r
using EncodeTask = HandBrakeWPF.Services.Encode.Model.EncodeTask;\r
using GeneralApplicationException = HandBrakeWPF.Exceptions.GeneralApplicationException;\r
+ using MessageBox = System.Windows.Forms.MessageBox;\r
\r
/// <summary>\r
/// The Chapters View Model\r
/// </summary>\r
public class ChaptersViewModel : ViewModelBase, IChaptersViewModel\r
{\r
+ #region Constants and Fields\r
+\r
+ private readonly IErrorService errorService;\r
+\r
/// <summary>\r
/// The source chapters backing field\r
/// </summary>\r
private List<Chapter> sourceChaptersList;\r
\r
+ #endregion\r
+\r
#region Constructors and Destructors\r
\r
/// <summary>\r
/// <param name="userSettingService">\r
/// The user Setting Service.\r
/// </param>\r
- public ChaptersViewModel(IWindowManager windowManager, IUserSettingService userSettingService)\r
+ /// <param name="errorService">\r
+ /// The Error Service \r
+ /// </param>\r
+ public ChaptersViewModel(IWindowManager windowManager, IUserSettingService userSettingService, IErrorService errorService)\r
{\r
this.Task = new EncodeTask();\r
+ this.errorService = errorService;\r
}\r
\r
#endregion\r
// If the number of chapters don't match, prompt for confirmation\r
if (importedChapters.Count != this.Task.ChapterNames.Count)\r
{\r
- if (DialogResult.Yes !=\r
- MessageBox.Show(\r
+ if (MessageBoxResult.Yes !=\r
+ this.errorService.ShowMessageBox(\r
string.Format(Resources.ChaptersViewModel_ValidateImportedChapters_ChapterCountMismatchMsg, this.Task.ChapterNames.Count, importedChapters.Count),\r
Resources.ChaptersViewModel_ValidateImportedChapters_ChapterCountMismatchWarning,\r
- MessageBoxButtons.YesNo,\r
- MessageBoxIcon.Question,\r
- MessageBoxDefaultButton.Button2))\r
+ MessageBoxButton.YesNo,\r
+ MessageBoxImage.Question))\r
{\r
return false;\r
}\r
var diffs = importedChapters.Zip(this.Task.ChapterNames, (import, source) => source.Duration - import.Value.Item2);\r
if (diffs.Count(diff => Math.Abs(diff.TotalSeconds) > 15) > 2)\r
{\r
- if (DialogResult.Yes !=\r
- MessageBox.Show(\r
+ if (MessageBoxResult.Yes !=\r
+ this.errorService.ShowMessageBox(\r
Resources.ChaptersViewModel_ValidateImportedChapters_ChapterDurationMismatchMsg,\r
Resources.ChaptersViewModel_ValidateImportedChapters_ChapterDurationMismatchWarning,\r
- MessageBoxButtons.YesNo,\r
- MessageBoxIcon.Question,\r
- MessageBoxDefaultButton.Button2))\r
+ MessageBoxButton.YesNo,\r
+ MessageBoxImage.Question))\r
{\r
return false;\r
}\r