private bool _LockDocument(TsfSharp.TsLfFlags dwLockFlags) { if (_locked) { return(false); } _locked = true; _lockFlags = dwLockFlags; return(true); }
public void RequestLock(TsfSharp.TsLfFlags dwLockFlags, out Result hrSession) { if (_sink == null) { throw new COMException("TextStore_NoSink"); } if (dwLockFlags == 0) { throw new COMException("TextStore_BadLockFlags"); } hrSession = Result.Fail; if (_locked) { //the document is locked if ((dwLockFlags & TsfSharp.TsLfFlags.Sync) == TsfSharp.TsLfFlags.Sync) { /* * The caller wants an immediate lock, but this cannot be granted because * the document is already locked. */ hrSession = (int)TsErrors.TsESynchronous; } else { //the request is asynchronous //Queue the lock request _lockRequestQueue.Enqueue(dwLockFlags); hrSession = (int)TsErrors.TsSAsync; } return; } //lock the document _LockDocument(dwLockFlags); //call OnLockGranted hrSession = _sink.OnLockGranted(dwLockFlags); //unlock the document _UnlockDocument(); }
private bool _IsLocked(TsfSharp.TsLfFlags dwLockType) { return(_locked && (_lockFlags & dwLockType) != 0); }