コード例 #1
0
    virtual void ProcessEvent( EFlowEvent evt, SActivationInfo* pActInfo )
    {
        switch ( evt )
        {
        case eFE_Suspend:
            pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, false );
            break;

        case eFE_Resume:
            pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, true );
            break;

        case eFE_Initialize:
            break;

        case eFE_Activate:
        {
            if ( IsPortActive( pActInfo, EIP_ACTIVATE ) ) {
                m_iViewId = GetPortInt( pActInfo, EIP_VIEWID );
                m_bHandlerRegistered = false;
                pActInfo->pGraph->SetRegularlyUpdated( pActInfo->myID, true );
            }
        }
        break;

        case eFE_Update:
            if ( !m_bHandlerRegistered )
            {
                CCoherentViewListener* pViewListener = gCoherentUISystem->GetViewListener( m_iViewId );
                if ( pViewListener && pViewListener->IsReadyForBindings() )
                {
                    Coherent::UI::View* pView = pViewListener->GetView();
                    if ( pView )
                    {
                        std::string sEvent = GetPortString( pActInfo, EIP_EVENT );
                        pView->RegisterForEvent( sEvent.c_str(), Coherent::UI::MakeHandler(this, &CFlowCUIHandleEvent::HandleEvent));
                        m_bHandlerRegistered = true;
                    }
                }
            }
            if ( m_bReceivedEvent )
            {
                m_bReceivedEvent = false;
                string strArg = m_event.strArg.c_str();
                ActivateOutput( pActInfo, EIP_ARG1, strArg );
                ActivateOutput( pActInfo, EIP_ARG2, m_event.boolArg );
            }
            break;
        }
    }