void Application_Idle(object sender, EventArgs e) { if (m_lastPositionArgs != null && PositionChanged != null) PositionChanged(this, m_lastPositionArgs); Application.Idle -= new EventHandler(Application_Idle); m_lastPositionArgs = null; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Called when the position in Libronix changed. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="SIL.FieldWorks.TE.LibronixLinker.PositionChangedEventArgs"/> /// instance containing the event data.</param> /// ------------------------------------------------------------------------------------ private void OnPositionChanged(object sender, PositionChangedEventArgs e) { if ((m_editingHelper != null && !m_editingHelper.ProjectSettings.ReceiveSyncMessages) || m_fIgnoreNextRecvdLibronixSyncMessage || m_fProcessingSyncMessage || m_fIgnoreAnySyncMessages) { if (m_fProcessingSyncMessage) m_queuedReference = new ScrReference(e.BcvRef, Paratext.ScrVers.English); m_fIgnoreNextRecvdLibronixSyncMessage = false; } else ProcessReceivedMessage(new ScrReference(e.BcvRef, Paratext.ScrVers.English)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Called when the position changed. /// </summary> /// <param name="e">The <see cref="SIL.FieldWorks.TE.LibronixLinker.PositionChangedEventArgs"/> /// instance containing the event data.</param> /// ------------------------------------------------------------------------------------ private void RaisePositionChangedEvent(PositionChangedEventArgs e) { // Needs to return fast, so hold off actually moving until idle. m_lastPositionArgs = e; Application.Idle += new EventHandler(Application_Idle); //if (m_MarshalingControl.InvokeRequired) //{ // m_MarshalingControl.BeginInvoke(new PositionChangedDelegate(RaisePositionChangedEvent), // e); //} //else // PositionChanged(this, e); }