예제 #1
0
파일: Table.cs 프로젝트: sedrion/Crema
 public void SetLockInfo(LockChangeType changeType, LockInfo lockInfo)
 {
     if (changeType == LockChangeType.Lock)
     {
         base.LockInfo = lockInfo;
     }
     else
     {
         base.LockInfo = LockInfo.Empty;
     }
 }
예제 #2
0
 public static object[] Build(object[] items, LockChangeType changeType, string[] comments)
 {
     return(new object[] { changeType, comments });
 }
예제 #3
0
 public static object[] Build(object[] items, LockChangeType changeType)
 {
     return(Build(items, changeType, items.Select(item => string.Empty).ToArray()));
 }
 void IDataBaseCollectionServiceCallback.OnDataBasesLockChanged(SignatureDate signatureDate, LockChangeType changeType, LockInfo[] lockInfos, string[] comments)
 {
     throw new NotImplementedException();
 }
예제 #5
0
        void IDataBaseCollectionServiceCallback.OnDataBasesLockChanged(SignatureDate signatureDate, LockChangeType changeType, LockInfo[] lockInfos, string[] comments)
        {
            this.InvokeAsync(() =>
            {
                var authentication = this.userContext.Authenticate(signatureDate);
                var dataBases      = new DataBase[lockInfos.Length];
                for (var i = 0; i < lockInfos.Length; i++)
                {
                    var lockInfo = lockInfos[i];
                    var dataBase = this[lockInfo.Path];
                    dataBase.SetLockInfo(changeType, lockInfo);
                    dataBases[i] = dataBase;
                }
                switch (changeType)
                {
                case LockChangeType.Lock:
                    this.InvokeItemsLockedEvent(authentication, dataBases, comments);
                    break;

                case LockChangeType.Unlock:
                    this.InvokeItemsUnlockedEvent(authentication, dataBases);
                    break;
                }
            }, nameof(IDataBaseCollectionServiceCallback.OnDataBasesLockChanged));
        }
예제 #6
0
        async void IDataBaseContextEventCallback.OnDataBasesLockChanged(CallbackInfo callbackInfo, LockChangeType changeType, LockInfo[] lockInfos, string[] comments)
        {
            try
            {
                await this.callbackEvent.InvokeAsync(callbackInfo.Index, () =>
                {
                    this.Dispatcher.Invoke(() =>
                    {
                        var authentication = this.UserContext.Authenticate(callbackInfo.SignatureDate);
                        var dataBases      = new DataBase[lockInfos.Length];
                        for (var i = 0; i < lockInfos.Length; i++)
                        {
                            var lockInfo = lockInfos[i];
                            var dataBase = this[lockInfo.Path];
                            if (changeType == LockChangeType.Unlock)
                            {
                                lockInfo.Path = string.Empty;
                            }
                            dataBase.SetLockInfo(lockInfo);
                            dataBases[i] = dataBase;
                        }
                        switch (changeType)
                        {
                        case LockChangeType.Lock:
                            this.InvokeItemsLockedEvent(authentication, dataBases, comments);
                            break;

                        case LockChangeType.Unlock:
                            this.InvokeItemsUnlockedEvent(authentication, dataBases);
                            break;
                        }
                    });
                });
            }
            catch (Exception e)
            {
                this.CremaHost.Error(e);
            }
        }