Esempio n. 1
0
BOOL CStartProgress::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// TODO:  在此添加额外的初始化
	int x = GetSystemMetrics(SM_CXSCREEN);
	int y = GetSystemMetrics(SM_CYSCREEN);

	SetWindowPos(NULL , x/2 - 175 , y/2 - 50  , 350 ,100 , SWP_SHOWWINDOW) ;

	if ( NULL == m_ProgressWnd ) {
		m_ProgressWnd = new CGIFControl ;
		m_ProgressWnd->Create(_T("") , WS_CHILD | SS_OWNERDRAW | WS_VISIBLE | SS_NOTIFY , CRect(0,0,48,34) , this, 121 ) ;
		//m_ProgressWnd->SetWindowPos(NULL , x/2 - 175 + 250 , y/2+20 , 0 ,0 , SWP_NOSIZE) ;
	}

	m_ProgressBmp[0].LoadBitmap(UiFun::GetBmpId(IDB_BITMAP_PROG1,IDB_BITMAP_PROG1_EN,theApp.language()));  
	m_ProgressBmp[1].LoadBitmap(UiFun::GetBmpId(IDB_BITMAP_PROG2,IDB_BITMAP_PROG2_EN,theApp.language()));  
	m_ProgressBmp[2].LoadBitmap(UiFun::GetBmpId(IDB_BITMAP_PROG3,IDB_BITMAP_PROG3_EN,theApp.language()));  
	m_ProgressBmp[3].LoadBitmap(UiFun::GetBmpId(IDB_BITMAP_PROG4,IDB_BITMAP_PROG4_EN,theApp.language())); 

	m_progress.SendMessage(PBM_SETBKCOLOR, 0, RGB(66, 65, 63));//背景色
	m_progress.SendMessage(PBM_SETBARCOLOR, 0, RGB(254, 153, 0));//前景色

	m_progress.SetRange(0,4);
	mprocessindex = true;
	LoadGifing(TRUE);

	theApp.SubscribeMsg( theApp.GetMtHthrdId() , GetSafeHwnd() , MSG_USER_STARTPROCESS_UI ) ;
	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}
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;
}
Esempio n. 3
0
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;
}
BOOL CProgStatusBar::Create(CWnd* pParentWnd, UINT nIDTemplate, UINT nStyle, UINT nID)
{
	// TODO: 在此添加专用代码和/或调用基类

	BOOL bRes = CDialogBar::Create(pParentWnd, nIDTemplate, nStyle, nID);
	if ( bRes ) {
		UpdateData(0);

		HCURSOR cur = ::LoadCursor(NULL, IDC_HAND);
		m_vlinkCtrlQQ.SetWindowText("官方客服QQ");
		m_vlinkCtrlQQ.SetColors(RGB(255, 255, 255), RGB(255, 255, 255));
		m_vlinkCtrlQQ.SetUnderline(FALSE);
		m_vlinkCtrlQQ.SetURL("http://www.polopoints.com/");
		m_vlinkCtrlQQ.SetCursor(cur);

		m_vlinkCtrlBlock.SetWindowText("Block chain");
		m_vlinkCtrlBlock.SetColors(RGB(255, 255, 255), RGB(255, 255, 255));
		m_vlinkCtrlBlock.SetUnderline(FALSE);
		m_vlinkCtrlBlock.SetURL("http://www.polopoints.com/");
		m_vlinkCtrlBlock.SetCursor(cur);

		m_strNeting.SetFont(80 , _T("微软雅黑"));				//设置显示字体和大小
		m_strNeting.SetTextColor(RGB(255,255,255));			    //字体颜色
		if (theApp.m_nNetWorkType == MAIN)
		{
			m_strNetName = "主" ; 
		}else if (theApp.m_nNetWorkType == REGTEST)
		{
			m_strNetName = "局域" ; 
		}else if (theApp.m_nNetWorkType == TESTNET)
		{
			m_strNetName = "测试"; 
		}
		string strTemp ="";
		strTemp =strprintf("%s%s%s", "获取", m_strNetName, "网络连接");
		m_strNeting.SetWindowText(strTemp.c_str()) ;
			

		m_strHeight.SetFont(80 , _T("微软雅黑"));				//设置显示字体和大小
		m_strHeight.SetTextColor(RGB(255,255,255));			    //字体颜色
		m_strHeight.SetWindowText("高度:") ;
		m_strHeight.ShowWindow(SW_HIDE) ;
		
		m_strVersion.SetFont(80 , _T("微软雅黑"));				//设置显示字体和大小
		m_strVersion.SetTextColor(RGB(255,255,255));	    //字体颜色

		string ver = strprintf("版本:v%s RC", GetUIVersion());
		m_strVersion.SetWindowText(ver.c_str()) ;
		//m_strVersion.SetWindowText(_T("版本:v1.0.2.0 RC")) ;

		if ( NULL == m_ProgressWnd ) {
			m_ProgressWnd = new CGIFControl ;
			m_ProgressWnd->Create(_T("") , WS_CHILD | SS_OWNERDRAW | WS_VISIBLE | SS_NOTIFY , \
				CRect(20,20,36,36) , this, 111 ) ;
		}
		
		m_SignalBmpArray[0].LoadBitmap(IDB_BITMAP_SIGNAL0);  
		m_SignalBmpArray[1].LoadBitmap(IDB_BITMAP_SIGNAL1);  
		m_SignalBmpArray[2].LoadBitmap(IDB_BITMAP_SIGNAL2);  
		m_SignalBmpArray[3].LoadBitmap(IDB_BITMAP_SIGNAL3);  

		m_LockBmpArray[0].LoadBitmap(IDB_BITMAP_LOCK); 
		m_LockBmpArray[1].LoadBitmap(IDB_BITMAP_UNLOCK); 

		theApp.SubscribeMsg( theApp.GetMtHthrdId() , GetSafeHwnd() , MSG_USER_UP_PROGRESS ) ;

		//m_progress.SendMessage(PBM_SETBKCOLOR, 0, RGB(66, 65, 63));//背景色
		//m_progress.SendMessage(PBM_SETBARCOLOR, 0, RGB(254, 153, 0));//前景色
		
		m_progress.SetTextColor(RGB(0, 0, 0));
		m_progress.SetBarBkColor(RGB(255, 255, 255));
		m_progress.SetBarColor(RGB(255, 128, 10));

		LoadGifing(TRUE);

		//CPostMsg postmsg(MSG_USER_UP_PROGRESS,0);
		//theApp.m_MsgQueue.pushFront(postmsg);
	}
	return bRes ;
}
Esempio n. 5
0
BOOL CProgStatusBar::Create(CWnd* pParentWnd, UINT nIDTemplate, UINT nStyle, UINT nID)
{
	// TODO: 在此添加专用代码和/或调用基类

	BOOL bRes = CDialogBar::Create(pParentWnd, nIDTemplate, nStyle, nID);
	if ( bRes ) {
		UpdateData(0);

		m_strNeting.SetFont(90, _T("宋体"));				//设置显示字体和大小
		m_strNeting.SetTextColor(RGB(255,255,255));			    //字体颜色
		if (theApp.netWork == 0)
		{
			netStr = UiFun::UI_LoadString("PROGSTATUS_MODULE"  , "PROGSTATUS_MAIN",theApp.gsLanguage ) ; 
		}else if (theApp.netWork == 1)
		{
			netStr = UiFun::UI_LoadString("PROGSTATUS_MODULE"  , "PROGSTATUS_LOCAL",theApp.gsLanguage ) ; 
		}else if (theApp.netWork == 2)
		{
			netStr = UiFun::UI_LoadString("PROGSTATUS_MODULE"  , "PROGSTATUS_TEST",theApp.gsLanguage ) ; 
		}
		string strTemp ="";
		strTemp =strprintf("%s%s%s",UiFun::UI_LoadString("PROGSTATUS_MODULE"  , "PROGSTATUS_GET",theApp.gsLanguage ) , netStr , UiFun::UI_LoadString("PROGSTATUS_MODULE"  , "PROGSTATUS_NETWORK_CONN",theApp.gsLanguage ));
		m_strNeting.SetWindowText(strTemp.c_str()) ;
			

		m_strHeight.SetFont(90, _T("宋体"));				//设置显示字体和大小
		m_strHeight.SetTextColor(RGB(255,255,255));			    //字体颜色
		m_strHeight.SetWindowText(UiFun::UI_LoadString("COMM_MODULE"  , "COMM_HEIGHT",theApp.gsLanguage )) ;
		m_strHeight.ShowWindow(SW_HIDE) ;
		
		m_strVersion.SetFont(90, _T("宋体"));				//设置显示字体和大小
		m_strVersion.SetTextColor(RGB(255,255,255));	    //字体颜色

		string ver = strprintf("%s:v%s RC",UiFun::UI_LoadString("COMM_MODULE"  , "COMM_VERSION",theApp.gsLanguage ) ,GetUIVersion());
		m_strVersion.SetWindowText(ver.c_str()) ;
		//m_strVersion.SetWindowText(_T("版本:v1.0.2.0 RC")) ;

		if ( NULL == m_ProgressWnd ) {
			m_ProgressWnd = new CGIFControl ;
			m_ProgressWnd->Create(_T("") , WS_CHILD | SS_OWNERDRAW | WS_VISIBLE | SS_NOTIFY , \
				CRect(20,20,36,36) , this, 111 ) ;
		}
		
		m_Sigbmp[0].LoadBitmap(IDB_BITMAP_SIG0);  
		m_Sigbmp[1].LoadBitmap(IDB_BITMAP_SIG1);  
		m_Sigbmp[2].LoadBitmap(IDB_BITMAP_SIG2);  
		m_Sigbmp[3].LoadBitmap(IDB_BITMAP_SIG3);  

		m_Lockbmp[0].LoadBitmap(IDB_BITMAP_LOCK); 
		m_Lockbmp[1].LoadBitmap(IDB_BITMAP_UNLOCK); 

		theApp.SubscribeMsg( theApp.GetMtHthrdId() , GetSafeHwnd() , MSG_USER_UP_PROGRESS ) ;

		m_progress.SendMessage(PBM_SETBKCOLOR, 0, RGB(66, 65, 63));//背景色
		m_progress.SendMessage(PBM_SETBARCOLOR, 0, RGB(254, 153, 0));//前景色

		LoadGifing(TRUE);

		//CPostMsg postmsg(MSG_USER_UP_PROGRESS,0);
		//theApp.m_MsgQueue.pushFront(postmsg);
	}
	return bRes ;
}