using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Input;
using System.Windows.Threading;
using SPC.Kiosk.Base;
using SPC.Kiosk.Common;
using SPC.Kiosk.Popup.Model;
namespace SPC.Kiosk.Popup.ViewModel
{
///
/// CallEmployee.xaml 의 ViewModel
///
public class VmCallEmployee : PopupViewModelBase
{
#region [ Members ]
private List messageText = null;
///
/// Message Text
///
public List MessageText
{
get { return messageText; }
set { messageText = value; PropertyChange("MessageText"); }
}
private List infomationText = null;
///
/// Infomation Text
///
public List InfomationText
{
get { return infomationText; }
set { infomationText = value; PropertyChange("InfomationText"); }
}
private bool isCallEmployeeOK = false;
///
/// Is Call Employee Process OK
///
public bool IsCallEmployeeOK
{
get { return isCallEmployeeOK; }
set { isCallEmployeeOK = value; PropertyChange("IsCallEmployeeOK"); }
}
private List cancelButtonText;
///
/// Cancel Button Text
///
public List CancelButtonText
{
get { return cancelButtonText; }
set { cancelButtonText = value; PropertyChange("CancelButtonText"); }
}
private List okButtonText;
///
/// OK Button Text
///
public List OkButtonText
{
get { return okButtonText; }
set { okButtonText = value; PropertyChange("OkButtonText"); }
}
private double okButtonWidth=650d;
///
/// OK Button Width
///
public double OkButtonWidth
{
get { return okButtonWidth; }
set { okButtonWidth = value; PropertyChange("OkButtonWidth"); }
}
private double cancelButtonWidth = 650d;
///
/// Cancel Button Visible
///
public double CancelButtonWidth
{
get { return cancelButtonWidth; }
set { cancelButtonWidth = value; PropertyChange("CancelButtonWidth"); }
}
private string callImage;
///
/// Call Image Enabled (On Error Enabled False)
///
public string CallImage
{
get { return callImage; }
set { callImage = value; PropertyChange("CallImage"); }
}
private double popupWidth=1300d;
///
/// Popup Whidth (For Calculate OK Button Width)
///
public double PopupWidth
{
get { return popupWidth; }
set { popupWidth = value; PropertyChange("PopupWidth"); }
}
///
/// OK Click Command
///
public ICommand OkCommand { get; protected set; }
///
/// Cancel Click Command
///
public ICommand CancelCommand { get; protected set; }
#endregion Members
#region [ Ctor ]
///
/// Ctor
///
public VmCallEmployee()
{
OkCommand = new Command(OkCommandHandler);
CancelCommand = new Command(CancelCommandHandler);
this.PropertyChanged += VmCallEmployee_PropertyChanged;
ShowLanguageType = CommonValue.CommonLanguageType;
CallImage = ResourceManager.GetNximagePathAdd("ic_alert_help.png", CommonValue.PBdesignImagesPath);
MessageText = Languages.GetMessages("LBL0102");
InfomationText = new List();
OkButtonText = Languages.GetMessages("BTN0005");
CancelButtonText = Languages.GetMessages("BTN0021");
}
~VmCallEmployee()
{
this.PropertyChanged -= VmCallEmployee_PropertyChanged;
}
#endregion Ctor
#region [ Event Handlers ]
private void CancelCommandHandler(object obj)
{
TimerEnabled = false;
ReturnValue = new M_PopupReturn
{
OKAnswer = false,
TimeOut = false,
ReturnLanguage = ShowLanguageType,
PopupArgs = null
};
CanWindowClose = true;
}
private void OkCommandHandler(object obj)
{
TimerEnabled = false;
if (IsCallEmployeeOK)
{
ReturnValue = new M_PopupReturn
{
OKAnswer = true,
TimeOut = false,
ReturnLanguage = ShowLanguageType,
PopupArgs = null
};
CanWindowClose = true;
}
else
{
IsCallEmployeeOK = true;
}
}
private void VmCallEmployee_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
switch (e.PropertyName)
{
case "IsTimeout":
if (IsTimeout)
{
ReturnValue = new M_PopupReturn
{
OKAnswer = false,
TimeOut = true,
ReturnLanguage = ShowLanguageType,
PopupArgs = null
};
CanWindowClose = true;
}
break;
case "IsCallEmployeeOK":
if (IsCallEmployeeOK)
{
CallImage = ResourceManager.GetNximagePathAdd("ic_alert_check.png", CommonValue.PBdesignImagesPath);
MessageText = Languages.GetMessages("LBL0101");
InfomationText = new List();
OkButtonWidth =PopupWidth;
CancelButtonWidth = 0;
OkButtonText = Languages.GetMessages("BTN0039");
}
break;
}
}
#endregion Event Handlers
}
}