namespace GDNXFD.Alert.Config.Model
{
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using GDNXFD.Alert.Config.Converters;
using System;
using System.Windows;
using System.Windows.Input;
///
/// Dialog message
///
public class CustomDialogMessage : ObservableObject
{
private Action acceptAction;
private Action cancelAction;
private RelayCommand acceptCommand;
private RelayCommand cancelCommand;
//private TravelTypeToTextConverter travelTypeToTextConverter = new TravelTypeToTextConverter();
private string message;
///
/// Constructor
///
/// Action to be executed when pressing accept button
/// Dialog message
/// Show or not cancel button
public CustomDialogMessage(Action acceptAction, string message, Visibility showCancel)
{
this.acceptAction = acceptAction;
Message = message;
ShowCancel = showCancel;
this.acceptCommand = new RelayCommand(() =>
{
this.acceptAction();
this.cancelAction();
});
}
///
/// Confirms dialog.
///
public ICommand AcceptCommand
{
get { return this.acceptCommand; }
}
///
/// Do nothing.
///
public ICommand CancelCommand
{
get { return this.cancelCommand; }
}
///
/// Action to be executed when cancel command is called.
///
public Action CancelAction {
get { return this.cancelAction; }
set
{
this.cancelAction = value;
this.cancelCommand = new RelayCommand(this.cancelAction);
}
}
///
/// Dialog message.
///
public string Message
{
get
{
return this.message;
}
set
{
this.message = value;
RaisePropertyChanged(() => Message);
}
}
///
/// Show or not cancel button
///
public Visibility ShowCancel { get; set; }
}
}