using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using SPC.Kiosk.Base;
using SPC.Kiosk.Common;
using SPC.Kiosk.Popup.Model;
using SPC.Kiosk.Popup.ViewModel;
namespace SPC.Kiosk.Popup
{
///
/// Popup Manager
///
public sealed class PopupManager
{
private static PopupManager instance = null;
private static readonly object padlock = new object();
///
/// This Class Instance
///
public static PopupManager GetInstance
{
get
{
lock (padlock)
{
if (instance == null)
{
instance = new PopupManager();
}
return instance;
}
}
}
public void OpenPaymentsEnd(PaymentEndWindowEndType _paymentEndWindow
, List _getBasketItems
, bool _happyPointReserve
, bool _okCashBagReserve
, M_HappyPointReturn _happyPointReturn=null)
{
try
{
var PaymentsEndWin = new PaymentsEnd(_paymentEndWindow
, _getBasketItems
, _happyPointReserve
, _okCashBagReserve
, _happyPointReturn);
PaymentsEndWin.ShowDialog();
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenPaymentsEnd", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
}
///
/// 번호 입력창
///
///
///
///
///
///
///
///
public M_PopupReturn OpenNumPadPopup(SupportLanguageType _languageType
, List _guideText
, bool _formated = false
, bool _isPassword = true
, int _maxLength = 4
, int _checkLength = 4)
{
M_PopupReturn result = null;
try
{
var NumPadPopupWin = new NumPadPopup(_languageType
, _guideText
, _formated
, _isPassword
, _maxLength
, _checkLength);
NumPadPopupWin.ShowDialog();
if (NumPadPopupWin.DataContext is VmNumPadPopup viewModel)
{
result = viewModel.ReturnValue;
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenNumPadPopup", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
result = null;
}
return result;
}
public M_PopupReturn OpenStepInfoPopup()
{
M_PopupReturn result = null;
try
{
var StepInfoPopupWin = new StepInfoPopup();
StepInfoPopupWin.ShowDialog();
if (StepInfoPopupWin.DataContext is VmStepInfoPopup viewModel)
{
result = viewModel.ReturnValue;
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenStepInfoPopup", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
result = null;
}
return result;
}
///
/// Open MiniPopup
///
///
///
public M_PopupReturn OpenMiniPopup(M_MiniPopup _miniPopup)
{
M_PopupReturn result = null;
try
{
if (_miniPopup is M_MiniPopup)
{
var MiniPopupWin = new MiniPopup(_miniPopup);
MiniPopupWin.ShowDialog();
if (MiniPopupWin.DataContext is VmMiniPopup viewModel)
{
result = viewModel.ReturnValue;
}
//MiniPopupWin.DataContext = null;
//MiniPopupWin.Content = null;
//MiniPopupWin = null;
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenMiniPopup", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
result = null;
}
return result;
}
///
/// Option Select
///
///
///
///
///
public M_PopupReturn OpenOptionSelect(List _getItemName
, List _getOptions
, string _getItemImage
, int _getItemCount
, double _getItemPrice
, bool _editMode = false)
{
M_PopupReturn result = null;
try
{
var OptionSelectWin = new OptionSelect(_getItemName
, _getOptions
, _getItemImage
, _getItemCount
, _getItemPrice
, _editMode);
OptionSelectWin.ShowDialog();
if (OptionSelectWin.DataContext is VmOptionSelect viewModel)
{
result = viewModel.ReturnValue;
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenOptionSelect", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
result = null;
}
return result;
}
///
/// Last Payment
///
///
public M_PopupReturn OpenPaymentProcess(LastPaymentsType _paymentType, double _totalPayment )
{
M_PopupReturn result = null;
try
{
var PaymentProcessWin = new PaymentProcess(_paymentType, _totalPayment);
PaymentProcessWin.ShowDialog();
if (PaymentProcessWin.DataContext is VmPaymentProcess viewModel)
{
result = viewModel.ReturnValue;
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenPaymentProcess", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
result = null;
}
return result;
}
///
/// Language Select
///
///
public M_PopupReturn OpenLanguageSelector(SupportLanguageType _supportLanguageType)
{
M_PopupReturn result = null;
try
{
var LanguageSelectorWin = new LanguageSelector(_supportLanguageType);
LanguageSelectorWin.ShowDialog();
if (LanguageSelectorWin.DataContext is VmLanguageSelector viewModel)
{
result = viewModel.ReturnValue;
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenLanguageSelector()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
result = null;
}
return result;
}
///
/// Call Employee
///
///
public M_PopupReturn OpenCallEmployee()
{
M_PopupReturn result = null;
try
{
var CallEmployeeWin = new CallEmployee();
CallEmployeeWin.ShowDialog();
if (CallEmployeeWin.DataContext is VmCallEmployee viewModel)
{
result = viewModel.ReturnValue;
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenCallEmployee", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
result = null;
}
return result;
}
///
/// HappyPoint Certify
///
///
public M_PopupReturn OpenHappyPointCertify(bool _showLanguageButton=true, bool _showMemberHistoryItems = true, ParentPage _popupParentPage = ParentPage.EmptyPage)
{
M_PopupReturn result = null;
try
{
var HappyPointCertifyWin = new HappyPointCertify(_showLanguageButton, _showMemberHistoryItems, _popupParentPage);
HappyPointCertifyWin.ShowDialog();
if (HappyPointCertifyWin.DataContext is VmHappyPointCertify viewModel)
{
result = new M_PopupReturn
{
OKAnswer = viewModel.ReturnValue.OKAnswer,
TimeOut = viewModel.ReturnValue.TimeOut,
ReturnLanguage = viewModel.ReturnValue.ReturnLanguage,
PopupArgs = viewModel.ReturnValue.PopupArgs
};
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenHappyPointCertify", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
result = null;
}
return result;
}
///
/// HappyPoint Using
///
/// 이전 인증 결과
/// 결제 대상 금액
///
public M_PopupReturn OpenHappyPointUsing(M_HappyPointReturn _happyPointReturn, double _totalPayment = 0)
{
M_PopupReturn result = null;
try
{
var HappyPointUsingWin = new HappyPointUsing(_happyPointReturn, _totalPayment);
HappyPointUsingWin.ShowDialog();
if (HappyPointUsingWin.DataContext is VmHappyPointUsing viewModel)
{
result = viewModel.ReturnValue;
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenHappyPointUsing", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
result = null;
}
return result;
}
public M_PopupReturn OpenHappyAppCoupon(M_HappyPointReturn _happyPointReturn, double _totalPayment = 0)
{
M_PopupReturn result = null;
try
{
var HappyAppCouponWin = new HappyPointCoupon(_happyPointReturn, _totalPayment);
HappyAppCouponWin.ShowDialog();
if (HappyAppCouponWin.DataContext is VmHappyPointCoupon viewModel)
{
result = viewModel.ReturnValue;
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenHappyAppCoupon", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
result = null;
}
return result;
}
public M_PopupReturn OpenMobileHappyCoupon(List _getBasketItems , double _totalPayment = 0)
{
M_PopupReturn result = null;
try
{
var MobileHappyCouponWin = new MobileHappyCoupon(_getBasketItems, _totalPayment);
MobileHappyCouponWin.ShowDialog();
if (MobileHappyCouponWin.DataContext is VmMobileHappyCoupon viewModel)
{
result = viewModel.ReturnValue;
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenMobileHappyCoupon()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
result = null;
}
return result;
}
///
/// OK CashBag Certify
///
/// 결제 대상 금액
/// 적립 가능 유무
///
public M_PopupReturn OpenOkCashBagCertify()
{
M_PopupReturn result = null;
try
{
var OkCashBagCertifyWin = new OkCashBagCertify();
OkCashBagCertifyWin.ShowDialog();
if (OkCashBagCertifyWin.DataContext is VmOkCashBagCertify viewModel)
{
result = viewModel.ReturnValue;
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenOkCashBagCertify", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
result = null;
}
return result;
}
///
/// OK CashBag Using
///
/// 결제 대상 금액
/// 적립 가능 유무
///
public M_PopupReturn OpenOkCashBagUsing(double _totalPayment=0, bool _reserveEnabled = true)
{
M_PopupReturn result = null;
try
{
var OkCashBagUsingWin = new OkCashBagUsing(_totalPayment, _reserveEnabled);
OkCashBagUsingWin.ShowDialog();
if (OkCashBagUsingWin.DataContext is VmOkCashBagUsing viewModel)
{
result = viewModel.ReturnValue;
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenOkCashBagUsing", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
result = null;
}
return result;
}
///
/// MobileCompany Certify && Discount
///
/// 대상 통신사
/// 경제 대상 금액
///
public M_PopupReturn OpenMobileCompanyCertify(MobileCompanyType _mobileCompany, double _totalPayment = 0)
{
M_PopupReturn result = null;
try
{
var MobileCompanyMemberCertifyWin = new MobileCompanyMemberCertify(_mobileCompany, _totalPayment);
MobileCompanyMemberCertifyWin.ShowDialog();
if (MobileCompanyMemberCertifyWin.DataContext is VmMobileCompanyMemberCertify viewModel)
{
result = viewModel.ReturnValue;
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "OpenMobileCompanyCertify", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
result = null;
}
return result;
}
}
}