当前位置: 首页>>代码示例>>C++>>正文


C++ CBOINCBaseFrame::ProcessEvent方法代码示例

本文整理汇总了C++中CBOINCBaseFrame::ProcessEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ CBOINCBaseFrame::ProcessEvent方法的具体用法?C++ CBOINCBaseFrame::ProcessEvent怎么用?C++ CBOINCBaseFrame::ProcessEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBOINCBaseFrame的用法示例。


在下文中一共展示了CBOINCBaseFrame::ProcessEvent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: HandleCompletedRPC


//.........这里部分代码省略.........
            break;
        case RPC_GET_STATISTICS:
            if (current_rpc_request.exchangeBuf && !retval) {
                PROJECTS* arg1 = (PROJECTS*)current_rpc_request.arg1;
                PROJECTS* exchangeBuf = (PROJECTS*)current_rpc_request.exchangeBuf;
                arg1->projects.swap(exchangeBuf->projects);
            }
            break;
            
        case RPC_GET_CC_STATUS:
            if (current_rpc_request.exchangeBuf && !retval) {
                CC_STATUS* arg1 = (CC_STATUS*)current_rpc_request.arg1;
                CC_STATUS* exchangeBuf = (CC_STATUS*)current_rpc_request.exchangeBuf;
                *exchangeBuf = *arg1;
            }
            break;
        case RPC_ACCT_MGR_INFO:
            if (current_rpc_request.exchangeBuf && !retval) {
                ACCT_MGR_INFO* arg1 = (ACCT_MGR_INFO*)current_rpc_request.arg1;
                ACCT_MGR_INFO* exchangeBuf = (ACCT_MGR_INFO*)current_rpc_request.exchangeBuf;
                *exchangeBuf = *arg1;
           }
            break;
        default:
            // We don't support double buffering for other RPC calls 
            wxASSERT(current_rpc_request.exchangeBuf == NULL);
            break;
        }
    }
    
    if (current_rpc_request.resultPtr) {
        // In case post-processing changed retval
        *(current_rpc_request.resultPtr) = retval;
    }

    // We must call ProcessEvent() rather than AddPendingEvent() here to 
    // guarantee integrity of data when other events are handled (such as 
    // Abort, Suspend/Resume, Show Graphics, Update, Detach, Reset, No 
    // New Work, etc.)  Otherwise, if one of those events is pending it 
    // might be processed first, and the data in the selected rows may not 
    // match the data which the user selected if any rows were added or 
    // deleted due to the RPC.  
    // The refresh event called here adjusts the selections to fix any 
    // such mismatch before other pending events are processed.  
    //
    // However, the refresh code may itself request a Demand RPC, which 
    // would cause undesirable recursion if we are already waiting for 
    // another Demand RPC to complete.  In that case, we defer the refresh 
    // until all pending Demand RPCs have been done.
    //
    if (m_bNeedRefresh && !m_bWaitingForRPC) {
        m_bNeedRefresh = false;
        // We must get the frame immediately before using it, 
        // since it may have been changed by SetActiveGUI().
        CBOINCBaseFrame* pFrame = wxGetApp().GetFrame();
        if (pFrame) {
            CFrameEvent event(wxEVT_FRAME_REFRESHVIEW, pFrame);
            pFrame->ProcessEvent(event);
        }
    }

    if (m_bNeedTaskBarRefresh && !m_bWaitingForRPC) {
        m_bNeedTaskBarRefresh = false;
        CTaskBarIcon* pTaskbar = wxGetApp().GetTaskBarIcon();
        if (pTaskbar) {
            CTaskbarEvent event(wxEVT_TASKBAR_REFRESH, pTaskbar);
            pTaskbar->ProcessEvent(event);
        }
    }

    if (current_rpc_request.rpcType == RPC_TYPE_ASYNC_WITH_REFRESH_EVENT_LOG_AFTER) {
        CDlgEventLog* eventLog = wxGetApp().GetEventLog();
        if (eventLog) {
            eventLog->OnRefresh();
        }
    }
    
    current_rpc_request.clear();

    // Start the next RPC request.  
    // We can't start this until finished processing the previous RPC's 
    // event because the two requests may write into the same buffer.
    if (RPC_requests.size() > 0) {
        // Wait for thread to unlock mutex with m_pRPC_Thread_Condition->Wait()
        mutexErr = m_pRPC_Thread_Mutex->Lock();  // Blocks until thread unlocks the mutex
        wxASSERT(mutexErr == wxMUTEX_NO_ERROR);

        // Make sure activation is an atomic operation
        RPC_requests[0].isActive = false;
        current_rpc_request = RPC_requests[0];
        current_rpc_request.isActive = true;

        m_pRPC_Thread_Condition->Signal();  // Unblock the thread

        // m_pRPC_Thread_Condition->Wait() will Lock() the mutex upon receiving Signal(), 
        // causing it to block again if we still have our lock on the mutex.
        mutexErr = m_pRPC_Thread_Mutex->Unlock();
        wxASSERT(mutexErr == wxMUTEX_NO_ERROR);
    }
}
开发者ID:Rytiss,项目名称:native-boinc-for-android,代码行数:101,代码来源:AsyncRPC.cpp


注:本文中的CBOINCBaseFrame::ProcessEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。