| | |
| | | #include "Common.h" |
| | | #include "CBonder.h" |
| | | #include "SettingsDlg.h" |
| | | #include "InputDialog.h" |
| | | #include "LoginDlg.h" |
| | | #include "ChangePasswordDlg.h" |
| | | #include "InputDialog.h" |
| | | #include "UserManagerDlg.h" |
| | | |
| | | // test |
| | | #include "SystemLogManagerDlg.h" |
| | | #include "AxisSettingsDlg.h" |
| | | |
| | | |
| | | #ifdef _DEBUG |
| | | #define new DEBUG_NEW |
| | |
| | | // 初始化运行日志表 |
| | | try { |
| | | if (!logManager.initializeLogTable()) { |
| | | AfxMessageBox("初始化系统日志表失败!"); |
| | | AfxMessageBox("初始化系统日志模块失败!"); |
| | | return FALSE; |
| | | } |
| | | } |
| | | catch (const std::exception& ex) { |
| | | CString errorMsg; |
| | | errorMsg.Format(_T("初始化系统日志表失败:%s"), CString(ex.what())); |
| | | errorMsg.Format(_T("初始化系统日志模块失败:%s"), CString(ex.what())); |
| | | AfxMessageBox(errorMsg, MB_ICONERROR); |
| | | return FALSE; |
| | | } |
| | | |
| | | // 设置轴设定模块的数据库连接 |
| | | AxisManager& axisManager = AxisManager::getInstance(); |
| | | axisManager.setDatabase(db.get()); |
| | | |
| | | // 初始化轴设定表 |
| | | try { |
| | | if (!axisManager.initializeTables()) { |
| | | AfxMessageBox("创建轴设定表失败!"); |
| | | return FALSE; |
| | | } |
| | | |
| | | if (!axisManager.initializeDefaultData()) { |
| | | AfxMessageBox("初始化轴设定默认数据失败!"); |
| | | return FALSE; |
| | | } |
| | | } |
| | | catch (const std::exception& ex) { |
| | | CString errorMsg; |
| | | errorMsg.Format(_T("初始化轴设定模块失败:%s"), CString(ex.what())); |
| | | AfxMessageBox(errorMsg, MB_ICONERROR); |
| | | return FALSE; |
| | | } |
| | |
| | | |
| | | void CBondEqDlg::OnMenuFileSettings() |
| | | { |
| | | CAxisSettingsDlg axisDlg; |
| | | axisDlg.SetPLC(theApp.m_model.getBonder().getPLC("PLC(1)")); |
| | | axisDlg.DoModal(); |
| | | |
| | | /* |
| | | CSettingsDlg dlg; |
| | | dlg.DoModal(); |
| | | */ |
| | | } |
| | | |
| | | void CBondEqDlg::OnUpdateMenuFileSettings(CCmdUI* pCmdUI) |
| | |
| | | loginDlg.DoModal(); |
| | | } |
| | | else if (1 == menuId) { |
| | | // test |
| | | CSystemLogManagerDlg dlg; |
| | | dlg.DoModal(); |
| | | |
| | | CChangePasswordDlg changePasswordDlg; |
| | | changePasswordDlg.DoModal(); |
| | | } |
| | |
| | | } |
| | | } |
| | | else if (3 == menuId) { |
| | | CSystemLogManagerDlg dlg; |
| | | dlg.DoModal(); |
| | | } |
| | | else if (4 == menuId) { |
| | | int ret = AfxMessageBox(_T("是否切换用户?切换用户会退出当前账号!"), MB_OKCANCEL | MB_ICONEXCLAMATION); |
| | | if (ret != IDOK) { |
| | | return 0; |
| | |
| | | { |
| | | ::EnableMenuItem(hMenu, ID_OPEATOR_LOGIN, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); |
| | | ::EnableMenuItem(hMenu, ID_OPERATOR_CHANGE_PASSWORD, MF_BYCOMMAND | MF_ENABLED); |
| | | ::EnableMenuItem(hMenu, ID_OPERATOR_SYSTEM_LOG, MF_BYCOMMAND | MF_ENABLED); |
| | | ::EnableMenuItem(hMenu, ID_OPEATOR_SWITCH, MF_BYCOMMAND | MF_ENABLED); |
| | | ::EnableMenuItem(hMenu, ID_OPERATOR_LOGOUT, MF_BYCOMMAND | MF_ENABLED); |
| | | |
| | |
| | | ::EnableMenuItem(hMenu, ID_OPEATOR_LOGIN, MF_BYCOMMAND | MF_ENABLED); |
| | | ::EnableMenuItem(hMenu, ID_OPERATOR_CHANGE_PASSWORD, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); |
| | | ::EnableMenuItem(hMenu, ID_OPEATOR_USER_MANAGER, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); |
| | | ::EnableMenuItem(hMenu, ID_OPERATOR_SYSTEM_LOG, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); |
| | | ::EnableMenuItem(hMenu, ID_OPEATOR_SWITCH, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); |
| | | ::EnableMenuItem(hMenu, ID_OPERATOR_LOGOUT, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED); |
| | | |