Exemple #1
0
 public void NotifyAccountModification(Account modifiedAccount)
 {
     if (AccountsList.Contains(modifiedAccount, new AccountComparer()))
     {
         UpdateHelper.Instance.AccountsListModificationHelper.Add(modifiedAccount);
     }
 }
Exemple #2
0
 public void NotifyAccountAddition(Account addedAccount)
 {
     if (!AccountsList.Contains(addedAccount, new AccountComparer()))
     {
         UpdateHelper.Instance.AccountsListAdditionHelper.Add(addedAccount);
     }
 }
Exemple #3
0
 public void NotifyAccountRemoval(Account removedAccount)
 {
     if (AccountsList.Contains(removedAccount, new AccountComparer()))
     {
         UpdateHelper.Instance.AccountsListRemovalHelper.Add(removedAccount);
     }
 }
Exemple #4
0
        private void AccountsUpdateTask()
        {
            if (UpdateHelper.Instance.AccountsListAdditionHelper.Count != 0)
            {
                foreach (Account a in UpdateHelper.Instance.AccountsListAdditionHelper)
                {
                    if (!AccountsList.Contains(a, new AccountComparer()))
                    {
                        AccountsList.Add(a);
                    }
                }
            }

            if (UpdateHelper.Instance.AccountsListModificationHelper.Count != 0)
            {
                foreach (Account a in UpdateHelper.Instance.AccountsListModificationHelper)
                {
                    if (AccountsList.Contains(a, new AccountComparer()))
                    {
                        Account foundAccount = AccountsList.FirstOrDefault(ac => ac.Username.Equals(a.Username));
                        AccountsList.Remove(foundAccount);
                    }
                }
            }

            if (UpdateHelper.Instance.AccountsListRemovalHelper.Count != 0)
            {
                foreach (Account a in UpdateHelper.Instance.AccountsListRemovalHelper)
                {
                    if (AccountsList.Contains(a, new AccountComparer()))
                    {
                        Account foundAccount = AccountsList.FirstOrDefault(ac => ac.Username.Equals(a.Username));
                        AccountsList.Remove(foundAccount);
                        AccountsList.Add(a);
                    }
                }
            }

            if (++UpdateHelper.Instance.AccountCounter >= UpdateHelper.Instance.Limit - 1)
            {
                UpdateHelper.Instance.AccountsListAdditionHelper     = new List <Account>();
                UpdateHelper.Instance.AccountsListRemovalHelper      = new List <Account>();
                UpdateHelper.Instance.AccountsListModificationHelper = new List <Account>();

                UpdateHelper.Instance.AccountCounter = 0;
            }
        }