using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.IO;
using System.ComponentModel;
using System.Windows.Input;
using System.Windows.Media.Animation;
using System.Windows;
using System.Collections.ObjectModel;
using System.Text.RegularExpressions;
using System.Windows.Threading;
using System.Threading.Tasks;
using System.Windows.Controls;
#region SPC.Kiosk
using SPC.Kiosk.Base;
using SPC.Kiosk.Common;
using SPC.Kiosk.DataHelper;
using SPC.Kiosk.PB.Model;
using SPC.Kiosk.Popup;
using SPC.Kiosk.Popup.Model;
using System.Threading;
#endregion
namespace SPC.Kiosk.PB.ViewModel
{
///
/// PBWindow View Model
///
public class VmPBViewModel : ViewModelBase
{
#region [ Members ]
private PopupManager popupManager = PopupManager.GetInstance;
private BackDataService backDataService;
private Queue scanQueue = new Queue();
private bool IsScanProcess = true;
private Task ScanProcess = null;
//public Dictionary PosOptionValues;
private string optionValue810;
///
/// 자동계산 사용여부
///
public string OptionValue810
{
get { return optionValue810; }
set { optionValue810 = value; PropertyChange("OptionValue810"); }
}
private string optionValue811;
///
/// 바코드계산 사용여부
///
public string OptionValue811
{
get { return optionValue811; }
set { optionValue811 = value; PropertyChange("OptionValue811"); }
}
private string optionValue812;
///
/// 직원호출 사용여부
///
public string OptionValue812
{
get { return optionValue812; }
set { optionValue812 = value; PropertyChange("OptionValue812"); }
}
///
/// 처리중 화면
///
public WaitWindow WaitWindowFrom { get; set; }
private DispatcherTimer ToIntoroTimer;
///
/// 입력 대기 초과시 연장 팝업 사용 유무
///
public bool IsTimeoutPopup { get; set; } = false;
private DateTime LastAccessTime { get; set; }
///
/// 대기 화면에서 다음 화면 연결시 옵션
///
public string DefaultLinkValue { get; set; }
///
/// 상품 목록 초기화 필요 유무
///
public bool NeedIntailizeItems { get; set; }
private SupportLanguageType showLanguageType;
///
/// 다국어 코드
///
public SupportLanguageType ShowLanguageType
{
get { return showLanguageType; }
set { showLanguageType = value; PropertyChange("ShowLanguageType"); }
}
private PBPageType defaultPage = PBPageType.Intro;
///
/// 현재 화면
///
public PBPageType DefaultPage
{
get { return defaultPage; }
set { defaultPage = value; PropertyChange("DefaultPage"); }
}
private bool canWindowClose = false;
///
/// 화면 닫기 (true 이면 바로 닫음)
///
public bool CanWindowClose
{
get { return canWindowClose; }
set { canWindowClose = value; PropertyChange("CanWindowClose"); }
}
#region Intro & Page
private ObservableCollection introItems;
///
/// 대기 화면 Contents
///
public ObservableCollection IntroItems
{
get { return introItems; }
set { introItems = value; PropertyChange("IntroItems"); }
}
private M_HappyPointReturn happyPointReturn;
///
/// 해피 포인트 인증 정보
///
public M_HappyPointReturn HappyPointReturn
{
get { return happyPointReturn; }
set { happyPointReturn = value; PropertyChange("HappyPointReturn"); }
}
///
/// Alt+F4 대한 Command
///
public ICommand ToExecuteNothing { get; protected set; } = null;
///
/// 대기 화면 클릭
///
public ICommand RollMediaCommand { get; protected set; } = null;
#endregion
#region GMB
#region GMB Left
///
/// 공통 메뉴 로고
///
public string GmbLogo { get; set; } = ResourceManager.GetNximagePathAdd("Img_main_logo.png", CommonValue.PBdesignImagesPath);
///
/// 공통 메뉴 관리자 기능 클릭
///
public ICommand ReaderCheckCommand { get; protected set; } = null;
///
/// 로로 클릭 > 홈 화면으로 이동
///
public ICommand GotoFirstCommand { get; protected set; } = null;
///
/// 관리자 기능 클릭 수
///
public int ReaderCheckClickCount { get; set; } = 0;
private bool gmbReaderCheckOpen = false;
///
/// 관리자 기늘 오픈
///
public bool GmbReaderCheckOpen
{
get { return gmbReaderCheckOpen; }
set { gmbReaderCheckOpen = value; PropertyChange("GmbReaderCheckOpen"); }
}
#endregion
#region GMB Center
///
/// 공통 토글 메뉴 배경 (센싱,일반주문 전환 배경)
///
public string GmbToggleOff { get; set; } = ResourceManager.GetNximagePathAdd("Btn_toggle_off.png", CommonValue.PBdesignImagesPath);
///
/// 공통 토글 메뉴 전경 (센싱,일반주문 전환 전경)
///
public string GmbToggleOn { get; set; } = ResourceManager.GetNximagePathAdd("Btn_toggle_on.png", CommonValue.PBdesignImagesPath);
///
/// 자동 주문 배경
///
public string GmbAIscannerNormal { get; set; } = ResourceManager.GetNximagePathAdd("Ic_ai_off.png", CommonValue.PBdesignImagesPath);
///
/// 자동 주문 Disable 배경
///
public string GmbAIscannerDisable { get; set; } = ResourceManager.GetNximagePathAdd("Ic_ai_on.png", CommonValue.PBdesignImagesPath);
private bool gmbAIscannerEnable;
///
/// 자동 주문 버튼 Enabled
///
public bool GmbAIscannerEnable
{
get { return gmbAIscannerEnable; }
set { gmbAIscannerEnable = value; PropertyChange("GmbAIscannerEnable"); }
}
///
/// 일반 주문 배경
///
public string GmbOrderNormal { get; set; } = ResourceManager.GetNximagePathAdd("Ic_order_off.png", CommonValue.PBdesignImagesPath);
///
/// 일반 주문 Disable 배경
///
public string GmbOrderDisable { get; set; } = ResourceManager.GetNximagePathAdd("Ic_order_on.png", CommonValue.PBdesignImagesPath);
private bool gmbOrderEnable;
///
/// 일반 주문 버튼 Enabled
///
public bool GmbOrderEnable
{
get { return gmbOrderEnable; }
set { gmbOrderEnable = value; PropertyChange("GmbOrderEnable"); }
}
///
/// 자동 주문 Command
///
public ICommand GmbAIscannerCommand { get; protected set; } = null;
///
/// 일반 주문 Command
///
public ICommand GmbOrderCommand { get; protected set; } = null;
private string gmbMemberName;
///
/// 해피 포인트 가입 고객명
///
public string GmbMemberName
{
get { return gmbMemberName; }
set { gmbMemberName = value; PropertyChange("GmbMemberName"); }
}
///
/// 해피 포인트 안내 배경
///
public string GmbHappyInfoBackGround { get; set; } = ResourceManager.GetNximagePathAdd("btn_happypoint_info.png", CommonValue.PBdesignImagesPath);
private bool gmbHappyInfoEnable = false;
///
/// 해피 포인트 안내 Enabled
///
public bool GmbHappyInfoEnable
{
get { return gmbHappyInfoEnable; }
set { gmbHappyInfoEnable = value; PropertyChange("GmbHappyInfoEnable"); }
}
///
/// 해피 포인트 안내 표시 시점
///
public DateTime GmbHappyInfoEnableTime { get; set; }
#endregion
#region GMB Right
///
/// 해피 포인트 로그인 아이콘
///
public string GmbHappyPointimage { get; set; } = ResourceManager.GetNximagePathAdd("btn_happypoint_d.png", CommonValue.PBdesignImagesPath);
///
/// 해피 포인트 로그인 Disabled 아이콘
///
public string GmbHappyPointDisable { get; set; } = ResourceManager.GetNximagePathAdd("btn_happypoint_n.png", CommonValue.PBdesignImagesPath);
///
/// 직원 호출 아이콘
///
public string GmbCallimage { get; set; } = ResourceManager.GetNximagePathAdd("btn_help.png", CommonValue.PBdesignImagesPath);
///
/// 로그 아웃 아이콘
///
public string GmbHomeimage { get; set; } = ResourceManager.GetNximagePathAdd("btn_reset.png", CommonValue.PBdesignImagesPath);
private string gmbLanguageimage = ResourceManager.GetNximagePathAdd("btn_language_kor.png", CommonValue.PBdesignImagesPath);
///
/// 다국어 변경 아이콘
///
public string GmbLanguageimage
{
get { return gmbLanguageimage; }
set { gmbLanguageimage = value; PropertyChange("GmbLanguageimage"); }
}
private bool gmbHome = true;
///
/// 로그 아웃 Enabled
///
public bool GmbHome
{
get { return gmbHome; }
set { gmbHome = value; PropertyChange("GmbHome"); }
}
private bool gmbHappyPointEnable = true;
///
/// 해피 포인트 로그인 Enabled
///
public bool GmbHappyPointEnable
{
get { return gmbHappyPointEnable; }
set { gmbHappyPointEnable = value; PropertyChange("GmbHappyPointEnable"); }
}
private bool gmbEmpCall = true;
///
/// 직원 호출 Enabled
///
public bool GmbEmpCall
{
get { return gmbEmpCall; }
set { gmbEmpCall = value; PropertyChange("GmbEmpCall"); }
}
private bool gmbLanguage = true;
///
/// 다국어 변경 Enabled
///
public bool GmbLanguage
{
get { return gmbLanguage; }
set { gmbLanguage = value; PropertyChange("GmbLanguage"); }
}
private bool memberLoginOK = false;
///
/// 해피 포인트 로그인 유무
///
public bool MemberLoginOK
{
get { return memberLoginOK; }
set { memberLoginOK = value; PropertyChange("MemberLoginOK"); }
}
///
/// 해피 포인트 로그인 Command
///
public ICommand HappyPointCommand { get; protected set; } = null;
///
/// 직원 호출 Command
///
public ICommand CallEmployeeCommand { get; protected set; } = null;
///
/// 다국어 변경 Command
///
public ICommand LanguageCommand { get; protected set; } = null;
///
/// 로그 아웃 Command
///
public ICommand GotoIntroPageCommand { get; protected set; } = null;
#endregion
#endregion
#region First Page Contents
///
/// 홈페이지 자동 주문 배경
///
public string First2CameraBackNormal { get; set; } = ResourceManager.GetNximagePathAdd("btn_main_camerascan_n.png", CommonValue.PBdesignImagesPath);
///
/// 홈페이지 자동 주문 마우스 다운 배경
///
public string First2CameraBackDown { get; set; } = ResourceManager.GetNximagePathAdd("btn_main_camerascan_f.png", CommonValue.PBdesignImagesPath);
///
/// 홈페이지 일반 주문 배경
///
public string First2SelfOrderBackNormal { get; set; } = ResourceManager.GetNximagePathAdd("btn_main_selforder_n.png", CommonValue.PBdesignImagesPath);
///
/// 홈페이지 일반 주문 마우스 다운 배경
///
public string First2SelfOrderBackDown { get; set; } = ResourceManager.GetNximagePathAdd("btn_main_selforder_f.png", CommonValue.PBdesignImagesPath);
#endregion
#region Items Contents
#region Category
///
/// Category1 Background
///
public string Category1Background { get; set; } = ResourceManager.GetNximagePathAdd("btn_main_menu_n.png", CommonValue.PBdesignImagesPath);
///
/// All Category Data
///
public List AllCategory { get; set; }
private ObservableCollection category1Data;
///
/// Category1 Data
///
public ObservableCollection Category1Data
{
get { return category1Data; }
set { category1Data = value; PropertyChange("Category1Data"); }
}
private ObservableCollection category2Data;
///
/// Category2 Data
///
public ObservableCollection Category2Data
{
get { return category2Data; }
set { category2Data = value; PropertyChange("Category2Data"); }
}
private int defaultCategory1Item;
///
/// Default Category1 Item
///
public int DefaultCategory1Item
{
get { return defaultCategory1Item; }
set { defaultCategory1Item = value; PropertyChange("DefaultCategory1Item"); }
}
private int defaultCategory2Item;
///
/// Default Category2 Item
///
public int DefaultCategory2Item
{
get { return defaultCategory2Item; }
set { defaultCategory2Item = value; PropertyChange("DefaultCategory2Item"); }
}
private int defaultCategory1PageNo;
///
/// Default Category1 Page No
///
public int DefaultCategory1PageNo
{
get { return defaultCategory1PageNo; }
set { defaultCategory1PageNo = value; PropertyChange("DefaultCategory1PageNo"); }
}
private int defaultCategory2PageNo;
///
/// Default Category2 Page No
///
public int DefaultCategory2PageNo
{
get { return defaultCategory2PageNo; }
set { defaultCategory2PageNo = value; PropertyChange("DefaultCategory2PageNo"); }
}
///
/// Category1 Commad
///
public ICommand Category1Command { get; protected set; } = null;
///
/// Category2 Commad
///
public ICommand Category2Command { get; protected set; } = null;
///
/// OrderHistory Command (open)
///
public ICommand OrderHistoryCommand { get; protected set; } = null;
///
/// OrderHistory Close Command
///
public ICommand OrderHistoryCloseCommand { get; protected set; } = null;
#endregion
#region Items
///
/// AllI tems
///
public List AllItems { get; set; }
///
/// Order(item) Column Count
///
public int OrderColumnCount { get; set; }
///
/// Order(item) Row Count
///
public int OrderRowCount { get; set; }
private int defaultOrderItem;
///
/// Default Order Item
///
public int DefaultOrderItem
{
get { return defaultOrderItem; }
set { defaultOrderItem = value; PropertyChange("DefaultOrderItem"); }
}
private int orderItemPageNo;
///
/// Default Order Item Page No
///
public int OrderItemPageNo
{
get { return orderItemPageNo; }
set { orderItemPageNo = value; PropertyChange("OrderItemPageNo"); }
}
private ObservableCollection orderItems;
///
/// Order Items Data
///
public ObservableCollection OrderItems
{
get { return orderItems; }
set { orderItems = value; PropertyChange("OrderItems"); }
}
///
/// Item Command
///
public ICommand ItemCommand { get; protected set; } = null;
///
/// Page to Left Normal Image
///
public string Page2LeftNormalImage { get; set; } = ResourceManager.GetNximagePathAdd("btn_page_before_n.png", CommonValue.PBdesignImagesPath);
///
/// Page to Right Normal Image
///
public string Page2RightNormalImage { get; set; } = ResourceManager.GetNximagePathAdd("btn_page_after_n.png", CommonValue.PBdesignImagesPath);
private bool page2LeftEnable;
///
/// Page to Left Enabled
///
public bool Page2LeftEnable
{
get { return page2LeftEnable; }
set { page2LeftEnable = value; PropertyChange("Page2LeftEnable"); }
}
private bool page2RightEnable;
///
/// Page to Right Enabled
///
public bool Page2RightEnable
{
get { return page2RightEnable; }
set { page2RightEnable = value; PropertyChange("Page2RightEnable"); }
}
///
/// Page to Left Command
///
public ICommand Page2LeftCommand { get; protected set; } = null;
///
/// Page to Right Command
///
public ICommand Page2RightCommand { get; protected set; } = null;
private ObservableCollection itemPageStatus;
///
/// Item Page Status
///
public ObservableCollection ItemPageStatus
{
get { return itemPageStatus; }
set { itemPageStatus = value; PropertyChange("ItemPageStatus"); }
}
private int pageStatusColumnCount;
///
/// Page Status Column Count
///
public int PageStatusColumnCount
{
get { return pageStatusColumnCount; }
set { pageStatusColumnCount = value; PropertyChange("PageStatusColumnCount"); }
}
///
/// Page Select Command
///
public ICommand PageSelectCommand { get; protected set; } = null;
#endregion
#region Order History
///
/// Order History Normal Brush
///
public string OrderHistoryNormalBrush { get; set; } = ResourceManager.GetNximagePathAdd("Ic_mylist_d.png", CommonValue.PBdesignImagesPath);
///
/// Order History Disable Brush
///
public string OrderHistoryDisableBrush { get; set; } = ResourceManager.GetNximagePathAdd("Ic_mylist_n.png", CommonValue.PBdesignImagesPath);
///
/// Order History Close NormalB rush
///
public string CloseOrderHistoryNormalBrush { get; set; } = ResourceManager.GetNximagePathAdd("Ic_mylist_s.png", CommonValue.PBdesignImagesPath);
private bool orderHistoryView = false;
///
/// Is Order History View
///
public bool OrderHistoryView
{
get { return orderHistoryView; }
set { orderHistoryView = value; PropertyChange("OrderHistoryView"); }
}
private List findOrderHistoryItems;
///
/// Find Order History Items
///
public List FindOrderHistoryItems
{
get { return findOrderHistoryItems; }
set { findOrderHistoryItems = value; PropertyChange("FindOrderHistoryItems"); }
}
private ObservableCollection orderHistoryItems;
///
/// Order History Items
///
public ObservableCollection OrderHistoryItems
{
get { return orderHistoryItems; }
set { orderHistoryItems = value; PropertyChange("OrderHistoryItems"); }
}
private bool orderHistoryItemsEnable;
///
/// Order History Items Enable
///
public bool OrderHistoryItemsEnable
{
get { return orderHistoryItemsEnable; }
set { orderHistoryItemsEnable = value; PropertyChange("OrderHistoryItemsEnable"); }
}
#endregion
#endregion Contents
#region Scan Contents
///
/// Scan Info GIF
///
public string ScanInfoGIF { get; set; } = ResourceManager.GetNximagePathAdd("img_gif_barcodescan.gif", CommonValue.PBdesignImagesPath);
///
/// Scan Header Bar
///
public string ScanHeaderBar { get; set; } = ResourceManager.GetNximagePathAdd("Bl_bar.png", CommonValue.PBdesignImagesPath);
///
/// Scan Payment1 Normal
///
public string ScanPayment1Normal { get; set; } = ResourceManager.GetNximagePathAdd("btn_addorder_payment_n.png", CommonValue.PBdesignImagesPath);
///
/// Scan Payment1 Down
///
public string ScanPayment1Down { get; set; } = ResourceManager.GetNximagePathAdd("btn_addorder_payment_f.png", CommonValue.PBdesignImagesPath);
///
/// Add Scan1 Normal
///
public string AddScan1Normal { get; set; } = ResourceManager.GetNximagePathAdd("btn_addorder_camerascan_n.png", CommonValue.PBdesignImagesPath);
///
/// Add Scan1 Down
///
public string AddScan1Down { get; set; } = ResourceManager.GetNximagePathAdd("btn_addorder_camerascan_f.png", CommonValue.PBdesignImagesPath);
///
/// Scan Order1 Normal
///
public string ScanOrder1Normal { get; set; } = ResourceManager.GetNximagePathAdd("btn_addorder_selforder_n.png", CommonValue.PBdesignImagesPath);
///
/// Scan Order1 Down
///
public string ScanOrder1Down { get; set; } = ResourceManager.GetNximagePathAdd("btn_addorder_selforder_f.png", CommonValue.PBdesignImagesPath);
///
/// Scan Button Small Normal
///
public string ScanButtonSmallNormal { get; set; } = ResourceManager.GetNximagePathAdd("btn_addorder_n.png", CommonValue.PBdesignImagesPath);
///
/// Scan Button Small Down
///
public string ScanButtonSmallDown { get; set; } = ResourceManager.GetNximagePathAdd("btn_addorder_f.png", CommonValue.PBdesignImagesPath);
///
/// Scan Button Large Normal
///
public string ScanButtonLargeNormal { get; set; } = ResourceManager.GetNximagePathAdd("btn_addorder2_n.png", CommonValue.PBdesignImagesPath);
///
/// Scan Button Large Down
///
public string ScanButtonLargeDown { get; set; } = ResourceManager.GetNximagePathAdd("btn_addorder2_f.png", CommonValue.PBdesignImagesPath);
///
/// Scan Button Normal
///
public string ScanButtonNormal { get; set; } = ResourceManager.GetNximagePathAdd("btn_addorder3_n.png", CommonValue.PBdesignImagesPath);
///
/// Scan Button Down
///
public string ScanButtonDown { get; set; } = ResourceManager.GetNximagePathAdd("btn_addorder3_f.png", CommonValue.PBdesignImagesPath);
///
/// Info Logo
///
public string InfoLogo { get; set; } = ResourceManager.GetNximagePathAdd("ic_info.png", CommonValue.PBdesignImagesPath);
///
/// Info LogoX
///
public string InfoLogoX { get; set; } = ResourceManager.GetNximagePathAdd("btn_help.png", CommonValue.PBdesignImagesPath);
private PBSensingSubPageType sensingSubPage = PBSensingSubPageType.SensingPage;
///
/// PB Sensing SubPage Type
///
public PBSensingSubPageType SensingSubPage
{
get { return sensingSubPage; }
set { sensingSubPage = value; PropertyChange("SensingSubPage"); }
}
private string readBarCode;
///
/// Read Barcode
///
public string ReadBarCode
{
get { return readBarCode; }
set { readBarCode = value; PropertyChange("ReadBarCode"); }
}
private int aIScanCount;
///
/// AI Scan Count
///
public int AIScanCount
{
get { return aIScanCount; }
set { aIScanCount = value; PropertyChange("AIScanCount"); }
}
///
/// Rescan Commad
///
public ICommand RescanCommand { get; protected set; } = null;
///
/// Goto Barcode Commad
///
public ICommand GotoBarcodeCommand { get; protected set; } = null;
#endregion
#region MiniBasket
///
/// MiniBasket Delete All Image
///
public string MiniBasketDeleteAllImage { get; set; } = ResourceManager.GetNximagePathAdd("btn_delete.png", CommonValue.PBdesignImagesPath);
private bool miniBasketDeleteAllEnable;
///
/// MiniBasket Delete All Enabled
///
public bool MiniBasketDeleteAllEnable
{
get { return miniBasketDeleteAllEnable; }
set { miniBasketDeleteAllEnable = value; PropertyChange("MiniBasketDeleteAllEnable"); }
}
///
/// Empty Basket Image
///
public string EmptyBasketImage { get; set; } = ResourceManager.GetNximagePathAdd("Ic_Basket.png", CommonValue.PBdesignImagesPath);
///
/// Empty Basket DropCommand
///
public ICommand EmptyBasketDropCommand { get; protected set; } = null;
///
/// MiniBasket Delete All Command
///
public ICommand MiniBasketDeleteAllCommand { get; protected set; } = null;
private Visibility orderNoneDataGridVisibility = Visibility.Visible;
///
/// Order None Data Grid Visibility
///
public Visibility OrderNoneDataGridVisibility
{
get { return orderNoneDataGridVisibility; }
set { orderNoneDataGridVisibility = value; PropertyChange("OrderNoneDataGridVisibility"); }
}
private Visibility orderExistDataGridVisibility = Visibility.Hidden;
///
/// Order Exist Data Grid Visibility
///
public Visibility OrderExistDataGridVisibility
{
get { return orderExistDataGridVisibility; }
set { orderExistDataGridVisibility = value; PropertyChange("OrderExistDataGridVisibility"); }
}
#region BasketItems
private ObservableCollection miniBasketData;
///
/// Mini Basket Data
///
public ObservableCollection MiniBasketData
{
get { return miniBasketData; }
set { miniBasketData = value; PropertyChange("MiniBasketData"); }
}
///
/// Basket Item Delete Command
///
public ICommand BasketItemDeleteCommand { get; protected set; } = null;
#endregion
#region Total
///
/// Order Total Payment Icon
///
public string OrderTotalPaymentIcon { get; set; } = ResourceManager.GetNximagePathAdd("Ic_totalcost.png", CommonValue.PBdesignImagesPath);
private int orderTotalCount = 0;
///
/// Order Total Count
///
public int OrderTotalCount
{
get { return orderTotalCount; }
set { orderTotalCount = value; PropertyChange("OrderTotalCount"); }
}
private double orderTotalPayment = 0d;
///
/// Order Total Payment
///
public double OrderTotalPayment
{
get { return orderTotalPayment; }
set { orderTotalPayment = value; PropertyChange("OrderTotalPayment"); }
}
#endregion
#region Button
private bool orderDetailEnable;
///
/// Order Detail Enabled
///
public bool OrderDetailEnable
{
get { return orderDetailEnable; }
set { orderDetailEnable = value; PropertyChange("OrderDetailEnable"); }
}
///
/// Order Detail Command
///
public ICommand OrderDetailCommand { get; protected set; } = null;
private bool gotoPaymentEnable;
///
/// Goto Payment Enabled
///
public bool GotoPaymentEnable
{
get { return gotoPaymentEnable; }
set { gotoPaymentEnable = value; PropertyChange("GotoPaymentEnable"); }
}
///
/// Goto Payment Command
///
public ICommand GotoPaymentCommand { get; protected set; } = null;
private PBPaymentPageType openPBPaymentPage = PBPaymentPageType.DetailBasket;
///
/// Open PB Payment Page
///
public PBPaymentPageType OpenPBPaymentPage
{
get { return openPBPaymentPage; }
set { openPBPaymentPage = value; PropertyChange("OpenPBPaymentPage"); }
}
#endregion
#endregion MiniBasket
#endregion Members
#region [ Ctor ]
///
/// Ctor
///
public VmPBViewModel()
{
WaitWindowFrom = WaitWindow.GetInstance;
InitViewModel();
LastAccessTime = DateTime.Now;
ToIntoroTimer = new DispatcherTimer
{
Interval = TimeSpan.FromSeconds(1d),
};
ToIntoroTimer.Tick += ToIntoroTimer_Tick;
backDataService = new BackDataService();
}
///
/// Dispose
///
public void Dispose()
{
if (ScanProcess != null)
{
IsScanProcess = false;
ScanProcess.Wait();
ScanProcess = null;
}
if (backDataService != null)
{
backDataService.Dispose();
backDataService = null;
}
this.PropertyChanged -= VmPBViewModel_PropertyChanged;
if (WaitWindowFrom != null)
{
WaitWindowFrom.CloseWaitWindow();
WaitWindowFrom = null;
}
if (ToIntoroTimer != null)
{
ToIntoroTimer.Stop();
ToIntoroTimer.Tick -= ToIntoroTimer_Tick;
ToIntoroTimer = null;
}
if (popupManager != null)
{
popupManager = null;
}
GC.SuppressFinalize(this);
}
#endregion Ctor
#region [ Methods ]
private void InitViewModel()
{
WaitWindowFrom.ShowWaitWindow();
try
{
//Intro
SetCommon();
SetIntro();
ToExecuteNothing = new Command(ToExecuteNothingHandler);
RollMediaCommand = new Command(RollMediaCommandHandler);
//GMB Left
GotoFirstCommand = new Command(GotoFirstCommandHandler);
ReaderCheckCommand = new Command(ReaderCheckCommandHandler);
//GMB Right
LanguageCommand = new Command(LanguageCommandHandler);
HappyPointCommand = new Command(HappyPointCommandHandler);
CallEmployeeCommand = new Command(CallEmployeeCommandHandler);
GotoIntroPageCommand = new Command(GotoIntroPageCommadHandler);
//GMB Center
GmbAIscannerCommand = new Command(GmbAIscannerCommandHandler);
GmbOrderCommand = new Command(GmbOrderCommandHandler);
GmbAIscannerEnable = false;
//Scan Contents
RescanCommand = new Command(RescanCommandHandler);
GotoBarcodeCommand = new Command(GotoBarcodeCommandHandler);
//Item Contents
ItemCommand = new Command(ItemCommandCommandHandler);
Category1Command = new Command(Category1CommandHandler);
Category2Command = new Command(Category2CommandHandler);
OrderHistoryCommand = new Command(OrderHistoryCommandHandler);
OrderHistoryCloseCommand = new Command(OrderHistoryCloseCommandHandler);
Page2LeftCommand = new Command(Page2LeftCommandHandler);
Page2RightCommand = new Command(Page2RightCommandHandler);
OrderColumnCount = 5;
OrderRowCount = 2;
PageSelectCommand = new Command(PageSelectCommandHandler);
//MiniBasket
MiniBasketDeleteAllCommand = new Command(MiniBasketDeleteAllCommandHandler);
EmptyBasketDropCommand = new Command(EmptyBasketDropCommandHandler);
BasketItemDeleteCommand = new Command(BasketItemDeleteCommandHandler);
OrderDetailCommand = new Command(OrderDetailCommandHandler);
GotoPaymentCommand = new Command(GotoPaymentCommandHandler);
this.PropertyChanged += VmPBViewModel_PropertyChanged;
ShowLanguageType = CommonValue.CommonLanguageType;
ScanProcess = new Task(ScanDataProcessor);
ScanProcess.Start();
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "InitViewModel()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
WaitWindowFrom.CloseWaitWindow();
}
}
private void SetCommon()
{
#if TESTMODE
using (var dataHelper = new CommonDataHelper())
{
if (!dataHelper.NeedInitModule) dataHelper.SetCommonLanguage();
}
#endif
//PosOption 값 획득
using (var backDataService = new BackDataService())
{
this.OptionValue810 = backDataService.GetPosOption(nameof(PosOptionType.OPT810));
this.OptionValue811 = backDataService.GetPosOption(nameof(PosOptionType.OPT811));
this.OptionValue812 = backDataService.GetPosOption(nameof(PosOptionType.OPT812));
//if (this.PosOptionValues == null) this.PosOptionValues = new Dictionary();
//if (!this.PosOptionValues.ContainsKey(nameof(PosOptionType.OPT810))) { this.PosOptionValues.Add(nameof(PosOptionType.OPT810), this.optionValue810); }
//if (!this.PosOptionValues.ContainsKey(nameof(PosOptionType.OPT811))) { this.PosOptionValues.Add(nameof(PosOptionType.OPT811), this.optionValue811); }
}
}
#region Intro
private void SetIntro()
{
using (var dataHelper = new CommonDataHelper())
{
var getIntro = dataHelper.GetIntroData(1920d);
if (getIntro is List && getIntro.Count > 0)
{
IntroItems = new ObservableCollection(getIntro);
}
else
{
#region Default Intro
IntroItems = new ObservableCollection
{
new M_IntroItems
{
ItemsStack=0,
StackWidth=1920,
StackContents = new List
{
new M_StackContents
{
ItemsIndex = 0,
MediaRollItems = new List
{
new M_MediaRollItem
{
Type = MediaType.Image,
MediaPath =ResourceManager.GetNximagePathAdd("nextstation_img.jpg", CommonValue.PBdesignImagesPath),
LinkType = IntroLinkType.Page,
LinkParameter = "FirstSelect",
RunnigSeconds =10
},
}
},
new M_StackContents
{
ItemsIndex = 1,
MediaRollItems = new List
{
new M_MediaRollItem{
Type = MediaType.Image,
MediaPath = ResourceManager.GetNximagePathAdd("nextstation_button.jpg", CommonValue.PBdesignImagesPath),
LinkType = IntroLinkType.Page,
LinkParameter = "ItemPage",
RunnigSeconds =10
},
}
}
}
},
};
#endregion
}
}
}
#endregion Intro
#region Contents
#region Self Order
private void SetContents()
{
if (!string.IsNullOrEmpty(DefaultLinkValue))
{
if (DefaultLinkValue.ToLower().StartsWith("category&"))
{
DataModelInit();
var getCategory = DefaultLinkValue.Split('&');
switch (getCategory.Length)
{
case 2:
DefaultCategory1Item = Category1Data.IndexOf(Category1Data.Where(r => r.Category1.Equals(getCategory[1])).FirstOrDefault());
if (DefaultCategory1Item < 0) DefaultCategory1Item = 0;
DefaultCategory2Item = 0;
break;
case 3:
DefaultCategory1Item = Category1Data.IndexOf(Category1Data.Where(r => r.Category1.Equals(getCategory[1])).FirstOrDefault());
if (DefaultCategory1Item < 0) DefaultCategory1Item = 0;
if (!string.IsNullOrEmpty(getCategory[2]))
{
DefaultCategory2Item = Category2Data.IndexOf(Category2Data.Where(r => r.Category2.Equals(getCategory[2])).FirstOrDefault());
if (DefaultCategory2Item < 0) DefaultCategory2Item = 0;
}
else
{
DefaultCategory2Item = 0;
}
break;
default:
DefaultCategory1Item = 0;
DefaultCategory2Item = 0;
break;
}
DefaultOrderItem = 0;
}
else
{
DataModelInit();
var findItem = AllItems.Where(r => r.ItemCode.Equals(DefaultLinkValue)).FirstOrDefault();
if (findItem is M_ItemData)
{
DefaultCategory1Item = Category1Data.IndexOf(Category1Data.Where(r => r.Category1.Equals(findItem.Category1)).FirstOrDefault());
DefaultCategory2Item = Category2Data.IndexOf(Category2Data.Where(r => r.Category2.Equals(findItem.Category2)).FirstOrDefault());
DefaultOrderItem = OrderItems.IndexOf(OrderItems.Where(r => r.ItemCode.Equals(DefaultLinkValue)).FirstOrDefault());
}
else
{
DefaultCategory1Item = 0;
DefaultCategory2Item = 0;
DefaultOrderItem = 0;
}
}
}
else
{
DataModelInit();
DefaultCategory1Item = 0;
DefaultCategory2Item = 0;
DefaultOrderItem = 0;
}
}
private void DataModelInit()
{
try
{
if (NeedIntailizeItems)
{
ItemCacheClear();
this.SetItemData();
SetCategory1();
NeedIntailizeItems = false;
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "DataModelInit()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
}
private void ItemCacheClear()
{
if (AllItems is List)
{
foreach (var aitem in AllItems)
{
if (aitem.DataParameter.NormalBrush != null)
{
CacheManager.CacheRemove(aitem.DataParameter.NormalBrush);
}
if (aitem.DataParameter.SwitchOnBrush != null)
{
CacheManager.CacheRemove(aitem.DataParameter.SwitchOnBrush);
}
if (aitem.DataParameter.DisableBrush != null)
{
CacheManager.CacheRemove(aitem.DataParameter.DisableBrush);
}
if (aitem.DataParameter.DownBrush != null)
{
CacheManager.CacheRemove(aitem.DataParameter.DownBrush);
}
if (aitem.DataParameter.DragCursorImage != null)
{
CacheManager.CacheRemove(aitem.DataParameter.DragCursorImage);
}
}
}
}
private void SetItemData()
{
try
{
#region Item Data From DB
using (var dataHelper = new CommonDataHelper())
{
//Categoty Data
AllCategory = dataHelper.GetCategoryData();
if (AllCategory is List)
{
//Category Design Parameter Add
foreach (var category1Item in AllCategory)
{
//Category1 Design Parameter
category1Item.Catalog1Item.DataParameter = new M_AnimationButton
{
NormalBrush = ResourceManager.GetNximagePathAdd("btn_main_menu_n.png", CommonValue.PBdesignImagesPath),
SwitchOnBrush = ResourceManager.GetNximagePathAdd("btn_main_menu_p.png", CommonValue.PBdesignImagesPath),
Width = 150,
Height = 160,
BrushStretch = Stretch.Fill,
ClickAnimationType = ButtonAnimationType.TextSizeDown,
CircleBackBrush = "Transparent",
CircleTextBruch = "Transparent",
CircleText = string.Empty,
TextVisible = Visibility.Visible,
TextFontSize = 28,
SwitchOnFontSize = 30,
TextForeground = "#adadad",
TextWrapping = TextWrapping.Wrap,
SwitchOnForeground = "White",
TextFontFamily = "NanumSquare",
TextFontWeight = FontWeights.Normal,
SwitchOnFontWeight = FontWeights.Bold,
TextAlignment = TextAlignment.Right,
TextHorizontalAlignment = HorizontalAlignment.Right,
TextVerticalAlignment = VerticalAlignment.Top,
TextMargin = new Thickness(5, 21, 20, 21),
LanguageText = dataHelper.GetLaguageData("CATE", category1Item.Catalog1Item.Category1)
};
foreach (var category2Item in category1Item.Catalog2Items)
{
//Category2 Design Parameter
category2Item.DataParameter = new M_AnimationButton
{
NormalBrush = "Transparent",
SwitchOnBrush = "Transparent",
Width = 194,
Height = 86,
BrushStretch = Stretch.Fill,
ClickAnimationType = ButtonAnimationType.TextBounceDown,
CircleBackBrush = "Transparent",
CircleTextBruch = "Transparent",
CircleText = string.Empty,
TextVisible = Visibility.Visible,
TextFontSize = 24,
SwitchOnFontSize = 24,
TextForeground = "Black",
SwitchOnForeground = "#1469cc",
TextFontFamily = "NanumSquare",
TextFontWeight = FontWeights.Normal,
SwitchOnFontWeight = FontWeights.Bold,
TextAlignment = TextAlignment.Center,
TextMargin = new Thickness(0, 0, 18, 0),
TextWrapping = TextWrapping.Wrap,
TextHorizontalAlignment = HorizontalAlignment.Center,
TextVerticalAlignment = VerticalAlignment.Center,
LanguageText = dataHelper.GetLaguageData("CATE", category2Item.Category2)
};
};
}
}
//Item Master
AllItems = dataHelper.GetItemsData();
if (AllItems is List && AllItems.Count > 0)
{
//Item Design Parameter Add
foreach (var aItem in AllItems)
{
aItem.BadgeHeight = 30;
aItem.BadgeOrientation = Orientation.Horizontal;
if (aItem.BadgeImages is List && aItem.BadgeImages.Count > 0)
{
var newBadgeImages = new List();
foreach (var aBadgeImage in aItem.BadgeImages)
{
var strBadgeImage = ResourceManager.GetNximagePathAdd(aBadgeImage, CommonValue.PBdesignImagesPath);
if (!string.IsNullOrEmpty(strBadgeImage))
{
newBadgeImages.Add(strBadgeImage);
}
}
aItem.BadgeImages = newBadgeImages;
}
if (aItem.Option is List && aItem.Option.Count > 0)
{
foreach (var aOptionGRP in aItem.Option)
{
if (aOptionGRP is M_ItemOptionGroup)
{
aOptionGRP.ImageFile = aOptionGRP.Index.Equals(0)
? "ic_option_takein.png"
: aOptionGRP.Index.Equals(1)
? "ic_option_shot.png"
: "ic_option_candle.png";
}
}
}
var itemImage = ResourceManager.GetItemImage(aItem.ImageFile, CommonValue.ItemDefaultImage);//파일 없을 경우 DefaultImage로
aItem.DataParameter = new M_AnimationButton
{
NormalBrush = itemImage,
DragCursorImage = itemImage,
DisableBrush = ResourceManager.GetNximagePathAdd("img_contents_soldout.png", CommonValue.PBdesignImagesPath),
Width = 100,
Height = 100,
Margin = new Thickness(80, 30, 80, 40),
BrushStretch = Stretch.Fill,
DragCursorHotSpot = HotSpotType.Center,
ClickAnimationType = ButtonAnimationType.SizeDown,
CircleBackBrush = "Transparent",
CircleTextBruch = "Transparent",
Enabled = !aItem.IsSoldOut,
CircleText = string.Empty,
};
aItem.BaseTextBlock = new M_TextBlock()
{
LanguageData = dataHelper.GetLaguageData("PROD", aItem.ItemCode),
TextSize = 24,
Width = 250,
Height = 82,
TextBrush = "Black",
TextFontFamily = "NanumSquare",
TextVerticalAlignment = VerticalAlignment.Center,
TextMargin = new Thickness(5, 0, 5, 0),
TextWeight = FontWeights.Bold,
TextWrapping = TextWrapping.Wrap
};
aItem.AdditionTextBlock = new M_TextBlock()
{
LanguageData = new List
{
new M_Language{ Type = SupportLanguageType.ko, LanguageData = string.Format("₩{0:#,##0}", aItem.Price)},
},
TextSize = 26,
Width = 250,
Height = 40,
TextBrush = "#1469cc",
TextFontFamily = "NanumSquare",
TextVerticalAlignment = VerticalAlignment.Top,
TextMargin = new Thickness(5, 0, 5, 0),
TextWeight = FontWeights.Bold,
};
}
}
else
{
#if TESTMODE
#region Test Item
AllItems = new List();
AllCategory = new List();
var itemFiles = ResourceManager.GetItemImages("*.png");
int index = 0;
foreach (var aItemFles in itemFiles)
{
var aFile = new FileInfo(aItemFles);
if (Regex.IsMatch(aFile.Name.Replace(aFile.Extension, ""), "^[0-9]") && !aFile.Name.Contains("_FULL"))
{
var category1Code = aFile.Name.Substring(0, 1);
var category2Code = aFile.Name.Substring(1, 2);
var testPrice = 2000d;
int intCategory1Code = int.Parse(category1Code);
if (intCategory1Code < 4)
{
//Add ItemData
AllItems.Add(new M_ItemData()
{
Index = index,
ItemCode = aFile.Name.Replace(aFile.Extension, ""),
Category1 = category1Code,
Category2 = category2Code,
Price = testPrice,
BadgeHeight = 30,
BadgeOrientation = Orientation.Horizontal,
BadgeImages = index.Equals(0)
? new List
{
ResourceManager.GetNximagePathAdd("Img_best.png", CommonValue.PBdesignImagesPath),
ResourceManager.GetNximagePathAdd("Img_new.png", CommonValue.PBdesignImagesPath),
ResourceManager.GetNximagePathAdd("img_like.png", CommonValue.PBdesignImagesPath),
ResourceManager.GetNximagePathAdd("img_event.png", CommonValue.PBdesignImagesPath)
}
: index.Equals(1)
? new List
{
ResourceManager.GetNximagePathAdd("Img_best.png", CommonValue.PBdesignImagesPath),
ResourceManager.GetNximagePathAdd("Img_new.png", CommonValue.PBdesignImagesPath),
}
: index.Equals(2)
? new List
{
ResourceManager.GetNximagePathAdd("img_like.png", CommonValue.PBdesignImagesPath),
ResourceManager.GetNximagePathAdd("img_event.png", CommonValue.PBdesignImagesPath),
}
: index.Equals(3)
? new List
{
ResourceManager.GetNximagePathAdd("Img_best.png", CommonValue.PBdesignImagesPath),
}
: null,
DataParameter = new M_AnimationButton
{
NormalBrush = aItemFles,
DragCursorImage = aItemFles,
DisableBrush = ResourceManager.GetNximagePathAdd("img_contents_soldout.png", CommonValue.PBdesignImagesPath),
Width = 100,
Height = 100,
Margin = new Thickness(80, 30, 80, 40),
BrushStretch = Stretch.Fill,
DragCursorHotSpot = HotSpotType.Center,
ClickAnimationType = ButtonAnimationType.SizeDown,
CircleBackBrush = "Transparent",
CircleTextBruch = "Transparent",
Enabled = !index.Equals(7),
CircleText = string.Empty,
},
BaseTextBlock = new M_TextBlock()
{
LanguageData = index.Equals(0)
? new List
{
new M_Language{ Type = SupportLanguageType.en, LanguageData = "en아메리카노"},
new M_Language{ Type = SupportLanguageType.ko, LanguageData = "아메리카노"}
}
: index.Equals(1)
? new List
{
new M_Language{ Type = SupportLanguageType.en, LanguageData = "3mm 황금비율로 바삭하고 en고소한 전병세트"},
new M_Language{ Type = SupportLanguageType.ko, LanguageData = "3mm 황금비율로 바삭하고 고소한 전병세트"}
}
: index.Equals(2)
? new List
{
new M_Language{ Type = SupportLanguageType.en, LanguageData = "en카푸치노"},
new M_Language{ Type = SupportLanguageType.ko, LanguageData = "카푸치노"}
}
: index.Equals(3)
? new List
{
new M_Language{ Type = SupportLanguageType.en, LanguageData = "en바닐라라떼"},
new M_Language{ Type = SupportLanguageType.ko, LanguageData = "바닐라라떼"}
}
: new List
{
new M_Language{ Type = SupportLanguageType.en, LanguageData = aFile.Name.Replace(aFile.Extension, "")},
new M_Language{ Type = SupportLanguageType.ko, LanguageData = aFile.Name.Replace(aFile.Extension, "")}
},
TextSize = 24,
Width = 250,
Height = 82,
TextBrush = "Black",
TextFontFamily = "NanumSquare",
TextVerticalAlignment = VerticalAlignment.Center,
TextMargin = new Thickness(5, 0, 5, 0),
TextWeight = FontWeights.Bold,
TextWrapping = TextWrapping.Wrap
},
AdditionTextBlock = new M_TextBlock()
{
LanguageData = new List {
new M_Language{ Type = SupportLanguageType.ko, LanguageData = string.Format("₩{0:#,##0}", testPrice)},
},
TextSize = 26,
Width = 250,
Height = 40,
TextBrush = "#1469cc",
TextFontFamily = "NanumSquare",
TextVerticalAlignment = VerticalAlignment.Top,
TextMargin = new Thickness(5, 0, 5, 0),
TextWeight = FontWeights.Bold,
},
});
//Add CategoryData
if (!CheckExistCategory1(category1Code))
{
var mItemData = new M_ItemData
{
Index = -1,
ItemCode = category1Code,
Category1 = category1Code,
DataParameter = new M_AnimationButton
{
NormalBrush = ResourceManager.GetNximagePathAdd("btn_main_menu_n.png", CommonValue.PBdesignImagesPath),
SwitchOnBrush = ResourceManager.GetNximagePathAdd("btn_main_menu_p.png", CommonValue.PBdesignImagesPath),
Width = 150,
Height = 160,
BrushStretch = Stretch.Fill,
ClickAnimationType = ButtonAnimationType.TextSizeDown,
CircleBackBrush = "Transparent",
CircleTextBruch = "Transparent",
CircleText = string.Empty,
TextVisible = Visibility.Visible,
TextFontSize = 27,
SwitchOnFontSize = 40,
TextForeground = "#adadad",
TextWrapping = TextWrapping.Wrap,
SwitchOnForeground = "White",
TextFontFamily = "NanumSquare",
TextFontWeight = FontWeights.Normal,
SwitchOnFontWeight = FontWeights.Bold,
TextAlignment = TextAlignment.Right,
TextHorizontalAlignment = HorizontalAlignment.Right,
TextVerticalAlignment = VerticalAlignment.Top,
TextMargin = new Thickness(10, 21, 27, 21),
LanguageText = new List {
new M_Language{ Type = SupportLanguageType.en, LanguageData = category1Code+"en" },
new M_Language{ Type = SupportLanguageType.ko, LanguageData = category1Code+"ko" }
},
}
};
switch (category1Code)
{
case "0":
mItemData.DataParameter.LanguageText = new List {
new M_Language{ Type = SupportLanguageType.en, LanguageData = "Coffee" },
new M_Language{ Type = SupportLanguageType.ko, LanguageData = "커피" }
};
break;
case "1":
mItemData.DataParameter.LanguageText = new List {
new M_Language{ Type = SupportLanguageType.en, LanguageData = "Beverage" },
new M_Language{ Type = SupportLanguageType.ko, LanguageData = "음료" }
};
break;
case "2":
mItemData.DataParameter.LanguageText = new List {
new M_Language{ Type = SupportLanguageType.en, LanguageData = "Sherbet" },
new M_Language{ Type = SupportLanguageType.ko, LanguageData = "빙수" }
};
break;
case "3":
mItemData.DataParameter.LanguageText = new List {
new M_Language{ Type = SupportLanguageType.en, LanguageData = "Cake" },
new M_Language{ Type = SupportLanguageType.ko, LanguageData = "케이크" }
};
break;
}
AddCategory1(category1Code, mItemData);
}
if (!CheckExistCategory2(category1Code, category2Code))
{
var mItemData = new M_ItemData
{
Index = -1,
ItemCode = category2Code,
Category1 = category1Code,
Category2 = category2Code,
DataParameter = new M_AnimationButton
{
NormalBrush = "Transparent",
SwitchOnBrush = "Transparent",
//SwitchOnBrush = ResourceManager.GetNximagePathAdd("line_main_tab.png", CommonValue.PBdesignImagesPath),
Width = 194,
Height = 86,
BrushStretch = Stretch.Fill,
ClickAnimationType = ButtonAnimationType.TextBounceDown,
CircleBackBrush = "Transparent",
CircleTextBruch = "Transparent",
CircleText = string.Empty,
TextVisible = Visibility.Visible,
TextFontSize = 24,
SwitchOnFontSize = 28,
TextForeground = "Black",
SwitchOnForeground = "#1469cc",
TextFontFamily = "NanumSquare",
TextFontWeight = FontWeights.Normal,
SwitchOnFontWeight = FontWeights.Bold,
TextAlignment = TextAlignment.Center,
TextMargin = new Thickness(0, 0, 18, 0),
TextWrapping = TextWrapping.Wrap,
TextHorizontalAlignment = HorizontalAlignment.Center,
TextVerticalAlignment = VerticalAlignment.Center,
LanguageText = new List {
new M_Language{ Type = SupportLanguageType.en, LanguageData = category2Code+"en" },
new M_Language{ Type = SupportLanguageType.ko, LanguageData = category2Code+"ko" }
},
}
};
if (category1Code.Equals("0"))
{
switch (category2Code)
{
case "01":
mItemData.DataParameter.LanguageText = new List {
new M_Language{ Type = SupportLanguageType.en, LanguageData = "Cafe Adagio" },
new M_Language{ Type = SupportLanguageType.ko, LanguageData = "카페 아다지오" }
};
break;
case "10":
mItemData.DataParameter.LanguageText = new List {
new M_Language{ Type = SupportLanguageType.en, LanguageData = "Latte&Tea" },
new M_Language{ Type = SupportLanguageType.ko, LanguageData = "라떼&티" }
};
break;
case "50":
mItemData.DataParameter.LanguageText = new List {
new M_Language{ Type = SupportLanguageType.en, LanguageData = "Juice&Ade" },
new M_Language{ Type = SupportLanguageType.ko, LanguageData = "주스&에이드" }
};
break;
case "51":
mItemData.DataParameter.LanguageText = new List {
new M_Language{ Type = SupportLanguageType.en, LanguageData = "Smoothies" },
new M_Language{ Type = SupportLanguageType.ko, LanguageData = "스무디" }
};
break;
case "52":
mItemData.DataParameter.LanguageText = new List {
new M_Language{ Type = SupportLanguageType.en, LanguageData = "Sherbet" },
new M_Language{ Type = SupportLanguageType.ko, LanguageData = "빙수" }
};
break;
case "71":
mItemData.DataParameter.LanguageText = new List {
new M_Language{ Type = SupportLanguageType.en, LanguageData = "Product Beverage" },
new M_Language{ Type = SupportLanguageType.ko, LanguageData = "완제음료" }
};
break;
}
}
AddCategory2(category1Code, category2Code, mItemData);
}
index++;
}
}
}
#endregion
#endif
}
}
#endregion
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "SetOrderHistoryItems()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
}
private void SetOrderHistoryItems()
{
try
{
if (FindOrderHistoryItems is List
&& FindOrderHistoryItems.Count > 0
&& AllItems is List
&& AllItems.Count > 0)
{
var newOrderHistoryItems = new List();
foreach (var aHistoryItem in FindOrderHistoryItems)
{
var findItem = AllItems.Find(r => r.ItemCode.Equals(aHistoryItem));
if (findItem is M_ItemData) newOrderHistoryItems.Add(findItem);
}
if (newOrderHistoryItems.Count > 0)
{
OrderHistoryItems = new ObservableCollection(newOrderHistoryItems);
}
else
{
OrderHistoryItems = null;
}
}
else
{
OrderHistoryItems = null;
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "SetOrderHistoryItems()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
}
private void SetCategory1(int _index = 0)
{
if (AllCategory != null)
{
if (NeedIntailizeItems) Category1Data = new ObservableCollection((from aRow in AllCategory
select aRow.Catalog1Item).ToList());
DefaultCategory1Item = _index < 0 ? 0 : _index;
}
}
private void SetCategory2(int _index = 0)
{
if (Category1Data != null)
{
var catalog2Items = AllCategory[DefaultCategory1Item].Catalog2Items;
Category2Data = new ObservableCollection(catalog2Items);
DefaultCategory2Item = _index < 0 ? 0 : _index;
}
}
private void SetItemList(int _index = 0)
{
if (AllItems != null)
{
var category1Code = Category1Data[DefaultCategory1Item < 0 ? 0 : DefaultCategory1Item].Category1;
var category2Code = Category2Data[DefaultCategory2Item < 0 ? 0 : DefaultCategory2Item].Category2;
if (OrderItems != null) OrderItemPageNo = 0;
OrderItems = new ObservableCollection
(
from aRow in AllItems
where aRow.Category1.Equals(category1Code)
&& aRow.Category2.Equals(category2Code)
select aRow
);
DefaultOrderItem = _index < 0 ? 0 : _index;
}
}
private bool CheckExistCategory1(string _categoryCode)
{
bool result = false;
try
{
if (AllCategory != null)
{
result = !AllCategory.Where(r => r.Catalog1Item.Category1.Equals(_categoryCode)).Count().Equals(0);
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "CheckExistCategory1()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
result = false;
}
return result;
}
private bool CheckExistCategory2(string _category1Code, string _category2Code)
{
bool result = false;
try
{
if (AllCategory != null)
{
var category1Items = AllCategory.Where(r => r.Catalog1Item.Category1.Equals(_category1Code)).FirstOrDefault();
if (category1Items != null && category1Items.Catalog2Items != null)
{
result = !category1Items.Catalog2Items.Where(r => r.Category2.Equals(_category2Code)).Count().Equals(0);
}
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "CheckExistCategory2()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
result = false;
}
return result;
}
private void AddCategory1(string _categoryCode, M_ItemData _categoryItem)
{
if (AllCategory != null)
{
if (AllCategory.Where(r => r.Catalog1Item.Category1.Equals(_categoryCode)).Count().Equals(0))
{
_categoryItem.Index = AllCategory.Count;
AllCategory.Add(
new M_CategoryItems
{
Catalog1Item = _categoryItem,
Catalog2Items = new List()
}
);
}
}
}
private void AddCategory2(string _category1Code, string _category2Code, M_ItemData _categoryItem)
{
if (AllCategory != null)
{
var category1Items = AllCategory.Where(r => r.Catalog1Item.Category1.Equals(_category1Code)).FirstOrDefault();
if (category1Items != null && category1Items.Catalog2Items != null)
{
if (category1Items.Catalog2Items.Where(r => r.Category2.Equals(_category2Code)).Count().Equals(0))
{
_categoryItem.Index = category1Items.Catalog2Items.Count;
category1Items.Catalog2Items.Add(_categoryItem);
}
}
}
}
private void SetPageNumber()
{
var pageCount = GetItemPageCount();
var pageNumbers = new ObservableCollection();
for (int index = 0; index < pageCount; index++)
{
pageNumbers.Add(new M_ItemData
{
Index = index,
DataParameter = new M_AnimationButton
{
NormalBrush = ResourceManager.GetNximagePathAdd("Img_page_dot_off.png", CommonValue.PBdesignImagesPath),
SwitchOnBrush = ResourceManager.GetNximagePathAdd("Img_page_dot_on.png", CommonValue.PBdesignImagesPath),
Width = 20,
Height = 20,
BrushStretch = Stretch.Fill,
ClickAnimationType = ButtonAnimationType.SizeDown,
CircleBackBrush = "Transparent",
CircleTextBruch = "Transparent",
CircleText = string.Empty,
TextVisible = Visibility.Collapsed,
}
});
}
ItemPageStatus = pageNumbers;
}
#endregion
#region Senssing
private M_ItemData SetItemDesignData(CommonDataHelper dataHelper, M_ItemData aItem)
{
var result = aItem;
try
{
aItem.BadgeHeight = 30;
aItem.BadgeOrientation = Orientation.Horizontal;
if (aItem.BadgeImages is List && aItem.BadgeImages.Count > 0)
{
var newBadgeImages = new List();
foreach (var aBadgeImage in aItem.BadgeImages)
{
var strBadgeImage = ResourceManager.GetNximagePathAdd(aBadgeImage, CommonValue.PBdesignImagesPath);
if (!string.IsNullOrEmpty(strBadgeImage))
{
newBadgeImages.Add(strBadgeImage);
}
}
aItem.BadgeImages = newBadgeImages;
}
//if (aItem.Option is List && aItem.Option.Count > 0)
//{
// foreach (var aOptionGRP in aItem.Option)
// {
// if (aOptionGRP is M_ItemOptionGroup)
// {
// aOptionGRP.ImageFile = aOptionGRP.Index.Equals(0)
// ? "ic_option_takein.png"
// : aOptionGRP.Index.Equals(1)
// ? "ic_option_shot.png"
// : "ic_option_candle.png";
// }
// }
//}
var itemImage = ResourceManager.GetItemImage(aItem.ImageFile, CommonValue.ItemDefaultImage);
aItem.DataParameter = new M_AnimationButton
{
NormalBrush = itemImage,
DragCursorImage = itemImage,
DisableBrush = ResourceManager.GetNximagePathAdd("img_contents_soldout.png", CommonValue.PBdesignImagesPath),
Width = 100,
Height = 100,
Margin = new Thickness(80, 30, 80, 40),
BrushStretch = Stretch.Fill,
DragCursorHotSpot = HotSpotType.Center,
ClickAnimationType = ButtonAnimationType.SizeDown,
CircleBackBrush = "Transparent",
CircleTextBruch = "Transparent",
Enabled = !aItem.IsSoldOut,
CircleText = string.Empty,
};
aItem.BaseTextBlock = new M_TextBlock()
{
LanguageData = dataHelper.GetLaguageData("PROD", aItem.ItemCode),
TextSize = 24,
Width = 250,
Height = 82,
TextBrush = "Black",
TextFontFamily = "NanumSquare",
TextVerticalAlignment = VerticalAlignment.Center,
TextMargin = new Thickness(5, 0, 5, 0),
TextWeight = FontWeights.Bold,
TextWrapping = TextWrapping.Wrap
};
aItem.AdditionTextBlock = new M_TextBlock()
{
LanguageData = new List
{
new M_Language{ Type = SupportLanguageType.ko, LanguageData = string.Format("₩{0:#,##0}", aItem.Price)},
},
TextSize = 26,
Width = 250,
Height = 40,
TextBrush = "#1469cc",
TextFontFamily = "NanumSquare",
TextVerticalAlignment = VerticalAlignment.Top,
TextMargin = new Thickness(5, 0, 5, 0),
TextWeight = FontWeights.Bold,
};
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "SetItemDesignData()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
result = aItem;
}
return result;
}
private void ProcessBardcord()
{
Console.WriteLine("Paag={0},SubPage={1},Barcord={2}", DefaultPage, SensingSubPage, ReadBarCode);
if (string.IsNullOrEmpty(ReadBarCode) || !DefaultPage.Equals(PBPageType.Sensing)) return;
var barcordData = ReadBarCode.Trim().ToUpper();
if (barcordData.rIsBigAlpa() && barcordData.Contains("SCANSTART"))
{
AIScanCount = 0;
}
else
{
var isNumeric = barcordData.rIsNum();
var isAlpaNumaric = barcordData.rIsAlpaNum();
var barcord = isNumeric && isAlpaNumaric ? barcordData : null;
var itemcode = !isNumeric && isAlpaNumaric ? barcordData.rGetOnlyNum() : null;
var itemType = string.IsNullOrEmpty(itemcode) && !string.IsNullOrEmpty(barcord) && SensingSubPage.Equals(PBSensingSubPageType.BarcordPage)
? BasketItemType.Barcode
: !string.IsNullOrEmpty(itemcode) && string.IsNullOrEmpty(barcord) && SensingSubPage.Equals(PBSensingSubPageType.SensingPage)
? BasketItemType.Scan
: BasketItemType.None;
if (!itemType.Equals(BasketItemType.None))
{
var newScanData = new M_ScanData
{
ItemCode = itemcode,
Barcord = barcord,
ItemType = itemType,
};
scanQueue.Enqueue(newScanData);
}
}
}
private void ScanDataProcessor()
{
while (IsScanProcess)
{
try
{
var scanData = scanQueue.Count > 0 ? scanQueue.Dequeue() : null;
if (scanData is M_ScanData)
{
using (var dataHelper = new CommonDataHelper())
{
var getItemData = dataHelper.GetBarcordItemsData(scanData.ItemCode, scanData.Barcord);
if (getItemData is M_ItemData)
{
var designItem = SetItemDesignData(dataHelper, getItemData);
AddItem2Basket(designItem, scanData.ItemType);
if (scanData.ItemType.Equals(BasketItemType.Scan)) AIScanCount += 1;
}
else
{
CommonLog.ErrorLogWrite(this, "ScanDataProcessor()", "Not Found Item Error !!", string.Format("\nItem={0},Barcord={1}", scanData.ItemCode, scanData.Barcord));
}
}
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "Dispose", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
}
}
#endregion
#region Basket
private void AddItem2Basket(M_ItemData _itemData, BasketItemType _itemType = BasketItemType.Order)
{
var option = new List();
var itemCount = 1;
var unitPrice = _itemData.Price;
if (_itemType.Equals(BasketItemType.Order))
{
if (_itemData.IsOption)
{
ToIntorTimerStop();
try
{
var newOptions = new List();
foreach (var aOptionGroup in _itemData.Option)
{
newOptions.Add(aOptionGroup.Clone());
}
var popupReturn = popupManager.OpenOptionSelect(_itemData.BaseTextBlock.LanguageData
, newOptions
, _itemData.DataParameter.NormalBrush
, itemCount
, _itemData.Price);
if (popupReturn is M_PopupReturn)
{
if (popupReturn.TimeOut)
{
DefaultPage = PBPageType.Intro;
option = null;
}
else
{
if (popupReturn.PopupArgs is M_OptionReturn getOption)
{
option = getOption.Options;
itemCount = getOption.ItemCount;
unitPrice = getOption.PriceWithOption;
}
else
{
option = null;
}
}
}
else
{
option = null;
}
}
catch
{
option = null;
}
finally
{
ToIntorTimerStart();
}
if (option == null) return;
}
else
{
option = null;
itemCount = 1;
unitPrice = _itemData.Price;
}
}
else
{
option = null;
}
using (var posDataService = new PosDataService())
{
var getNewBasketData = posDataService.AddItemToBasket(MiniBasketData
, itemCount
, unitPrice
, CommonValue.PBdesignImagesPath
, _itemData
, option
, _itemType);
if (getNewBasketData is ObservableCollection) MiniBasketData = getNewBasketData;
}
}
private double GetItemPrice(M_ItemData _itemData, List _option)
{
double result = _itemData.Price;
try
{
foreach (var aOptionGroup in _option)
{
foreach (var aOption in aOptionGroup.Options)
{
if (aOption.IsSelected)
{
}
}
}
}
catch
{
result = _itemData.Price;
}
return result;
}
private void SetBasketSum()
{
if (MiniBasketData is ObservableCollection)
{
OrderTotalCount = MiniBasketData.Sum(r => r.Count);
OrderTotalPayment = MiniBasketData.Sum(r => r.Count * r.Price);
}
else
{
OrderTotalCount = 0;
OrderTotalPayment = 0;
}
}
private void DeleteBasketItem(M_BasketItem _deleteItem)
{
if (MiniBasketData is ObservableCollection)
{
var newBasketData = MiniBasketData.ToList();
using (var posDataService = new PosDataService())
{
if (posDataService.DelItem(_deleteItem))
{
newBasketData.Remove(_deleteItem);
}
}
MiniBasketData = new ObservableCollection(newBasketData);
}
}
private void DeleteScanItem()
{
if (MiniBasketData is ObservableCollection)
{
var newBasketData = MiniBasketData.ToList();
using (var posDataService = new PosDataService())
{
foreach (var aitem in newBasketData.Where(r => r.ItemType.Equals(BasketItemType.Scan)).ToList())
{
if (posDataService.DelItem(aitem))
{
newBasketData.Remove(aitem);
}
}
}
newBasketData.RemoveAll(r => r.ItemType.Equals(BasketItemType.Scan));
MiniBasketData = new ObservableCollection(newBasketData);
}
}
public void DeledteAllBasket()
{
if (MiniBasketData is ObservableCollection)
{
using (var posDataService = new PosDataService())
{
foreach (var aitem in MiniBasketData)
{
posDataService.DelItem(aitem);
}
}
MiniBasketData = null;
}
}
#endregion
#endregion Contents
#region Etc
///
/// 타이머 스톱
///
public void ToIntorTimerStart()
{
LastAccessTime = DateTime.Now;
ToIntoroTimer.Start();
}
///
/// 타이머 재시작
///
public void ToIntorTimerStop()
{
LastAccessTime = DateTime.Now;
ToIntoroTimer.Stop();
}
private int GetMaxItemPageNo()
{
int result = 0;
try
{
result = OrderItems.Count / (OrderColumnCount * OrderRowCount);
if ((OrderItems.Count % (OrderColumnCount * OrderRowCount)).Equals(0)) result -= 1;
}
catch
{
result = 0;
}
return result;
}
private int GetItemPageCount()
{
int result = 0;
try
{
result = OrderItems.Count / (OrderColumnCount * OrderRowCount);
if (!(OrderItems.Count % (OrderColumnCount * OrderRowCount)).Equals(0)) result += 1;
}
catch
{
result = 0;
}
return result;
}
#endregion Etc
#endregion Methods
#region [ Event Handlers ]
private void ToExecuteNothingHandler(object obj)
{
}
private void VmPBViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
LastAccessTime = DateTime.Now;
try
{
switch (e.PropertyName)
{
case "DefaultPage":
if (DefaultPage.Equals(PBPageType.FirstSelect)
|| DefaultPage.Equals(PBPageType.Items))
{
GmbHappyInfoEnable = !MemberLoginOK;
}
else
{
GmbHappyInfoEnable = false;
}
switch (DefaultPage)
{
case PBPageType.Intro:
ToIntorTimerStop();
OrderHistoryView = false;
MemberLoginOK = false;
HappyPointReturn = null;
FindOrderHistoryItems = null;
SetIntro();
DeledteAllBasket();
break;
case PBPageType.FirstSelect:
ToIntorTimerStart();
break;
case PBPageType.Items:
GmbOrderEnable = false;
SetContents();
SetOrderHistoryItems();
ToIntorTimerStart();
break;
case PBPageType.Sensing:
GmbAIscannerEnable = false;
AIScanCount = 0;
ToIntorTimerStart();
break;
}
break;
case "MemberLoginOK":
GmbHappyPointEnable = !MemberLoginOK;
GmbHappyInfoEnable = !MemberLoginOK;
break;
case "GmbHappyInfoEnable":
if (GmbHappyInfoEnable)
{
GmbHappyInfoEnableTime = DateTime.Now;
}
break;
case "DefaultCategory1Item":
if (DefaultCategory1Item > -1)
{
if (Category2Data == null)
{
SetCategory2();
}
else
{
if (!Category1Data[DefaultCategory1Item].Category1.Equals(Category2Data.FirstOrDefault().Category1))
{
SetCategory2();
}
}
}
OrderItemPageNo = 0;
break;
case "DefaultCategory2Item":
if (DefaultCategory1Item > -1)
{
SetItemList();
}
OrderItemPageNo = 0;
ToIntorTimerStart();
break;
case "DefaultCategory1PageNo":
case "DefaultCategory2PageNo":
break;
case "ShowLanguageType":
CommonValue.CommonLanguageType = ShowLanguageType;
switch (ShowLanguageType)
{
case SupportLanguageType.ko:
GmbLanguageimage=ResourceManager.GetNximagePathAdd("btn_language_kor.png", CommonValue.PBdesignImagesPath);
break;
case SupportLanguageType.en:
GmbLanguageimage = ResourceManager.GetNximagePathAdd("btn_language_eng.png", CommonValue.PBdesignImagesPath);
break;
case SupportLanguageType.ja:
GmbLanguageimage = ResourceManager.GetNximagePathAdd("btn_language_jap.png", CommonValue.PBdesignImagesPath);
break;
case SupportLanguageType.zh:
GmbLanguageimage = ResourceManager.GetNximagePathAdd("btn_language_chi.png", CommonValue.PBdesignImagesPath);
break;
}
break;
case "OrderItems":
PageStatusColumnCount = GetItemPageCount();
SetPageNumber();
break;
case "OrderItemPageNo":
Page2LeftEnable = !OrderItemPageNo.Equals(0);
Page2RightEnable = !OrderItemPageNo.Equals(GetMaxItemPageNo());
break;
case "MiniBasketData":
SetBasketSum();
if (MiniBasketData is ObservableCollection miniBasketItems
&& miniBasketItems.Count > 0)
{
OrderDetailEnable = true;
GotoPaymentEnable = true;
MiniBasketDeleteAllEnable = true;
OrderNoneDataGridVisibility = Visibility.Hidden;
OrderExistDataGridVisibility = Visibility.Visible;
foreach (var aBasketItem in miniBasketItems )
{
aBasketItem.PropertyChanged += ABasketItem_PropertyChanged;
}
}
else
{
OrderDetailEnable = false;
GotoPaymentEnable = false;
MiniBasketDeleteAllEnable = false;
OrderNoneDataGridVisibility = Visibility.Visible;
OrderExistDataGridVisibility = Visibility.Hidden;
}
break;
case "FindOrderHistoryItems":
SetOrderHistoryItems();
break;
case "OrderHistoryItems":
//OrderHistoryItemsEnable = OrderHistoryItems != null && OrderHistoryItems.Count > 0;
OrderHistoryItemsEnable = MemberLoginOK;
GmbHappyPointEnable = !MemberLoginOK;
GmbHappyInfoEnable = !MemberLoginOK;
break;
case "ReadBarCode":
ProcessBardcord();
break;
default:
break;
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "VmPBViewModel_PropertyChanged()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
}
#region Intro Click
private void RollMediaCommandHandler(object _param)
{
try
{
if (_param is M_MediaRollItem selectItem)
{
NeedIntailizeItems = true;
PBPageType targetPage = PBPageType.Intro;
switch (selectItem.LinkType)
{
case IntroLinkType.Page:
DefaultLinkValue = string.Empty;
switch (selectItem.LinkParameter)
{
case "IntroPage":
targetPage = PBPageType.Intro;
break;
case "ItemPage":
targetPage = PBPageType.Items;
break;
case "SensingPage":
targetPage = PBPageType.Sensing;
break;
case "FirstSelect":
targetPage = PBPageType.FirstSelect;
break;
}
break;
case IntroLinkType.Category:
DefaultLinkValue = selectItem.LinkParameter;
targetPage = PBPageType.Items;
break;
case IntroLinkType.ItemCode:
DefaultLinkValue = selectItem.LinkParameter;
targetPage = PBPageType.Items;
break;
default:
targetPage = PBPageType.FirstSelect;
break;
}
ShowLanguageType = SupportLanguageType.ko;
#region 인트로에서 벗어 날때 해피포인트 맴버 인증 (사용 않음)
//if (!targetPage.Equals(PBPageType.Intro))
//{
// var popupReturn = popupManager.OpenHappyPointCertify();
// if (popupReturn is M_PopupReturn)
// {
// MemberLoginOK = popupReturn.OKAnswer;
// if (popupReturn.PopupArgs is M_HappyPointReturn _HappyPointReturn)
// {
// HappyPointReturn = _HappyPointReturn;
// GmbMemberName = HappyPointReturn.MemberName;
// }
// if (!popupReturn.ReturnLanguage.Equals(ShowLanguageType))
// {
// ShowLanguageType = popupReturn.ReturnLanguage;
// }
// if (popupReturn.TimeOut) targetPage = PBPageType.Intro;
// }
//}
#endregion
WaitWindowFrom.ShowWaitWindow();
DefaultPage = targetPage;
if (!targetPage.Equals(PBPageType.Intro)) IntroItems = null;
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "RollMediaCommandHandler()", "Fail", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
WaitWindowFrom.CloseWaitWindow();
}
}
#endregion
#region GMB Left Click
private void GotoFirstCommandHandler(object obj)
{
DefaultPage = PBPageType.FirstSelect;
}
private void ReaderCheckCommandHandler(object obj)
{
try
{
ReaderCheckClickCount += 1;
if (ReaderCheckClickCount.Equals(10))
{
ToIntorTimerStop();
try
{
var popupReturn = popupManager.OpenNumPadPopup(ShowLanguageType
, Languages.GetMessages("InputPassword")
, false,true,5,5);
if (popupReturn is M_PopupReturn)
{
if (popupReturn.TimeOut)
{
DefaultPage = PBPageType.Intro;
return;
}
else
{
if (popupReturn.OKAnswer)
{
if (popupReturn.PopupArgs is string getPassword
&& getPassword.Equals(DateTime.Now.ToString("ddMM")
+ ((int.Parse(DateTime.Now.ToString("dd"))
* int.Parse(DateTime.Now.ToString("MM"))) % 10).ToString()))
{
GmbReaderCheckOpen = true;
}
}
}
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "ReaderCheckCommandHandler()", "OpenNumPadPopup Fail !!", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
ReaderCheckClickCount = 0;
ToIntorTimerStart();
}
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "ReaderCheckCommandHandler()", "Fail !!", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
}
#endregion
#region GMB Right Click
private void HappyPointCommandHandler(object obj)
{
if (HappyPointReturn is M_HappyPointReturn)
{
GmbHappyPointEnable = false;
return;
}
ToIntorTimerStop();
try
{
OrderHistoryView = false;
FindOrderHistoryItems = null;
var popupReturn = popupManager.OpenHappyPointCertify(false, true, ParentPage.PBWindow);
if (popupReturn is M_PopupReturn)
{
if (popupReturn.TimeOut)
{
DefaultPage = PBPageType.Intro;
return;
}
else
{
MemberLoginOK = popupReturn.OKAnswer;
if (popupReturn.PopupArgs is M_HappyPointReturn _HappyPointReturn)
{
HappyPointReturn = _HappyPointReturn;
GmbMemberName = HappyPointReturn.IsCardNoUsed ? HappyPointReturn.MemberName : "고객";
if (HappyPointReturn.OrderHistoryItems is List orderHistoryItems
&& orderHistoryItems.Count > 0)
{
FindOrderHistoryItems = orderHistoryItems;
}
else
{
FindOrderHistoryItems = null;
}
if (DefaultPage.Equals(PBPageType.Items)) OrderHistoryView = OrderHistoryItemsEnable;
}
else
{
HappyPointReturn = null;
}
if (!popupReturn.ReturnLanguage.Equals(ShowLanguageType))
{
ShowLanguageType = popupReturn.ReturnLanguage;
}
}
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "HappyPointCommandHandler()", "Fail !!", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
ToIntorTimerStart();
}
}
private void CallEmployeeCommandHandler(object obj)
{
ToIntorTimerStop();
try
{
var popupReturn = popupManager.OpenCallEmployee();
if (popupReturn is M_PopupReturn)
{
if (popupReturn.TimeOut)
{
DefaultPage = PBPageType.Intro;
return;
}
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "CallEmployeeCommandHandler()", "Fail !!", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
ToIntorTimerStart();
}
}
private void LanguageCommandHandler(object obj)
{
ToIntorTimerStop();
try
{
var popupReturn = popupManager.OpenLanguageSelector(ShowLanguageType);
if (popupReturn is M_PopupReturn)
{
if (popupReturn.TimeOut)
{
DefaultPage = PBPageType.Intro;
return;
}
else
{
ShowLanguageType = popupReturn.ReturnLanguage;
}
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "LanguageCommandHandler()", "Fail !!", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
ToIntorTimerStart();
}
}
private void GotoIntroPageCommadHandler(object obj)
{
ToIntorTimerStop();
try
{
if (MiniBasketData != null && MiniBasketData.Count > 0)
{
var miniPopup = new M_MiniPopup
{
Icon = MiniPopupIcon.Cancel,
DisplayLanguage = ShowLanguageType,
Message = Languages.GetMessages("LBL0085"),
CencalButtonText = Languages.GetMessages("BTN0021"),
OkButtonText = Languages.GetMessages("BTN0005"),
IsCencalButton = true,
TimeoutSeconds = 10,
};
var popupReturn = popupManager.OpenMiniPopup(miniPopup);
if (popupReturn is M_PopupReturn)
{
if (popupReturn.OKAnswer)
{
DefaultPage = PBPageType.Intro;
}
}
}
else
{
DefaultPage = PBPageType.Intro;
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "GotoIntroPageCommadHandler()", "Fail !!", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
ToIntorTimerStart();
}
}
#endregion
#region GMB Center Click
private void GmbOrderCommandHandler(object obj)
{
DefaultPage = PBPageType.Items;
}
private void GmbAIscannerCommandHandler(object obj)
{
DefaultPage = PBPageType.Sensing;
if (this.OptionValue810 == "0"
&& this.OptionValue811 == "1")
{
SensingSubPage = PBSensingSubPageType.BarcordPage;
}
}
#endregion
#region Contents
private void RescanCommandHandler(object obj)
{
DeleteScanItem();
DefaultPage = PBPageType.Sensing;
}
private void GotoBarcodeCommandHandler(object obj)
{
if (DefaultPage.Equals(PBPageType.Sensing))
{
SensingSubPage = PBSensingSubPageType.BarcordPage;
}
}
private void Page2LeftCommandHandler(object obj)
{
OrderItemPageNo -= 1;
}
private void Page2RightCommandHandler(object obj)
{
OrderItemPageNo += 1;
}
private void ItemCommandCommandHandler(object _param)
{
if (_param is AnimationButton targetButton && targetButton.DataParameter is M_ItemData _ItemData)
{
//AddItem2Basket(_ItemData);
}
}
private void Category2CommandHandler(object _param)
{
ToIntorTimerStart();
if (_param is AnimationButton targetButton && targetButton.DataParameter is M_ItemData _ItemData)
{
DefaultCategory2Item = Category2Data.IndexOf(_ItemData);
}
}
private void Category1CommandHandler(object _param)
{
ToIntorTimerStart();
if (_param is AnimationButton targetButton && targetButton.DataParameter is M_ItemData _ItemData)
{
DefaultCategory1Item = Category1Data.IndexOf(_ItemData);
}
}
private void PageSelectCommandHandler(object _param)
{
if (_param is AnimationButton targetButton && targetButton.DataParameter is M_ItemData _ItemData)
{
OrderItemPageNo = ItemPageStatus.IndexOf(_ItemData);
}
}
private void OrderHistoryCommandHandler(object obj)
{
OrderHistoryView = true;
}
private void OrderHistoryCloseCommandHandler(object obj)
{
OrderHistoryView = false;
}
#endregion
#region MiniBasket
private void ABasketItem_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (sender is M_BasketItem basketItem)
{
using (var posDataService = new PosDataService())
{
posDataService.UpdatedItem(basketItem);
}
SetBasketSum();
}
}
private void MiniBasketDeleteAllCommandHandler(object _param)
{
ToIntorTimerStop();
try
{
var miniPopup = new M_MiniPopup
{
Icon = MiniPopupIcon.ListCancel,
DisplayLanguage = ShowLanguageType,
Message = Languages.GetMessages("LBL0099"),
CencalButtonText = Languages.GetMessages("BTN0021"),
OkButtonText = Languages.GetMessages("BTN0005"),
IsCencalButton = true,
TimeoutSeconds = 10,
};
var popupReturn = popupManager.OpenMiniPopup(miniPopup);
if (popupReturn is M_PopupReturn && popupReturn.OKAnswer)
{
DeledteAllBasket();
}
}
catch (Exception ex)
{
CommonLog.ErrorLogWrite(this, "MiniBasketDeleteAllCommandHandler()", "Fail !!", string.Format("{0}\n{1}", ex.Message, ex.StackTrace));
}
finally
{
ToIntorTimerStart();
}
}
private void EmptyBasketDropCommandHandler(object _param)
{
if (_param is M_ItemDropEventArgs dropedItem)
{
if (dropedItem.SourceObject is AnimationButton sourceButton && sourceButton.DataParameter is M_ItemData _ItemData)
{
AddItem2Basket(_ItemData);
}
}
}
private void BasketItemDeleteCommandHandler(object _param)
{
if (_param is M_BasketItem deleteItem)
{
DeleteBasketItem(deleteItem);
}
}
private void OrderDetailCommandHandler(object _param)
{
OpenPBPaymentPage = PBPaymentPageType.DetailBasket;
}
private void GotoPaymentCommandHandler(object _param)
{
if (MiniBasketData is ObservableCollection
&& MiniBasketData.Count > 0)
{
OpenPBPaymentPage = PBPaymentPageType.PointsDisCounts;
}
else
{
ToIntorTimerStop();
var topMessage = new List
{
new M_Language
{
Type = SupportLanguageType.ko,
LanguageData = "선택한 제품이 없습니다."
},
new M_Language
{
Type = SupportLanguageType.en,
LanguageData = "en선택한 제품이 없습니다."
},
};
var popupReturn = PopupMessageBox.ShowMessageBox(ShowLanguageType
, topMessage
, null
, MessageBoxButton.OK
, OpenCloseAnimationType.FullSizeUp
, OpenCloseAnimationType.FullSizeDown
, 0.5, 0.2, 5);
ToIntorTimerStart();
}
}
#endregion
private void ToIntoroTimer_Tick(object sender, EventArgs e)
{
if (GmbHappyInfoEnable)
{
if (GmbHappyInfoEnableTime.AddSeconds(3) <= DateTime.Now)
{
GmbHappyInfoEnableTime = DateTime.Now;
GmbHappyInfoEnable = false;
}
}
if (DefaultPage.Equals(PBPageType.Intro))
{
LastAccessTime = DateTime.Now;
}
else if ((DateTime.Now - LastAccessTime) > TimeSpan.FromSeconds(CommonValue.TimeOutSeconds))
{
ReaderCheckClickCount = 0;
#if !TESTMODE
if (IsTimeoutPopup)
{
ToIntorTimerStop();
var popupReturn = PopupMessageBox.ShowMessageBox(ShowLanguageType
, Languages.GetMessages("LBL0067")
, Languages.GetMessages("LBL0021")
, MessageBoxButton.YesNo
, OpenCloseAnimationType.FullSizeUp
, OpenCloseAnimationType.FullSizeDown
, 0.5, 0.2, 10);
if (popupReturn.Equals(MessageBoxResult.Yes))
{
ToIntorTimerStart();
}
else
{
if (!DefaultPage.Equals(PBPageType.Intro)) DefaultPage = PBPageType.Intro;
}
}
#else
LastAccessTime = DateTime.Now;
Console.WriteLine(">>> PBViewModel.DefaultPage=PBPageType.Intro");
#endif
}
}
#endregion Event Handlers
}
}