|
|
@@ -17,20 +17,61 @@ void CMainWnd::Init()
|
|
|
m_pRestoreBtn = static_cast<CButtonUI*>(m_pm.FindControl(_T("restorebtn")));
|
|
|
m_pMinBtn = static_cast<CButtonUI*>(m_pm.FindControl(_T("minbtn")));
|
|
|
|
|
|
- CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("switch")));
|
|
|
- pControl->SelectItem(3);
|
|
|
-
|
|
|
- OrderListUI* orderlist = static_cast<OrderListUI*>(m_pm.FindControl(_T("orderlist")));
|
|
|
- orderlist->Refresh();
|
|
|
-
|
|
|
- //初始化设置中心的状态
|
|
|
- InitSettingStatus();
|
|
|
+ //默认选择点单页面
|
|
|
+ this->SwitchPage(DIANDAN);
|
|
|
|
|
|
//登录成功,启动消息和任务处理
|
|
|
m_push = new CMessagePush(m_hWnd);
|
|
|
m_push->Start();
|
|
|
}
|
|
|
|
|
|
+void CMainWnd::SwitchPage(MainPageName name)
|
|
|
+{
|
|
|
+ if (m_curPageName == name)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //先删除现在的子对象
|
|
|
+ CContainerUI* pMainContentLayout = static_cast<CContainerUI*>(m_pm.FindControl(_T("main_content_layout")));
|
|
|
+ pMainContentLayout->RemoveAll();
|
|
|
+
|
|
|
+ //再创建一个对象
|
|
|
+ CDialogBuilder builder;
|
|
|
+ CDialogBuilderCallbackEx cb;
|
|
|
+
|
|
|
+ CContainerUI* pChildContainer = NULL;
|
|
|
+
|
|
|
+ if (name == DIANDAN)
|
|
|
+ {
|
|
|
+ pChildContainer = static_cast<CContainerUI*>(builder.Create(_T("diandan_index.xml"), (UINT)0, &cb, &m_pm));
|
|
|
+ pMainContentLayout->Add(pChildContainer);
|
|
|
+ }
|
|
|
+ else if (name == DINGDAN)
|
|
|
+ {
|
|
|
+ pChildContainer = static_cast<CContainerUI*>(builder.Create(_T("waimaiorder_list.xml"), (UINT)0, &cb, &m_pm));
|
|
|
+ pMainContentLayout->Add(pChildContainer);
|
|
|
+
|
|
|
+ OrderListUI* orderlist = static_cast<OrderListUI*>(m_pm.FindControl(_T("orderlist")));
|
|
|
+ orderlist->Refresh();
|
|
|
+ }
|
|
|
+ else if (name == SHEZHI)
|
|
|
+ {
|
|
|
+ pChildContainer = static_cast<CContainerUI*>(builder.Create(_T("setting.xml"), (UINT)0, &cb, &m_pm));
|
|
|
+ pMainContentLayout->Add(pChildContainer);
|
|
|
+
|
|
|
+ //初始化设置中心的状态
|
|
|
+ InitSettingStatus();
|
|
|
+ }
|
|
|
+ else if (name == WAIMAIINFO)
|
|
|
+ {
|
|
|
+ pChildContainer = static_cast<CContainerUI*>(builder.Create(_T("waimaiorder_info.xml"), (UINT)0, &cb, &m_pm));
|
|
|
+ pMainContentLayout->Add(pChildContainer);
|
|
|
+ }
|
|
|
+
|
|
|
+ m_curPageName = name;
|
|
|
+}
|
|
|
+
|
|
|
LRESULT CMainWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
|
|
{
|
|
|
LONG styleValue = ::GetWindowLong(*this, GWL_STYLE);
|
|
|
@@ -51,7 +92,7 @@ void CMainWnd::Notify(TNotifyUI& msg)
|
|
|
{
|
|
|
if(msg.sType == _T("windowinit"))
|
|
|
{
|
|
|
- OnPrepare();
|
|
|
+
|
|
|
}
|
|
|
else if(msg.sType == _T("click"))
|
|
|
{
|
|
|
@@ -207,6 +248,8 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
|
|
|
}
|
|
|
else if(name == _T("waimai_order_list_info"))
|
|
|
{
|
|
|
+ this->SwitchPage(WAIMAIINFO);
|
|
|
+
|
|
|
CWaimaiOrderItemUI* item = static_cast<CWaimaiOrderItemUI*>(msg.pSender->GetParent()->GetParent());
|
|
|
std::string waimai_order_id = item->getOrderID();
|
|
|
std::string waimai_order_no = item->getOrderNo();
|
|
|
@@ -219,14 +262,6 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
|
|
|
CWaimaiOrderInfoUI* order_info_page = static_cast<CWaimaiOrderInfoUI*>(m_pm.FindControl(_T("waimaiorder_info_page")));
|
|
|
order_info_page->SetDate(order);
|
|
|
order_info_page->Refresh(order);
|
|
|
-
|
|
|
- //显示订单详情页的内容
|
|
|
- CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("switch")));
|
|
|
-
|
|
|
- if(pControl && pControl->GetCurSel() != 1)
|
|
|
- {
|
|
|
- pControl->SelectItem(1);
|
|
|
- }
|
|
|
}
|
|
|
else if(name == _T("waimai_order_list_last"))
|
|
|
{
|
|
|
@@ -245,16 +280,7 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
|
|
|
}
|
|
|
else if(name == _T("waimai_order_info_page_return"))
|
|
|
{
|
|
|
- CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("switch")));
|
|
|
-
|
|
|
- if(pControl && pControl->GetCurSel() != 0)
|
|
|
- {
|
|
|
- pControl->SelectItem(0);
|
|
|
- }
|
|
|
-
|
|
|
- //刷新当前列表
|
|
|
- OrderListUI* orderlist = static_cast<OrderListUI*>(m_pm.FindControl(_T("orderlist")));
|
|
|
- orderlist->Refresh();
|
|
|
+ this->SwitchPage(DINGDAN);
|
|
|
}
|
|
|
else if(name == _T("waimai_order_info_page_print"))
|
|
|
{
|
|
|
@@ -847,6 +873,9 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * 这个处理Option的切换
|
|
|
+ */
|
|
|
void CMainWnd::HandleSelectChangeMsg(TNotifyUI& msg)
|
|
|
{
|
|
|
CDuiString name = msg.pSender->GetName();
|
|
|
@@ -854,30 +883,15 @@ void CMainWnd::HandleSelectChangeMsg(TNotifyUI& msg)
|
|
|
//先判断主页面的tab
|
|
|
if(name == _T("main_waimai"))
|
|
|
{
|
|
|
- CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("switch")));
|
|
|
-
|
|
|
- if(pControl && pControl->GetCurSel() != 0)
|
|
|
- {
|
|
|
- pControl->SelectItem(0);
|
|
|
- }
|
|
|
+ this->SwitchPage(DINGDAN);
|
|
|
}
|
|
|
else if(name == _T("main_setting"))
|
|
|
{
|
|
|
- CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("switch")));
|
|
|
-
|
|
|
- if(pControl && pControl->GetCurSel() != 2)
|
|
|
- {
|
|
|
- pControl->SelectItem(2);
|
|
|
- }
|
|
|
+ this->SwitchPage(SHEZHI);
|
|
|
}
|
|
|
else if(name == _T("main_diandan"))
|
|
|
{
|
|
|
- CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(m_pm.FindControl(_T("switch")));
|
|
|
-
|
|
|
- if(pControl && pControl->GetCurSel() != 3)
|
|
|
- {
|
|
|
- pControl->SelectItem(3);
|
|
|
- }
|
|
|
+ this->SwitchPage(DIANDAN);
|
|
|
}
|
|
|
//判断外卖的tab
|
|
|
else if(name == _T("waimai_open_switch") || name == _T("waimai_confirmed_switch") || name == _T("waimai_delivery_switch") || name == _T("waimai_success_switch") || name == _T("waimai_fail_switch") || name == _T("waimai_cancel_switch") || name == _T("waimai_refund_switch"))
|