303 lines
9.3 KiB
C#
303 lines
9.3 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.IO;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using System.Threading;
|
|||
|
using System.Windows;
|
|||
|
using System.Windows.Input;
|
|||
|
using System.Windows.Threading;
|
|||
|
using System.Reflection;
|
|||
|
using SPC.Kiosk.Base;
|
|||
|
using SPC.Kiosk.Common;
|
|||
|
using SPC.Kiosk.Popup.Model;
|
|||
|
using SPC.Kiosk.Payments;
|
|||
|
|
|||
|
namespace SPC.Kiosk.Popup.ViewModel
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// HappyPointCertify.xaml에 대한 ViewModel
|
|||
|
/// </summary>
|
|||
|
public class VmNumPadPopup : PopupViewModelBase
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
#region [ Members ]
|
|||
|
private List<M_Language> numPadGuidText;
|
|||
|
/// <summary>
|
|||
|
/// Number Pad Input Guide Text
|
|||
|
/// </summary>
|
|||
|
public List<M_Language> NumPadGuidText
|
|||
|
{
|
|||
|
get { return numPadGuidText; }
|
|||
|
set { numPadGuidText = value; PropertyChange("NumPadGuidText"); }
|
|||
|
}
|
|||
|
private bool formated = false;
|
|||
|
/// <summary>
|
|||
|
/// Input Text Formated
|
|||
|
/// </summary>
|
|||
|
public bool Formated
|
|||
|
{
|
|||
|
get { return formated; }
|
|||
|
set { formated = value; PropertyChange("Formated"); }
|
|||
|
}
|
|||
|
private bool isPassword = false;
|
|||
|
/// <summary>
|
|||
|
/// Input Text Formated
|
|||
|
/// </summary>
|
|||
|
public bool IsPassword
|
|||
|
{
|
|||
|
get { return isPassword; }
|
|||
|
set { isPassword = value; PropertyChange("IsPassword"); }
|
|||
|
}
|
|||
|
|
|||
|
private string inputNumbers = string.Empty;
|
|||
|
/// <summary>
|
|||
|
/// Number Pad Input Number
|
|||
|
/// </summary>
|
|||
|
public string InputNumbers
|
|||
|
{
|
|||
|
get { return inputNumbers; }
|
|||
|
set { inputNumbers = value; PropertyChange("InputNumbers"); }
|
|||
|
}
|
|||
|
|
|||
|
private double cancelButtonWidth = 270d;
|
|||
|
/// <summary>
|
|||
|
/// Cancel Button Width
|
|||
|
/// </summary>
|
|||
|
public double CancelButtonWidth
|
|||
|
{
|
|||
|
get { return cancelButtonWidth; }
|
|||
|
set { cancelButtonWidth = value; PropertyChange("CancelButtonWidth"); }
|
|||
|
}
|
|||
|
private List<M_Language> cancelButtonText;
|
|||
|
/// <summary>
|
|||
|
/// Cancel Button Text
|
|||
|
/// </summary>
|
|||
|
public List<M_Language> CancelButtonText
|
|||
|
{
|
|||
|
get { return cancelButtonText; }
|
|||
|
set { cancelButtonText = value; PropertyChange("CancelButtonText"); }
|
|||
|
}
|
|||
|
private List<M_Language> okButtonText;
|
|||
|
/// <summary>
|
|||
|
/// Ok Button Text
|
|||
|
/// </summary>
|
|||
|
public List<M_Language> OkButtonText
|
|||
|
{
|
|||
|
get { return okButtonText; }
|
|||
|
set { okButtonText = value; PropertyChange("OkButtonText"); }
|
|||
|
}
|
|||
|
public bool oKButtonEnabled = false;
|
|||
|
/// <summary>
|
|||
|
/// OK Button enabled
|
|||
|
/// </summary>
|
|||
|
public bool OKButtonEnabled
|
|||
|
{
|
|||
|
get { return oKButtonEnabled; }
|
|||
|
set { oKButtonEnabled = value; PropertyChange("OKButtonEnabled"); }
|
|||
|
}
|
|||
|
private double okButtonWidth = 270d;
|
|||
|
/// <summary>
|
|||
|
/// OK Button Width
|
|||
|
/// </summary>
|
|||
|
public double OKButtonWidth
|
|||
|
{
|
|||
|
get { return okButtonWidth; }
|
|||
|
set { okButtonWidth = value; PropertyChange("OKButtonWidth"); }
|
|||
|
}
|
|||
|
public bool numPadInputVisible = false;
|
|||
|
/// <summary>
|
|||
|
/// OK Button enabled
|
|||
|
/// </summary>
|
|||
|
public bool NumPadInputVisible
|
|||
|
{
|
|||
|
get { return numPadInputVisible; }
|
|||
|
set { numPadInputVisible = value; PropertyChange("NumPadInputVisible"); }
|
|||
|
}
|
|||
|
public bool numPadGuideVisible = true;
|
|||
|
/// <summary>
|
|||
|
/// OK Button enabled
|
|||
|
/// </summary>
|
|||
|
public bool NumPadGuideVisible
|
|||
|
{
|
|||
|
get { return numPadGuideVisible; }
|
|||
|
set { numPadGuideVisible = value; PropertyChange("NumPadGuideVisible"); }
|
|||
|
}
|
|||
|
|
|||
|
public int numPadMaxLength;
|
|||
|
/// <summary>
|
|||
|
/// Number Pad Input Maxlength
|
|||
|
/// </summary>
|
|||
|
public int NumPadMaxLength
|
|||
|
{
|
|||
|
get { return numPadMaxLength; }
|
|||
|
set { numPadMaxLength = value; PropertyChange("NumPadMaxLength"); }
|
|||
|
}
|
|||
|
public int checkLength;
|
|||
|
/// <summary>
|
|||
|
/// Number Pad Input Maxlength
|
|||
|
/// </summary>
|
|||
|
public int CheckLength
|
|||
|
{
|
|||
|
get { return checkLength; }
|
|||
|
set { checkLength = value; PropertyChange("CheckLength"); }
|
|||
|
}
|
|||
|
|
|||
|
private List<M_Language> memberPointsHeaderText;
|
|||
|
/// <summary>
|
|||
|
/// Cancel Button Text
|
|||
|
/// </summary>
|
|||
|
public List<M_Language> MemberPointsHeaderText
|
|||
|
{
|
|||
|
get { return memberPointsHeaderText; }
|
|||
|
set { memberPointsHeaderText = value; PropertyChange("MemberPointsHeaderText"); }
|
|||
|
}
|
|||
|
private string languageButttonImage;
|
|||
|
/// <summary>
|
|||
|
/// Read Barcode Formated Text
|
|||
|
/// </summary>
|
|||
|
public string LanguageButttonImage
|
|||
|
{
|
|||
|
get { return languageButttonImage; }
|
|||
|
set { languageButttonImage = value; PropertyChange("LanguageButttonImage"); }
|
|||
|
}
|
|||
|
private bool languageButttonVisibel;
|
|||
|
/// <summary>
|
|||
|
/// Language Select Button Visible
|
|||
|
/// </summary>
|
|||
|
public bool LanguageButttonVisibel
|
|||
|
{
|
|||
|
get { return languageButttonVisibel; }
|
|||
|
set { languageButttonVisibel = value; PropertyChange("LanguageButttonVisibel"); }
|
|||
|
}
|
|||
|
private CertifyWindowType certifyWindow = CertifyWindowType.CertifyStart;
|
|||
|
/// <summary>
|
|||
|
/// Current View Window
|
|||
|
/// </summary>
|
|||
|
public CertifyWindowType CertifyWindow
|
|||
|
{
|
|||
|
get { return certifyWindow; }
|
|||
|
set { certifyWindow = value; PropertyChange("CertifyWindow"); }
|
|||
|
}
|
|||
|
private double popupWidth = 1300;
|
|||
|
/// <summary>
|
|||
|
/// Popup Whidth (For Calculate OK Button Width)
|
|||
|
/// </summary>
|
|||
|
public double PopupWidth
|
|||
|
{
|
|||
|
get { return popupWidth; }
|
|||
|
set { popupWidth = value; PropertyChange("PopupWidth"); }
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// HappyPoint 인증 정보
|
|||
|
/// </summary>
|
|||
|
public M_HappyPointReturn HappyPointReturn { get; set; }
|
|||
|
/// <summary>
|
|||
|
/// OK Click Command
|
|||
|
/// </summary>
|
|||
|
public ICommand OkCommand { get; protected set; }
|
|||
|
/// <summary>
|
|||
|
/// Cancel Click Command
|
|||
|
/// </summary>
|
|||
|
public ICommand CancelCommand { get; protected set; }
|
|||
|
#endregion
|
|||
|
|
|||
|
#region [ Ctor ]
|
|||
|
/// <summary>
|
|||
|
/// Ctor
|
|||
|
/// </summary>
|
|||
|
public VmNumPadPopup()
|
|||
|
{
|
|||
|
OkCommand = new Command(OkCommandHandler);
|
|||
|
CancelCommand = new Command(CancelCommandHandler);
|
|||
|
this.PropertyChanged += VmHappyPointCertify_PropertyChanged;
|
|||
|
OkButtonText = Languages.GetMessages("BTN0024");
|
|||
|
CancelButtonText = Languages.GetMessages("BTN0033");
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// Dispose
|
|||
|
/// </summary>
|
|||
|
public new void Dispose()
|
|||
|
{
|
|||
|
this.PropertyChanged -= VmHappyPointCertify_PropertyChanged;
|
|||
|
base.Dispose();
|
|||
|
}
|
|||
|
#endregion Ctor
|
|||
|
|
|||
|
#region [ Method ]
|
|||
|
|
|||
|
|
|||
|
#endregion Method
|
|||
|
|
|||
|
#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;
|
|||
|
ReturnValue = new M_PopupReturn
|
|||
|
{
|
|||
|
OKAnswer = true,
|
|||
|
TimeOut = false,
|
|||
|
ReturnLanguage = ShowLanguageType,
|
|||
|
PopupArgs = InputNumbers
|
|||
|
};
|
|||
|
CanWindowClose = true;
|
|||
|
}
|
|||
|
|
|||
|
private void VmHappyPointCertify_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
|||
|
{
|
|||
|
switch (e.PropertyName)
|
|||
|
{
|
|||
|
case "IsTimeout":
|
|||
|
ReturnValue = new M_PopupReturn
|
|||
|
{
|
|||
|
OKAnswer = false,
|
|||
|
TimeOut = true,
|
|||
|
ReturnLanguage = ShowLanguageType,
|
|||
|
PopupArgs = null
|
|||
|
};
|
|||
|
CanWindowClose = true;
|
|||
|
break;
|
|||
|
case "NumPadInputVisible":
|
|||
|
NumPadGuideVisible = !NumPadInputVisible;
|
|||
|
break;
|
|||
|
case "InputNumbers":
|
|||
|
NumPadInputVisible = InputNumbers.Length > 0;
|
|||
|
if (CheckLength > 0 && CheckLength <= NumPadMaxLength)
|
|||
|
{
|
|||
|
OKButtonEnabled = CheckLength.Equals(InputNumbers.Length);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
OKButtonEnabled = InputNumbers.Length > 0;
|
|||
|
}
|
|||
|
break;
|
|||
|
case "PopupWidth":
|
|||
|
OKButtonWidth = PopupWidth / 2;
|
|||
|
CancelButtonWidth = PopupWidth / 2;
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion Event Handlers
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|