Exemplo n.º 1
0
        private bool _LockDocument(TsfSharp.TsLfFlags dwLockFlags)
        {
            if (_locked)
            {
                return(false);
            }

            _locked    = true;
            _lockFlags = dwLockFlags;

            return(true);
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
 private bool _IsLocked(TsfSharp.TsLfFlags dwLockType)
 {
     return(_locked && (_lockFlags & dwLockType) != 0);
 }