void main_frame::OnPrepare( TNotifyUI& msg ) { m_weiboManage.StartUp(); m_layoutManage.SetPaintManage(&m_PaintManager); //m_weiboManage.m_pLayoutManage = &m_layoutManage; m_weiboManage.UpdateUserProfile = std::tr1::bind(&CLayoutManage::UpdateUserProfile,&m_layoutManage,_1,_2,_3); m_weiboManage.UpdateUnread = std::tr1::bind(&CLayoutManage::UpdateUnread,&m_layoutManage,_1); m_weiboManage.UpdateTimelineList = std::tr1::bind(&CLayoutManage::UpdateTimelineList,&m_layoutManage,_1,_2,_3,_4,_5); CRichEditUI *pWeiboCotent = static_cast<CRichEditUI*>(m_PaintManager.FindControl(_T("weiboContent"))); if (pWeiboCotent) { pWeiboCotent->OnEvent += MakeDelegate(this,&main_frame::OnWeiboContentEvent); pWeiboCotent->OnNotify += MakeDelegate(this,&main_frame::OnWeiboContentNotify); pWeiboCotent->SetAutoURLDetect(); } CWebBrowserUI *pLoginWeb = static_cast<CWebBrowserUI*>(m_PaintManager.FindControl(_T("loginWnd"))); if (m_weiboManage.CheckExistUser()) { m_weiboManage.InitWeibo(); pLoginWeb->SetVisible(false); } else { CWebBrowserUI *pLoginWeb = static_cast<CWebBrowserUI*>(m_PaintManager.FindControl(_T("loginWnd"))); if (pLoginWeb) { m_pWebBrowserEventHander = new CMagiccWebBrowserEventHandler; m_pWebBrowserEventHander->SetMainFrame(this); pLoginWeb->SetWebBrowserEventHandler(m_pWebBrowserEventHander); pLoginWeb->NavigateUrl(_T("https://api.weibo.com/oauth2/authorize?client_id=397065771&response_type=code&redirect_uri=www.baidu.com")); } } CLabelUI *pUnreadTimeline = static_cast<CLabelUI*>(m_PaintManager.FindControl(_T("unreadTimelineCount"))); if (pUnreadTimeline) { pUnreadTimeline->OnEvent += MakeDelegate(this,&main_frame::OnRefreshUnReadTimeline); m_PaintManager.SetTimer(pUnreadTimeline,1,1000*10); } }
LUA_METHOD_IMPL(CWebBrowserUI, NavigateUrl) { try { CWebBrowserUI* self; self = static_cast<CWebBrowserUI*>(LuaStatic::CheckUserData(l, 1)); CDuiString pstrText; lua_op_t<CDuiString>::lua_to_value(l, 2, pstrText); self->NavigateUrl(pstrText); return 0; } catch (...) { DuiException(_T("LuaCWebBrowserUI::NavigateUrl")); return 0; } }