int CProgStatusBar::ShowProgressCtrl(){ CPostMsg postmsg; if (!theApp.m_UimsgQueue.pop(postmsg)) { return 1; } uistruct::BLOCKCHANGED_t pBlockchanged; string strTemp = postmsg.GetData(); pBlockchanged.JsonToStruct(strTemp.c_str()); LogPrint("CProgStatusBar", "MSG_USER_UP_PROGRESS WM_CONNECTNET 更新进度条消息:%s\n",strTemp.c_str()); if (pBlockchanged.tips <= 0) { return 1; } //// blocktip高度 theApp.blocktipheight = pBlockchanged.tips ; if (!m_bProgressType) { string strTemp = ""; strTemp = strprintf("%s%s",netStr , UiFun::UI_LoadString("PROGSTATUS_MODULE" , "PROGSTATUS_NETWORK_SYNING",theApp.gsLanguage )); m_strNeting.SetWindowText(strTemp.c_str()); m_strNeting.ShowWindow(SW_HIDE); m_strNeting.ShowWindow(SW_SHOW); m_progress.SetRange32( 0 , 100); int setpos =(int)((pBlockchanged.high*1.0/pBlockchanged.tips)*100) ; setpos = setpos>100?100:setpos; //设置进度条的值 m_progress.SetPos(setpos); CString strText; strText.AppendFormat("%s ~%d", UiFun::UI_LoadString("PROGSTATUS_MODULE" , "PROGSTATUS_SURPLUS",theApp.gsLanguage ) , pBlockchanged.tips-pBlockchanged.high); strText.AppendFormat(" %s",UiFun::UI_LoadString("PROGSTATUS_MODULE" , "PROGSTATUS_SYNLOCAL",theApp.gsLanguage )); m_progress.SetDefinedStr(strText); m_bProgressType = TRUE; m_nSigIndex =pBlockchanged.connections>3?3:pBlockchanged.connections; m_connectCount = pBlockchanged.connections; if (pBlockchanged.tips==pBlockchanged.high) { theApp.IsSyncAppTx = TRUE; /// 同步app交易 } if ((pBlockchanged.tips-pBlockchanged.high)<10 && !m_walletui) { TRACE("ok:%s\r\n","OnShowProgressCtrl"); //// 发送钱包同步完毕 CPostMsg postblockmsg(MSG_USER_MAIN_UI,WM_UPWALLET); theApp.m_MsgQueue.pushFront(postblockmsg); LoadGifing(false); m_walletui = true; theApp.IsSyncBlock = true; } Invalidate(); //InvalidateRect(m_bmpsig); // return 1; } m_nSigIndex = pBlockchanged.connections>3?3:pBlockchanged.connections; int setpos =(int) ((pBlockchanged.high*1.0/pBlockchanged.tips)*100) ; setpos = setpos>100?100:setpos; //设置进度条的值 m_progress.SetPos(setpos); CString strText; strText.AppendFormat("%s ~%d", UiFun::UI_LoadString("PROGSTATUS_MODULE" , "PROGSTATUS_SURPLUS",theApp.gsLanguage ) , pBlockchanged.tips-pBlockchanged.high); strText.AppendFormat(" %s",UiFun::UI_LoadString("PROGSTATUS_MODULE" , "PROGSTATUS_SYNLOCAL",theApp.gsLanguage )); m_progress.SetDefinedStr(strText); m_progress.Invalidate(); if (pBlockchanged.tips==pBlockchanged.high) { theApp.IsSyncAppTx = TRUE; /// 同步app交易 } if ((pBlockchanged.tips-pBlockchanged.high)<10&& !m_walletui) { TRACE("ok:%s\r\n","OnShowProgressCtrl"); //// 发送钱包同步完毕 CPostMsg postblockmsg(MSG_USER_MAIN_UI,WM_UPWALLET); theApp.m_MsgQueue.pushFront(postblockmsg); LoadGifing(false); m_walletui = true; theApp.IsSyncBlock = true; } if ( m_walletui && !m_prosshiden) { string strTemp = ""; strTemp =strprintf("%s%s",netStr , UiFun::UI_LoadString("PROGSTATUS_MODULE" , "PROGSTATUS_NET",theApp.gsLanguage ) ); m_strNeting.SetWindowText(strTemp.c_str()) ; m_strNeting.ShowWindow(SW_HIDE); m_strNeting.ShowWindow(SW_SHOW); m_progress.ShowWindow(SW_HIDE); if ( NULL != m_ProgressWnd ) { m_ProgressWnd->ShowWindow(SW_HIDE) ; } if (m_prosshiden == false) { m_prosshiden =true; }else{ m_prosshiden =false; } } if (m_walletui && m_prosshiden) { string strTips; strTips = strprintf("%s:%d" ,UiFun::UI_LoadString("PROGSTATUS_MODULE" , "PROGSTATUS_CURRENT_HEIGHT",theApp.gsLanguage ) ,pBlockchanged.tips ) ; m_strHeight.SetWindowText(strTips.c_str()) ; m_strHeight.ShowWindow(SW_HIDE); m_strHeight.ShowWindow(SW_SHOW); } InvalidateRect(m_bmpsig); SetAppStepfee(pBlockchanged.fuelrate); return 1; }
int CProgStatusBar::ShowProgressCtrl(){ CPostMsg postmsg; if (!theApp.m_msgProcessBarQueue.pop(postmsg)) { return 1; } uistruct::BLOCKCHANGED_t pBlockchanged; string strTemp = postmsg.GetData(); pBlockchanged.JsonToStruct(strTemp.c_str()); LogPrint("CProgStatusBar", "MSG_USER_UP_PROGRESS WM_CONNECTNET 更新进度条消息:%s\n",strTemp.c_str()); if (pBlockchanged.tips <= 0) { return 1; } //// blocktip高度 theApp.m_nBlockTipHight = pBlockchanged.tips ; if (!m_bProgressType) { string strTemp = ""; strTemp = strprintf("%s%s",m_strNetName , "网络同步中..."); m_strNeting.SetWindowText(strTemp.c_str()); m_strNeting.ShowWindow(SW_HIDE); m_strNeting.ShowWindow(SW_SHOW); m_progress.SetRange32( 0 , 100); int setpos =(int)((pBlockchanged.high*1.0/pBlockchanged.tips)*100) ; setpos = setpos>100?100:setpos; //设置进度条的值 m_progress.SetPos(setpos); CString strText; strText.AppendFormat("%s ~%d", "剩余", pBlockchanged.tips-pBlockchanged.high); strText.AppendFormat(" %s","块没有同步到本地"); m_progress.SetDefinedStr(strText); m_bProgressType = TRUE; m_nSigIndex =pBlockchanged.connections>3?3:pBlockchanged.connections; m_nConnectCount = pBlockchanged.connections; if (pBlockchanged.tips==pBlockchanged.high) { //theApp.IsSyncAppTx = TRUE; /// 同步app交易 } if ((pBlockchanged.tips-pBlockchanged.high)<10 && !m_bIsWalletUI) { TRACE("ok:%s\r\n","OnShowProgressCtrl"); //// 发送钱包同步完毕 CPostMsg postblockmsg(MSG_USER_MAIN_UI,WM_UPWALLET); theApp.m_msgQueue.pushFront(postblockmsg); LoadGifing(false); m_bIsWalletUI = true; theApp.m_bIsSyncBlock = true; } Invalidate(); //InvalidateRect(m_bmpsig); // return 1; } m_nSigIndex = pBlockchanged.connections>3?3:pBlockchanged.connections; int setpos =(int) ((pBlockchanged.high*1.0/pBlockchanged.tips)*100) ; setpos = setpos>100?100:setpos; //设置进度条的值 m_progress.SetPos(setpos); CString strText; strText.AppendFormat("%s ~%d", "剩余", pBlockchanged.tips-pBlockchanged.high); strText.AppendFormat(" %s","块没有同步到本地"); m_progress.SetDefinedStr(strText); m_progress.Invalidate(); if (pBlockchanged.tips==pBlockchanged.high) { //theApp.IsSyncAppTx = TRUE; /// 同步app交易 } if ((pBlockchanged.tips-pBlockchanged.high)<10&& !m_bIsWalletUI) { TRACE("ok:%s\r\n","OnShowProgressCtrl"); //// 发送钱包同步完毕 CPostMsg postblockmsg(MSG_USER_MAIN_UI,WM_UPWALLET); theApp.m_msgQueue.pushFront(postblockmsg); LoadGifing(false); m_bIsWalletUI = true; theApp.m_bIsSyncBlock = true; } if ( m_bIsWalletUI && !m_bIsShowProgress) { string strTemp = ""; strTemp =strprintf("%s%s",m_strNetName , "网络同步中..."); m_strNeting.SetWindowText(strTemp.c_str()) ; m_strNeting.ShowWindow(SW_HIDE); m_strNeting.ShowWindow(SW_SHOW); m_progress.ShowWindow(SW_HIDE); if ( NULL != m_ProgressWnd ) { m_ProgressWnd->ShowWindow(SW_HIDE) ; } if (m_bIsShowProgress == false) { m_bIsShowProgress =true; }else{ m_bIsShowProgress =false; } } if (m_bIsWalletUI && m_bIsShowProgress) { string strTemp; strTemp = strprintf("%s网络",m_strNetName); m_strNeting.SetWindowText(strTemp.c_str()); m_strNeting.ShowWindow(SW_HIDE); m_strNeting.ShowWindow(SW_SHOW); string strTips; strTips = strprintf("%s:%d" ,"当前高度" ,pBlockchanged.tips ); m_strHeight.SetWindowText(strTips.c_str()) ; m_strHeight.ShowWindow(SW_HIDE); m_strHeight.ShowWindow(SW_SHOW); CRect rc; m_strNeting.GetWindowRect(&rc); m_strNeting.MoveWindow(30 , 12, 58, rc.Height()); } InvalidateRect(m_rectSignal); SetAppStepfee(pBlockchanged.fuelrate); return 1; }
void CMainDlg::SetCtrlText() { ClearCtrlText(); CPostMsg postmsg; if (!theApp.m_msgUIMainDlgQueue.pop(postmsg)) { LogPrint("INFO","m_UiManDlgQueue Emptry\r\n"); return ; } uistruct::MINDLG_T maindlg; string strTemp = postmsg.GetData(); maindlg.JsonToStruct(strTemp.c_str()); string strCommand,strShowData; string strMoney = ""; strMoney = strprintf("%s",maindlg.money.c_str());//)= _T(maindlg.money.c_str()); strMoney = CSoyPayHelp::getInstance()->DisPlayMoney(strMoney); GetDlgItem(IDC_ST_BALANCE)->SetWindowText(strMoney.c_str()); //strMoney = _T(maindlg.unconfirmmoney.c_str()); strMoney = strprintf("%s",maindlg.unconfirmmoney.c_str()); strMoney = CSoyPayHelp::getInstance()->DisPlayMoney(strMoney); GetDlgItem(IDC_ST_CONFIRMING)->SetWindowText(strMoney.c_str()); m_strTransactionNumber.SetWindowText(maindlg.itemcount.c_str()) ; string strDes = ""; string addr1 = maindlg.addr1; uistruct::REVTRANSACTION_t temp; if (addr1 != "") { temp.JsonToStruct(addr1); strCommand =strprintf("%.4f",temp.money*COIN); strShowData = strprintf("%s",temp.addr.c_str()); strDes = strprintf("%s",temp.desaddr.c_str()); GetDlgItem(IDC_ST_DESADDR1)->SetWindowText(strDes.c_str()) ; GetDlgItem(IDC_ST_SRCADDR1)->SetWindowText(strShowData.c_str()) ; GetDlgItem(IDC_ST_AMOUNT1)->SetWindowText(strCommand.c_str()) ; } addr1 = maindlg.addr2; if (addr1 != "") { temp.JsonToStruct(addr1); strCommand = strprintf("%.4f",temp.money*COIN); strShowData = strprintf("%s",temp.addr.c_str()); strDes = strprintf("%s",temp.desaddr.c_str()); GetDlgItem(IDC_ST_DESADDR2)->SetWindowText(strDes.c_str()) ; GetDlgItem(IDC_ST_SRCADDR2)->SetWindowText(strShowData.c_str()) ; GetDlgItem(IDC_ST_AMOUNT2)->SetWindowText(strCommand.c_str()) ; } addr1 = maindlg.addr3; if (addr1 != "") { temp.JsonToStruct(addr1); strCommand = strprintf("%.4f",temp.money*COIN); strShowData = strprintf("%s",temp.addr.c_str()); strDes = strprintf("%s",temp.desaddr.c_str()); GetDlgItem(IDC_ST_DESADDR3)->SetWindowText(strDes.c_str()) ; GetDlgItem(IDC_ST_SRCADDR3)->SetWindowText(strShowData.c_str()) ; GetDlgItem(IDC_ST_AMOUNT3)->SetWindowText(strCommand.c_str()) ; } addr1 = maindlg.addr4; if (addr1 != "") { temp.JsonToStruct(addr1); strCommand = strprintf("%.4f",temp.money*COIN); strShowData = strprintf("%s",temp.addr.c_str()); strDes =strprintf("%s",temp.desaddr.c_str()); GetDlgItem(IDC_ST_DESADDR4)->SetWindowText(strDes.c_str()) ; GetDlgItem(IDC_ST_SRCADDR4)->SetWindowText(strShowData.c_str()) ; GetDlgItem(IDC_ST_AMOUNT4)->SetWindowText(strCommand.c_str()) ; } Invalidate(); }