// --------------------------------------------------------------------------------------------------------------------
//
// 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.ComponentModel.Composition;
using System.Windows;
using HandBrakeWPF.ViewModels.Interfaces;
///
/// The Error View Model
///
[Export(typeof(IErrorViewModel))]
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()
: base(null)
{
this.Title = "Error";
this.ErrorMessage = "An Unknown Error has occured.";
this.Details = "There is no further information available about this error.";
}
#endregion
#region Properties
///
/// Gets or sets Details.
///
public string Details
{
get
{
return string.IsNullOrEmpty(this.details) ? "There is no further information available about this error." : 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) ? "If the problem presists, please try restarting HandBrake." : 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);
}
}
}