// --------------------------------------------------------------------------------------------------------------------
//
// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
//
//
// Defines the ErrorViewModel type.
//
// --------------------------------------------------------------------------------------------------------------------
namespace HandBrakeWPF.ViewModels
{
using System;
using System.Windows;
using HandBrakeWPF.Properties;
using HandBrakeWPF.ViewModels.Interfaces;
///
/// The Error View Model
///
public class ErrorViewModel : ViewModelBase, IErrorViewModel
{
#region Constants and Fields
///
/// The details.
///
private string details;
///
/// The error message.
///
private string errorMessage;
///
/// The solution.
///
private string solution;
#endregion
#region Constructors and Destructors
///
/// Initializes a new instance of the class.
///
public ErrorViewModel()
{
this.Title = Resources.Error;
this.ErrorMessage = Resources.ErrorViewModel_UnknownError;
this.Details = Resources.ErrorViewModel_NoFurtherInformation;
}
#endregion
#region Properties
///
/// Gets or sets Details.
///
public string Details
{
get
{
return string.IsNullOrEmpty(this.details) ? Resources.ErrorViewModel_NoFurtherInformation : this.details;
}
set
{
this.details = value;
this.NotifyOfPropertyChange("Details");
}
}
///
/// Gets or sets ErrorMessage.
///
public string ErrorMessage
{
get
{
return this.errorMessage;
}
set
{
this.errorMessage = value;
this.NotifyOfPropertyChange("ErrorMessage");
}
}
///
/// Gets or sets Solution.
///
public string Solution
{
get
{
return string.IsNullOrEmpty(this.solution) ? Resources.ErrorViewModel_IfTheProblemPersists : this.solution;
}
set
{
this.solution = value;
this.NotifyOfPropertyChange("Solution");
}
}
#endregion
///
/// Close this window.
///
public void Close()
{
try
{
this.TryClose();
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
///
/// Copy the Error to the clipboard.
///
public void Copy()
{
Clipboard.SetDataObject(this.ErrorMessage + Environment.NewLine + this.Details, true);
}
}
}