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 VmMiniPopup : PopupViewModelBase { #region [ Members ] private M_MiniPopup miniPopup; /// /// Parameters /// public M_MiniPopup MiniPopup { get { return miniPopup; } set { miniPopup = value; PropertyChange("MiniPopup"); } } private string iconNoramlBrush = string.Empty; /// /// Message Text /// public string IconNoramlBrush { get { return iconNoramlBrush; } set { iconNoramlBrush = value; PropertyChange("IconNoramlBrush"); } } private List messageText = null; /// /// Message Text /// public List MessageText { get { return messageText; } set { messageText = value; PropertyChange("MessageText"); } } private List subMessageText = null; /// /// SubMessage Text /// public List SubMessageText { get { return subMessageText; } set { subMessageText = value; PropertyChange("SubMessageText"); } } 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 = 400d; /// /// OK Button Width /// public double OkButtonWidth { get { return okButtonWidth; } set { okButtonWidth = value; PropertyChange("OkButtonWidth"); } } private double cancelButtonWidth = 400d; /// /// OK Button Width /// public double CancelButtonWidth { get { return cancelButtonWidth; } set { cancelButtonWidth = value; PropertyChange("CancelButtonWidth"); } } /// /// OK Click Command /// public ICommand OkCommand { get; protected set; } /// /// Cancel Click Command /// public ICommand CancelCommand { get; protected set; } #endregion Members #region [ Ctor ] /// /// Ctor /// public VmMiniPopup() { OkCommand = new Command(OkCommandHandler); CancelCommand = new Command(CancelCommandHandler); this.PropertyChanged += VmMiniPopup_PropertyChanged; } ~VmMiniPopup() { this.PropertyChanged -= VmMiniPopup_PropertyChanged; } #endregion Ctor #region [ Methods ] private void SetMiniPopup() { if (MiniPopup is M_MiniPopup) { ShowLanguageType = MiniPopup.DisplayLanguage; MessageText = MiniPopup.Message; SubMessageText = MiniPopup.SubMessage; OkButtonText = MiniPopup.OkButtonText; CancelButtonText = MiniPopup.CencalButtonText; TimeOutSeconds = MiniPopup.TimeoutSeconds; IsTimeoutPopup = MiniPopup.IsTimeoutPopup; var iconBrush = "Transparent"; switch (MiniPopup.Icon) { case MiniPopupIcon.Cancel: iconBrush = ResourceManager.GetNximagePathAdd("ic_alert_cancel.png", CommonValue.PBdesignImagesPath); break; case MiniPopupIcon.Delete: iconBrush = ResourceManager.GetNximagePathAdd("ic_alert_delete.png", CommonValue.PBdesignImagesPath); break; case MiniPopupIcon.ListCancel: iconBrush = ResourceManager.GetNximagePathAdd("ic_alert_listcancel.png", CommonValue.PBdesignImagesPath); break; case MiniPopupIcon.DiscountCancel: iconBrush = ResourceManager.GetNximagePathAdd("ic_alert_discountcancel.png", CommonValue.PBdesignImagesPath); break; case MiniPopupIcon.GiftCancel: iconBrush = ResourceManager.GetNximagePathAdd("ic_alert_giftcancel.png", CommonValue.PBdesignImagesPath); break; case MiniPopupIcon.OrderCancel: iconBrush = ResourceManager.GetNximagePathAdd("ic_alert_ordercancel.png", CommonValue.PBdesignImagesPath); break; case MiniPopupIcon.AddCoupon: iconBrush = ResourceManager.GetNximagePathAdd("ic_alert_coupon.png", CommonValue.PBdesignImagesPath); break; case MiniPopupIcon.Payment: iconBrush = ResourceManager.GetNximagePathAdd("ic_alert_payment.png", CommonValue.PBdesignImagesPath); break; default: iconBrush = "Transparent"; break; } IconNoramlBrush = iconBrush; if (!MiniPopup.IsCencalButton) { OkButtonWidth = 800d; CancelButtonWidth = 0d; } else { OkButtonWidth = 400d; CancelButtonWidth = 400d; } } } #endregion Methods #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 = null }; CanWindowClose = true; } private void VmMiniPopup_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 "MiniPopup": SetMiniPopup(); break; } } #endregion Event Handlers } }