/// ------------------------------------------------------------------------------------ /// <summary> /// If a data update is actually in progress, we want to only complete edits and not /// notify the world of the prop changes yet (we'll store the info in a queue for /// broadcast later, in Dispose()). /// </summary> /// <param name="vwsel"></param> /// <param name="sda">Data access object (corresponds to a DB connection)</param> /// <returns>Return value from IVwSelection.Commit() or IVwSelection.CompleteEdits() /// </returns> /// ------------------------------------------------------------------------------------ public static bool Commit(IVwSelection vwsel, ISilDataAccess sda) { if (vwsel == null) { return(false); } UpdateSemaphore semaphore = null; if (s_UpdateSemaphores.ContainsKey(sda)) { semaphore = s_UpdateSemaphores[sda]; } if (semaphore == null || !semaphore.fDataUpdateInProgress) { return(vwsel.Commit()); } VwChangeInfo changeInfo; bool fRet = vwsel.CompleteEdits(out changeInfo); if (changeInfo.hvo != 0) { semaphore.changeInfoQueue.Enqueue(changeInfo); } return(fRet); }
private void m_btnInsert_Click(object sender, System.EventArgs e) { IVwSelection sel = m_view.RootBox.Selection; if (sel == null) { return; } string undo; string redo; ResourceHelper.MakeUndoRedoLabels("kstidUndoRedoInsertRelatedWord", out undo, out redo); using (UndoTaskHelper undoTaskHelper = new UndoTaskHelper(m_cache.MainCacheAccessor, m_view.RootBox.Site != null ? m_view.RootBox.Site : null, undo, redo, true)) { ITsString tss; sel.GetSelectionString(out tss, ""); m_sel.ReplaceWithTsString(tss); // TE-5754: The selection is not the installed selection so the commits that happen // as part of the data monitoring process are not committed to the database. We have // to perform an explicit commit on the selection. m_sel.Commit(); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// End the undo task and call commit on root site /// </summary> /// ------------------------------------------------------------------------------------ protected virtual void EndTheUndoTask() { // Record an action that will handle replacing the selection on redo. SetupUndoSelection(false); if (ActionHandlerAccessor != null) { m_dataAccess.EndUndoTask(); } if (m_fCommit && m_vwRootSite != null) { IVwRootBox rootBox = m_vwRootSite.RootBox; if (rootBox != null) { IVwSelection vwsel = rootBox.Selection; if (vwsel != null) { vwsel.Commit(); } } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// If a data update is actually in progress, we want to only complete edits and not /// notify the world of the prop changes yet (we'll store the info in a queue for /// broadcast later, in Dispose()). /// </summary> /// <param name="vwsel"></param> /// <param name="sda">Data access object (corresponds to a DB connection)</param> /// <returns>Return value from IVwSelection.Commit() or IVwSelection.CompleteEdits() /// </returns> /// ------------------------------------------------------------------------------------ public static bool Commit(IVwSelection vwsel, ISilDataAccess sda) { if (vwsel == null) return false; UpdateSemaphore semaphore = null; if (s_UpdateSemaphores.ContainsKey(sda)) { semaphore = s_UpdateSemaphores[sda]; } if (semaphore == null || !semaphore.fDataUpdateInProgress) return vwsel.Commit(); VwChangeInfo changeInfo; bool fRet = vwsel.CompleteEdits(out changeInfo); if (changeInfo.hvo != 0) semaphore.changeInfoQueue.Enqueue(changeInfo); return fRet; }