MobileClientDlg.cpp
上传用户:hnzycx
上传日期:2022-08-09
资源大小:12567k
文件大小:3k
- // MobileClientDlg.cpp : 实现文件
- #include "stdafx.h"
- #include "MobileClient.h"
- #include "MobileClientDlg.h"
- #include "OrderCourse.h"
- #include "Special.h"
- #include "DataParsing.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #endif
- // CMobileClientDlg 对话框
- CMobileClientDlg::CMobileClientDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CMobileClientDlg::IDD, pParent)
- {
- m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
- }
- void CMobileClientDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- }
- BEGIN_MESSAGE_MAP(CMobileClientDlg, CDialog)
- #if defined(_DEVICE_RESOLUTION_AWARE) && !defined(WIN32_PLATFORM_WFSP)
- ON_WM_SIZE()
- #endif
- //}}AFX_MSG_MAP
- ON_BN_CLICKED(IDC_BTN_ORDER, &CMobileClientDlg::OnBnClickedBtnOrder)
- ON_BN_CLICKED(IDC_BTN_SPLINFO, &CMobileClientDlg::OnBnClickedBtnSplinfo)
-
- ON_BN_CLICKED(IDCANCEL, &CMobileClientDlg::OnBnClickedCancel)
- END_MESSAGE_MAP()
- // CMobileClientDlg 消息处理程序
- BOOL CMobileClientDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- SetIcon(m_hIcon, TRUE); // 设置大图标
- SetIcon(m_hIcon, FALSE); // 设置小图标
- return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
- }
- #if defined(_DEVICE_RESOLUTION_AWARE) && !defined(WIN32_PLATFORM_WFSP)
- void CMobileClientDlg::OnSize(UINT /*nType*/, int /*cx*/, int /*cy*/)
- {
- if (AfxIsDRAEnabled())
- {
- DRA::RelayoutDialog(
- AfxGetResourceHandle(),
- this->m_hWnd,
- DRA::GetDisplayMode() != DRA::Portrait ?
- MAKEINTRESOURCE(IDD_MOBILECLIENT_DIALOG_WIDE) :
- MAKEINTRESOURCE(IDD_MOBILECLIENT_DIALOG));
- }
- }
- #endif
- //进入点餐界面
- void CMobileClientDlg::OnBnClickedBtnOrder()
- {
- CMobileClientApp* App=(CMobileClientApp*)AfxGetApp();
- CString reqOrderList;
- reqOrderList = _T("O@END");//向服务器请求菜单信息
- char * sendBuf;
- int sendLen=0;
- sendLen=reqOrderList.GetLength();
- sendBuf=new char[sendLen*2];
- WideCharToMultiByte(CP_OEMCP,NULL,reqOrderList,-1,sendBuf,sendLen*2,NULL,FALSE);
- if (!App->m_tcp.SendData(sendBuf,sendLen*2))
- {
- AfxMessageBox(_T("请求菜单失败"));
- }
- delete []sendBuf;
- sendBuf=NULL;
- COrderCourse dlg;
- dlg.DoModal();
- }
- //进入优惠/特价菜界面
- void CMobileClientDlg::OnBnClickedBtnSplinfo()
- {
-
- CMobileClientApp* App=(CMobileClientApp*)AfxGetApp();
- CString reqSplinfo;
- reqSplinfo = _T("S@END");//向服务器请求优惠/特价菜信息
- char * sendBuf;
- int sendLen=0;
- sendLen=reqSplinfo.GetLength();
- sendBuf=new char[sendLen*2];
- WideCharToMultiByte(CP_OEMCP,NULL,reqSplinfo,-1,sendBuf,sendLen*2,NULL,FALSE);
-
- if (!App->m_tcp.SendData(sendBuf,sendLen*2))
- {
- AfxMessageBox(_T("请求菜单失败"));
- }
- delete []sendBuf;
- sendBuf=NULL;
- CSpecial dlg;
- dlg.DoModal();
- }
- //返回主界面
- void CMobileClientDlg::OnBnClickedCancel()
- {
- CMobileClientApp* App=(CMobileClientApp*)AfxGetApp();
- if(App->m_tcp.Close())
- {
-
- }
- else
- {
- AfxMessageBox(_T("连接断开"));
- }
- OnCancel();
- }