diff options
author | sr55 <[email protected]> | 2011-12-27 18:41:31 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2011-12-27 18:41:31 +0000 |
commit | 20fd52b888f111ac2d7670fa3c41e495661cdebd (patch) | |
tree | 9f8f53b17435ed3a8a14df338ec26410a3ecba75 /win/CS/HandBrakeWPF/Services | |
parent | 015a2a45691dee523047f3b2a1a3628a2dd106f9 (diff) |
WinGui: (WPF) Initial work to implement the "Queue" and "Add Preset" Windows. Additional setup work around the main window.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4389 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF/Services')
-rw-r--r-- | win/CS/HandBrakeWPF/Services/ErrorService.cs | 56 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Interfaces/IErrorService.cs | 34 |
2 files changed, 90 insertions, 0 deletions
diff --git a/win/CS/HandBrakeWPF/Services/ErrorService.cs b/win/CS/HandBrakeWPF/Services/ErrorService.cs new file mode 100644 index 000000000..c5d89d5cf --- /dev/null +++ b/win/CS/HandBrakeWPF/Services/ErrorService.cs @@ -0,0 +1,56 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="ErrorService.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The Error Service
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Services
+{
+ using System.Windows;
+ using Interfaces;
+ using Caliburn.Micro;
+ using ViewModels.Interfaces;
+
+ /// <summary>
+ /// The Error Service
+ /// </summary>
+ public class ErrorService : IErrorService
+ {
+ /// <summary>
+ /// Show an Exception Error Window.
+ /// </summary>
+ /// <param name="message"></param>
+ /// <param name="solution"></param>
+ /// <param name="details"></param>
+ public void ShowError(string message, string solution, string details)
+ {
+ IWindowManager windowManager = IoC.Get<IWindowManager>();
+ IErrorViewModel errorViewModel = IoC.Get<IErrorViewModel>();
+
+ if (windowManager != null && errorViewModel != null)
+ {
+ errorViewModel.ErrorMessage = message;
+ errorViewModel.Solution = solution;
+ errorViewModel.Details = details;
+ windowManager.ShowDialog(errorViewModel);
+ }
+ }
+
+ /// <summary>
+ /// Show a Message Box.
+ /// It is good practice to use this, so that if we ever introduce unit testing, the message boxes won't cause issues.
+ /// </summary>
+ /// <param name="message"></param>
+ /// <param name="header"></param>
+ /// <param name="image"></param>
+ /// <param name="buttons"></param>
+ /// <returns></returns>
+ public MessageBoxResult ShowMessageBox(string message, string header, MessageBoxButton buttons, MessageBoxImage image)
+ {
+ return MessageBox.Show(message, header, buttons, image);
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/Services/Interfaces/IErrorService.cs b/win/CS/HandBrakeWPF/Services/Interfaces/IErrorService.cs new file mode 100644 index 000000000..cba3a79b3 --- /dev/null +++ b/win/CS/HandBrakeWPF/Services/Interfaces/IErrorService.cs @@ -0,0 +1,34 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="IErrorService.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The Error Service Interface
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+using System.Windows;
+
+namespace HandBrakeWPF.Services.Interfaces
+{
+ public interface IErrorService
+ {
+ /// <summary>
+ /// Show an Error Window with debug output.
+ /// </summary>
+ /// <param name="message"></param>
+ /// <param name="solution"></param>
+ /// <param name="details"></param>
+ void ShowError(string message, string solution, string details);
+
+ /// <summary>
+ /// Show a Message Box
+ /// </summary>
+ /// <param name="message"></param>
+ /// <param name="header"></param>
+ /// <param name="image"></param>
+ /// <param name="buttons"></param>
+ /// <returns></returns>
+ MessageBoxResult ShowMessageBox(string message, string header, MessageBoxButton buttons, MessageBoxImage image);
+ }
+}
\ No newline at end of file |