/// <summary> /// Post the event that will process the GUI execution requests if /// required. /// </summary> private void PostGuiExecWakeUpEventIfneeded() { if (m_wm.MainStatus == WmMainStatus.Started && m_wm.UiBroker.WmGuiExecRequestQueue.Count > 0 && m_guiExecWakeUpMsg == null && m_wm.UiBroker.UiEntryCount == 0) { m_guiExecWakeUpMsg = new WmGuiExecWakeUpMsg(this); m_wm.UiBroker.PostToUi(m_guiExecWakeUpMsg); } }
/// <summary> /// This method is called by the GUI wake up event to process GUI /// execution requests in a clean context. /// </summary> public void HandleGuiExecWakeUp(WmGuiExecWakeUpMsg msg) { // Only our posted message should call this method. Debug.Assert(m_guiExecWakeUpMsg == msg); // Process the GUI execution requests. ProcessGuiExecRequest(); // Clear the reference to the message to indicate that we're done // executing the requests. m_guiExecWakeUpMsg = null; // Execute the state machine to stop the WM if required. if (m_wm.Sm.StopFlag) RequestRun("GUI wake up event when stopping"); }