/// <summary> /// Returns null if: /// 1. Could not take a lock on the item /// 2. Item was not available locally /// /// When you are done editing, call CommitAsync() on the RecordItemEditOperation /// To abort, call RecordItemEditOperation::Cancel() /// /// </summary> public IAsyncOperation <RecordItemEditOperation> OpenForEditAsync(ItemKey key) { if (key == null) { throw new ArgumentNullException("key"); } return(AsyncInfo.Run <RecordItemEditOperation>(async cancelToken => { RecordItemLock rLock = this.AcquireItemLock(key); if (rLock == null) { return null; } RecordItemEditOperation editOp = null; try { editOp = await this.OpenForEditAsync(key, rLock); return editOp; } finally { if (editOp == null) { rLock.Release(); } } })); }
void ReleaseLock() { if (m_rLock != null) { m_rLock.Release(); m_rLock = null; } }