using Caliburn.Micro;\r
\r
using HandBrakeWPF.Helpers;\r
+ using HandBrakeWPF.Services.Interfaces;\r
using HandBrakeWPF.Startup;\r
using HandBrakeWPF.Utilities;\r
using HandBrakeWPF.ViewModels;\r
try\r
{\r
IWindowManager windowManager = IoC.Get<IWindowManager>();\r
+ IErrorService errorService = IoC.Get<IErrorService>();\r
if (windowManager != null)\r
{\r
- ErrorViewModel errorView = new ErrorViewModel();\r
+ ErrorViewModel errorView = new ErrorViewModel(errorService);\r
GeneralApplicationException applicationException = null;\r
if (exception.GetType() == typeof(GeneralApplicationException))\r
{\r
}\r
}\r
\r
+ /// <summary>\r
+ /// Looks up a localized string similar to The system clipboard is currently unavailable..\r
+ /// </summary>\r
+ public static string Clipboard_Unavailable {\r
+ get {\r
+ return ResourceManager.GetString("Clipboard_Unavailable", resourceCulture);\r
+ }\r
+ }\r
+ \r
+ /// <summary>\r
+ /// Looks up a localized string similar to This may be due to another application monitoring or locking the clipboard for its own use. You will not be able to use the clipboard until it is unlocked..\r
+ /// </summary>\r
+ public static string Clipboard_Unavailable_Solution {\r
+ get {\r
+ return ResourceManager.GetString("Clipboard_Unavailable_Solution", resourceCulture);\r
+ }\r
+ }\r
+ \r
/// <summary>\r
/// Looks up a localized string similar to Confirm.\r
/// </summary>\r
<value>The file '{0}' already exists!\r
Would you like to overwrite it?</value>\r
</data>\r
+ <data name="Clipboard_Unavailable" xml:space="preserve">\r
+ <value>The system clipboard is currently unavailable.</value>\r
+ </data>\r
+ <data name="Clipboard_Unavailable_Solution" xml:space="preserve">\r
+ <value>This may be due to another application monitoring or locking the clipboard for its own use. You will not be able to use the clipboard until it is unlocked.</value>\r
+ </data>\r
</root>
\ No newline at end of file
using System.Windows;\r
\r
using HandBrakeWPF.Properties;\r
+ using HandBrakeWPF.Services.Interfaces;\r
using HandBrakeWPF.ViewModels.Interfaces;\r
\r
/// <summary>\r
/// </summary>\r
public class ErrorViewModel : ViewModelBase, IErrorViewModel\r
{\r
- #region Constants and Fields\r
+ private readonly IErrorService errorService;\r
\r
- /// <summary>\r
- /// The details.\r
- /// </summary>\r
private string details;\r
-\r
- /// <summary>\r
- /// The error message.\r
- /// </summary>\r
private string errorMessage;\r
-\r
- /// <summary>\r
- /// The solution.\r
- /// </summary>\r
private string solution;\r
\r
- #endregion\r
-\r
#region Constructors and Destructors\r
\r
/// <summary>\r
/// Initializes a new instance of the <see cref="ErrorViewModel"/> class.\r
/// </summary>\r
- public ErrorViewModel()\r
+ public ErrorViewModel(IErrorService errorService)\r
{\r
+ this.errorService = errorService;\r
this.Title = Resources.Error;\r
this.ErrorMessage = Resources.ErrorViewModel_UnknownError;\r
this.Details = Resources.ErrorViewModel_NoFurtherInformation;\r
/// </summary>\r
public void Copy()\r
{\r
- Clipboard.SetDataObject(this.ErrorMessage + Environment.NewLine + this.Details, true);\r
+ try\r
+ {\r
+ Clipboard.SetDataObject(this.ErrorMessage + Environment.NewLine + this.Details, true);\r
+ }\r
+ catch (Exception exc)\r
+ {\r
+ this.errorService.ShowError(Resources.Clipboard_Unavailable, Resources.Clipboard_Unavailable_Solution, exc);\r
+ }\r
}\r
}\r
}
\ No newline at end of file
\r
using Caliburn.Micro;\r
\r
+ using HandBrakeWPF.Properties;\r
+ using HandBrakeWPF.Services.Interfaces;\r
using HandBrakeWPF.Utilities;\r
using HandBrakeWPF.ViewModels.Interfaces;\r
\r
/// </summary>\r
public class LogViewModel : ViewModelBase, ILogViewModel\r
{\r
+ private readonly IErrorService errorService;\r
+\r
#region Private Fields\r
\r
private readonly ILog logService;\r
/// <summary>\r
/// Initializes a new instance of the <see cref="LogViewModel"/> class.\r
/// </summary>\r
- public LogViewModel()\r
+ public LogViewModel(IErrorService errorService)\r
{\r
+ this.errorService = errorService;\r
this.logService = LogService.GetLogger();\r
this.Title = "Log Viewer";\r
}\r
/// </summary>\r
public void CopyLog()\r
{\r
- Clipboard.SetDataObject(this.ActivityLog, true);\r
+ try\r
+ {\r
+ Clipboard.SetDataObject(this.ActivityLog, true);\r
+ }\r
+ catch (Exception exc)\r
+ {\r
+ this.errorService.ShowError(Resources.Clipboard_Unavailable, Resources.Clipboard_Unavailable_Solution, exc);\r
+ }\r
}\r
\r
/// <summary>\r