Esempio n. 1
0
void CRealTimeView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
{
	// TODO: Add your specialized code here and/or call the base class
	if( UPDATE_HINT_REALTIMEVIEW != lHint )
		return;
	if( !IsWindowVisible() )
		return;
	SetFocus( );

	ASSERT( RTV_MAX_MULTICOUNT > 0 );

	CStockInfo	info;
	if( AfxGetProfile().GetCurrentStock( &info ) )
	{
		m_realtime[0].SetCurStock( info );
		m_realtime[0].PrepareStockData( );
	}
	else
	{
		m_realtime[0].SetCurStock( STKLIB_CODE_MAIN );
		m_realtime[0].PrepareStockData( );
		AfxGetProfile().SetCurrentStock( STKLIB_CODE_MAIN, FALSE );
	}
	if( CRealTime::modeReportDetail == m_realtime[0].GetDrawMode() )
		AfxGetStkReceiver().RequestStockData( CStock::dataDetail, &info, 1, 0, 0 );
	else
		AfxGetStkReceiver().RequestStockData( CStock::dataMinute, &info, 1, 0, 0 );

	// 多股同列
	int i;
	for( i=1; i<m_nMultiStockCount && i<RTV_MAX_MULTICOUNT; i++ )
	{
		if( AfxGetProfile().GetNextStock( &info ) )
		{
			m_realtime[i].SetCurStock( info );
			m_realtime[i].PrepareStockData( );
			if( CRealTime::modeReportDetail == m_realtime[0].GetDrawMode() )
				AfxGetStkReceiver().RequestStockData( CStock::dataDetail, &info, 1, 0, 0 );
			else
				AfxGetStkReceiver().RequestStockData( CStock::dataMinute, &info, 1, 0, 0 );
		}
	}
	for( i=1; i<m_nMultiStockCount && i<RTV_MAX_MULTICOUNT; i++ )
		AfxGetProfile().GetPrevStock( &info );

	Invalidate( );

	if( 1 == m_nMultiStockCount && CRealTime::modePriceLine == m_realtime[0].GetDrawMode() )
		m_wndReportTab.SetWindowPos( NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW );
	else
		m_wndReportTab.SetWindowPos( NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_HIDEWINDOW );

	CMainFrame	* pFrame = AfxGetMainFrame();
	if( pFrame )
		pFrame->m_SearchBox.SetCurrentWindowText( );

	SendRequestQuote(TRUE);
}
Esempio n. 2
0
void CSListView::OnTimer(UINT nIDEvent) 
{
	if( SLV_TIMER_REFRESH == nIDEvent )
	{
		SendRequestQuote(FALSE);
	}
	
	CFormView::OnTimer(nIDEvent);
}
Esempio n. 3
0
void CMultiSortView::OnTimer(UINT nIDEvent) 
{
	if( MSV_TIMER_REFRESH == nIDEvent )
	{
		SendRequestQuote(FALSE);

		CView * pView = AfxGetStaticDoc()->GetActiveView();
		if( pView == this )
			m_multisort.RecalculateSortID( TRUE, TRUE );
	}

	CView::OnTimer(nIDEvent);
}
Esempio n. 4
0
void CMultiSortView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
{
	// TODO: Add your specialized code here and/or call the base class
	if( UPDATE_HINT_MULTISORTVIEW != lHint )
		return;
	if( !IsWindowVisible() )
		return;
	SetFocus( );

	m_multisort.RecalculateSortID( FALSE, FALSE );
	Invalidate( );

	SendRequestQuote(TRUE);
}
Esempio n. 5
0
void CRealTimeView::OnTimer(UINT nIDEvent) 
{
	if( RTV_TIMER_REFRESHBIGTRADE == nIDEvent )
	{
		int	nDrawMode	=	m_realtime[0].GetDrawMode();
		int	nReportWhat	=	m_realtime[0].GetReportWhat();

		if( CRealTime::modeBigTradeDetail == nDrawMode )
			Invalidate( );
		else if( CRealTime::modePriceLine == nDrawMode
			&& CRealTime::reportBigTrade == nReportWhat )
			m_realtime[0].DrawReportRegion( NULL );
	}
	if( RTV_TIMER_REFRESH == nIDEvent )
	{
		SendRequestQuote(FALSE);
	}

	CView::OnTimer(nIDEvent);
}
Esempio n. 6
0
void CSListView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
{
	// TODO: Add your specialized code here and/or call the base class
	if( UPDATE_HINT_SLISTVIEW != lHint )
		return;
	if( IsWindowVisible() )
		SetFocus( );
	int	nColumnCount	=	m_Grid.GetColumnCount();
	if( nColumnCount <= 0 )
		return;

	if( GetParentFrame()->GetSafeHwnd() != AfxGetMainFrame()->GetActiveFrame()->GetSafeHwnd() )
	{
		m_bShouldUpdate	=	TRUE;
		return;
	}
	m_bShouldUpdate	=	FALSE;

	CStockContainer & container = AfxGetSListStockContainer();
	container.Lock();

	m_Grid.DeleteNonFixedRows();

	// Progress
	CMainFrame	* pMainFrame = AfxGetMainFrame();
	if( pMainFrame )
	{
		pMainFrame->ShowProgressBar( );
		pMainFrame->SetProgress( 0 );
		pMainFrame->SetMessageText( IDS_MAINFRAME_WAITING );
	}

	CUIntArray	anParams;
	anParams.SetSize( 0, nColumnCount );
	for( int nCol=0; nCol < nColumnCount; nCol ++ )
	{
		LPARAM	lParam	=	m_Grid.GetItemData( 0, nCol );
		anParams.Add( lParam );
	}

	CRect rectClient;
	GetClientRect( &rectClient );
	int nPageCount = 1 + rectClient.Height() / abs(m_Grid.GetFixedRowHeight()) + 1;

	for( int i=0; i<container.GetSize(); i++ )
	{
		CStockInfo & info = container.GetStockInfoByID(i);

		int nRow = m_Grid.InsertRow( info.GetStockName() );
		m_Grid.SetItemData( nRow, 0, i );

		for( int nCol=0; nCol<anParams.GetSize(); nCol++ )
		{
			m_Grid.SetItemFormat( nRow, nCol, DT_CENTER|DT_VCENTER|DT_SINGLELINE );
			m_Grid.SetItemText( nRow, nCol, AfxGetVariantDispString( anParams[nCol], info, &container ) );
			m_Grid.SetItemBkColour( nRow, nCol, AfxGetProfile().GetColor(CColorClass::clrSListBK) );
			m_Grid.SetItemFgColour( nRow, nCol, AfxGetVariantColor( anParams[nCol], info ) );
			if( anParams[nCol] == SLH_DATE )
				m_Grid.SetColumnWidth( nCol, 80 );
			if( anParams[nCol] == SLH_CODE )
				m_Grid.SetColumnWidth( nCol, 60 );
		}

		if( i == nPageCount+5 )
		{
			m_Grid.Invalidate( );
			MSG		msg;
			while (::PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE) )
				AfxGetApp()->PumpMessage();
		}
		if( pMainFrame )
			pMainFrame->SetProgress( 100*i/container.GetSize() );
	}

	// Set Average and Weight Average
//	SetAverageItem( m_Grid, container, FALSE );

	// Sort If Needed
	if( -1 != m_nColSort )
	{
		LPARAM	lParam	=	m_Grid.GetItemData( 0, m_nColSort );
		if( lParam >= 0 )
		{
			CStockContainer::m_pSortContainer	=	&container;
			container.m_nSortVariantID	=	lParam;
			container.m_bSortAscend		=	m_bSortAscend;
			m_Grid.SortItems( ItemCompareFunc, 0, TRUE );
		}
	}

	if( pMainFrame )
	{
		pMainFrame->SetProgress( 100 );
		pMainFrame->HideProgressBar( );
		pMainFrame->SetMessageText( IDS_MAINFRAME_FINISHED );
		pMainFrame->SetMessageText( IDS_HELPTIP_SLIST );
	}

	if( m_bFirstUpdate )
		m_Grid.AutoSizeColumns( );
	else
		m_Grid.SetColumnWidth( 0, 80 );
	m_bFirstUpdate	=	FALSE;
	m_Grid.Invalidate( );

	SendRequestQuote(TRUE);

	container.UnLock();
}