华辉中间件项目(代码服务器上没有,用杨成电脑的源代码上传的)

ViewMgr.cpp 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #include "StdAfx.h"
  2. #include "ViewMgr.h"
  3. #include "resource.h"
  4. #include "DisplayWnd.h"
  5. #include "Config.h"
  6. #include "MsgCenter.h"
  7. SINGLETON_IMPLEMENT(CViewMgr)
  8. CViewMgr::CViewMgr(void)
  9. {
  10. }
  11. CViewMgr::~CViewMgr(void)
  12. {
  13. }
  14. /*****************************************************************
  15. **【函数名称】 setup
  16. **【函数功能】 视图管理器创建
  17. **【参数】
  18. **【返回值】
  19. ****************************************************************/
  20. bool CViewMgr::setup( CDisplayWnd* pWnd )
  21. {
  22. ASSERT(pWnd != NULL);
  23. m_pWnd = pWnd;
  24. if(!m_ViewLog.create(pWnd))
  25. {
  26. AfxMessageBox(_T("日志视图创建失败!"));
  27. return false;
  28. }
  29. ILogger::getInstance().init(&m_ViewLog, LOG_DEV_VS, CConfig::logFilePath());
  30. ILogger::getInstance().start();
  31. if(!m_ViewRes.create(pWnd))
  32. {
  33. AfxMessageBox(_T("设备资源视图创建失败!"));
  34. return false;
  35. }
  36. if(!m_ViewLine.create(pWnd))
  37. {
  38. AfxMessageBox(_T("线路资源视图创建失败!"));
  39. return false;
  40. }
  41. if(!m_ViewFax.create(pWnd))
  42. {
  43. AfxMessageBox(_T("传真资源视图创建失败!"));
  44. return false;
  45. }
  46. CMsgCenter& MsgCenter = CMsgCenter::GetInstance();
  47. MsgCenter.regist(VS_MSG_DEV_FAX_STATE_UPDAET, this);
  48. MsgCenter.regist(VS_MSG_LINE_STATE_UPDATE, this);
  49. return true;
  50. }
  51. /*****************************************************************
  52. **【函数名称】 onMessage
  53. **【函数功能】 消息事件处理函数
  54. **【参数】 MsgType: 消息事件类型
  55. lpContent: 消息内容
  56. **【返回值】
  57. ****************************************************************/
  58. void CViewMgr::onMessage( UINT MsgType, const PARAM lpContent )
  59. {
  60. switch(MsgType)
  61. {
  62. case VS_MSG_LINE_STATE_UPDATE: // 线路资源状态变化
  63. {
  64. m_ViewLine.onLineStateUpdated(reinterpret_cast<int>(lpContent));
  65. }
  66. break;
  67. case VS_MSG_DEV_FAX_STATE_UPDAET: // 传真资源状态变化
  68. {
  69. m_ViewFax.onFaxStateUpdated(reinterpret_cast<int>(lpContent));
  70. }
  71. break;
  72. default:
  73. ASSERT(FALSE);
  74. break;
  75. }
  76. }