Beispiel #1
0
        /// <summary>
        /// Calls the back account change.
        /// </summary>
        /// <param name="subscriptionId">The subscription identifier.</param>
        /// <param name="storageChangeSet">The storage change set.</param>
        public virtual void CallBackAccountChange(string subscriptionId, StorageChangeSet storageChangeSet)
        {
            if (storageChangeSet.Changes == null ||
                storageChangeSet.Changes.Length == 0 ||
                storageChangeSet.Changes[0].Length < 2)
            {
                Logger.Warn("Couldn't update account informations. Please check 'CallBackAccountChange'");
                return;
            }

            var accountInfoStr = storageChangeSet.Changes[0][1];

            if (string.IsNullOrEmpty(accountInfoStr))
            {
                Logger.Warn("Couldn't update account informations. Account doesn't exists, please check 'CallBackAccountChange'");
                return;
            }

            var accountInfo = new AccountInfo();

            accountInfo.Create(accountInfoStr);
            AccountInfo = accountInfo;

            AccountInfoUpdated?.Invoke(this, AccountInfo);
        }
Beispiel #2
0
        private void BgwAccountUpdater_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            switch (e.UserState.ToString())
            {
            case "ACCOUNT_CREATED":
                AccountCreated?.Invoke(this, new AccountEventArgs(accountData));
                break;

            case "ACCOUNT_DELETED":
                AccountDeleted?.Invoke(this, new AccountEventArgs(accountData));
                break;

            case "ACCOUNT_INFO_UPDATED":
                AccountInfoUpdated?.Invoke(this, new AccountEventArgs(accountData));
                break;

            default:
                throw (new ArgumentException());
            }
        }