summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF
diff options
context:
space:
mode:
authorSverrir Sigmundarson <[email protected]>2015-11-26 14:22:18 +0100
committerSverrir Sigmundarson <[email protected]>2015-11-26 14:22:18 +0100
commitf0a84ed897f3b8bca6a681b4d43c70d7e8ee012d (patch)
treeb3326452e9e154cf0e3cae892e205dddf915fab8 /win/CS/HandBrakeWPF
parent70e6b6257736722684294f79cb467b54960dd21a (diff)
Using ErrorService.ShowMessageBox instead of MessageBox.Show
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs32
1 files changed, 21 insertions, 11 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs
index 1948a2443..037bacde0 100644
--- a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs
@@ -16,6 +16,7 @@ namespace HandBrakeWPF.ViewModels
using System.IO;
using System.Text;
using System.Linq;
+ using System.Windows;
using System.Windows.Forms;
using Caliburn.Micro;
@@ -31,17 +32,24 @@ namespace HandBrakeWPF.ViewModels
using ChapterMarker = HandBrakeWPF.Services.Encode.Model.Models.ChapterMarker;
using EncodeTask = HandBrakeWPF.Services.Encode.Model.EncodeTask;
using GeneralApplicationException = HandBrakeWPF.Exceptions.GeneralApplicationException;
+ using MessageBox = System.Windows.Forms.MessageBox;
/// <summary>
/// The Chapters View Model
/// </summary>
public class ChaptersViewModel : ViewModelBase, IChaptersViewModel
{
+ #region Constants and Fields
+
+ private readonly IErrorService errorService;
+
/// <summary>
/// The source chapters backing field
/// </summary>
private List<Chapter> sourceChaptersList;
+ #endregion
+
#region Constructors and Destructors
/// <summary>
@@ -53,9 +61,13 @@ namespace HandBrakeWPF.ViewModels
/// <param name="userSettingService">
/// The user Setting Service.
/// </param>
- public ChaptersViewModel(IWindowManager windowManager, IUserSettingService userSettingService)
+ /// <param name="errorService">
+ /// The Error Service
+ /// </param>
+ public ChaptersViewModel(IWindowManager windowManager, IUserSettingService userSettingService, IErrorService errorService)
{
this.Task = new EncodeTask();
+ this.errorService = errorService;
}
#endregion
@@ -235,13 +247,12 @@ namespace HandBrakeWPF.ViewModels
// If the number of chapters don't match, prompt for confirmation
if (importedChapters.Count != this.Task.ChapterNames.Count)
{
- if (DialogResult.Yes !=
- MessageBox.Show(
+ if (MessageBoxResult.Yes !=
+ this.errorService.ShowMessageBox(
string.Format(Resources.ChaptersViewModel_ValidateImportedChapters_ChapterCountMismatchMsg, this.Task.ChapterNames.Count, importedChapters.Count),
Resources.ChaptersViewModel_ValidateImportedChapters_ChapterCountMismatchWarning,
- MessageBoxButtons.YesNo,
- MessageBoxIcon.Question,
- MessageBoxDefaultButton.Button2))
+ MessageBoxButton.YesNo,
+ MessageBoxImage.Question))
{
return false;
}
@@ -255,13 +266,12 @@ namespace HandBrakeWPF.ViewModels
var diffs = importedChapters.Zip(this.Task.ChapterNames, (import, source) => source.Duration - import.Value.Item2);
if (diffs.Count(diff => Math.Abs(diff.TotalSeconds) > 15) > 2)
{
- if (DialogResult.Yes !=
- MessageBox.Show(
+ if (MessageBoxResult.Yes !=
+ this.errorService.ShowMessageBox(
Resources.ChaptersViewModel_ValidateImportedChapters_ChapterDurationMismatchMsg,
Resources.ChaptersViewModel_ValidateImportedChapters_ChapterDurationMismatchWarning,
- MessageBoxButtons.YesNo,
- MessageBoxIcon.Question,
- MessageBoxDefaultButton.Button2))
+ MessageBoxButton.YesNo,
+ MessageBoxImage.Question))
{
return false;
}