|
@@ -150,7 +150,7 @@ int CUpgradeWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
|
|
}
|
|
|
|
|
|
m_text_password.Create(_T("FTP密码:"), SS_CENTER | SS_CENTERIMAGE | WS_CHILD | WS_VISIBLE, rectDummy, this, IDC_STATIC);
|
|
|
- if (!m_ftp_password.Create(WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL | WS_TABSTOP, rectDummy, this, ID_EDIT_FTP_PASSWORD))
|
|
|
+ if (!m_ftp_password.Create(WS_CHILD | WS_VISIBLE | WS_BORDER | ES_PASSWORD | ES_AUTOHSCROLL | WS_TABSTOP, rectDummy, this, ID_EDIT_FTP_PASSWORD))
|
|
|
{
|
|
|
//m_ftp_password.SetPasswordChar(‘*');
|
|
|
return -1;
|
|
@@ -200,33 +200,41 @@ void CUpgradeWnd::OnSize(UINT nType, int cx, int cy)
|
|
|
|
|
|
void CUpgradeWnd::OnUpgradeBtnClick()
|
|
|
{
|
|
|
- CString strPath = _T(""), strFtpUser = _T(""), strFtpPassword = _T("");
|
|
|
- m_edit_path.GetWindowText(strPath);
|
|
|
- m_ftp_user.GetWindowText(strFtpUser);
|
|
|
- m_ftp_password.GetWindowText(strFtpPassword);
|
|
|
- if ( _bIsFtpPath ) {
|
|
|
- Global::g_Config.strFtpUser = strFtpUser.GetString();
|
|
|
- Global::g_Config.strFtpPassword = strFtpPassword.GetString();
|
|
|
- WritePrivateProfileString("SATHelper", "ftp_user", strFtpUser.GetString(), Global::g_szConfig);
|
|
|
- WritePrivateProfileString("SATHelper", "ftp_password", strFtpPassword.GetString(), Global::g_szConfig);
|
|
|
- }
|
|
|
-
|
|
|
- CCallPython pycall;
|
|
|
- TCHAR szPath[MAX_PATH] = {0};
|
|
|
- _stprintf_s(szPath, _T("%sscripts\\TVUpgrade.py"), Global::g_szCurModuleDir);
|
|
|
- PyObject *pRet = pycall.CallPython(szPath, _T("API_TVUpgrade"), 3, _variant_t(strPath.GetString()), _variant_t(strFtpUser.GetString()), _variant_t(strFtpPassword.GetString()));
|
|
|
- if (pRet == NULL)
|
|
|
- {
|
|
|
- AfxMessageBox(_T("运行失败"));
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- AfxMessageBox(pycall.GetUTF8String(pRet).c_str());
|
|
|
-
|
|
|
- if (pRet)
|
|
|
- Py_DECREF(pRet);
|
|
|
- }
|
|
|
-
|
|
|
+ std::thread t([](CUpgradeWnd* p) {
|
|
|
+ CString strPath = _T(""), strFtpUser = _T(""), strFtpPassword = _T("");
|
|
|
+ p->m_edit_path.GetWindowText(strPath);
|
|
|
+ p->m_ftp_user.GetWindowText(strFtpUser);
|
|
|
+ p->m_ftp_password.GetWindowText(strFtpPassword);
|
|
|
+ if (p->_bIsFtpPath) {
|
|
|
+ Global::g_Config.strFtpUser = strFtpUser.GetString();
|
|
|
+ Global::g_Config.strFtpPassword = strFtpPassword.GetString();
|
|
|
+ WritePrivateProfileString("SATHelper", "ftp_user", strFtpUser.GetString(), Global::g_szConfig);
|
|
|
+ WritePrivateProfileString("SATHelper", "ftp_password", strFtpPassword.GetString(), Global::g_szConfig);
|
|
|
+ }
|
|
|
+
|
|
|
+ p->m_btnUpgrade.EnableWindow(FALSE);
|
|
|
+ p->m_text_notify.SetWindowText("升级中,请稍等……!");
|
|
|
+ Sleep(1000);
|
|
|
+
|
|
|
+ CCallPython pycall;
|
|
|
+ TCHAR szPath[MAX_PATH] = { 0 };
|
|
|
+ _stprintf_s(szPath, _T("%sscripts\\TVUpgrade.py"), Global::g_szCurModuleDir);
|
|
|
+ PyObject* pRet = pycall.CallPython(szPath, _T("API_TVUpgrade"), 3, _variant_t(strPath.GetString()), _variant_t(strFtpUser.GetString()), _variant_t(strFtpPassword.GetString()));
|
|
|
+ if (pRet == NULL)
|
|
|
+ {
|
|
|
+ p->m_text_notify.SetWindowText("运行出错,请检查脚本!");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ p->m_text_notify.SetWindowText(pycall.GetUTF8String(pRet).c_str());
|
|
|
+
|
|
|
+ if (pRet)
|
|
|
+ Py_DECREF(pRet);
|
|
|
+ }
|
|
|
+
|
|
|
+ p->m_btnUpgrade.EnableWindow();
|
|
|
+ }, this);
|
|
|
+ t.detach();
|
|
|
}
|
|
|
|
|
|
void CUpgradeWnd::OnUpdateBtnUpgrade(CCmdUI* pCmdUI)
|