Ejemplo n.º 1
0
 public bool Delete(Task task)
 {
     if (task.AccountInfo.Provider == AccountProvider.Google)
     {
         GoogleTaskManager googleTaskManager = new GoogleTaskManager();
         bool deleteSucess = googleTaskManager.Delete(task);
         if (!deleteSucess)
         {
             Errors.Add(googleTaskManager.ErrorMessage, task.AccountInfo);
         }
         return deleteSucess;
     }
     return false;
 }
Ejemplo n.º 2
0
 public bool Insert(string accountTitle,
     Task task)
 {
     IAccountInfo accountInfo =
         Accounts.Find(acc => (acc.Title == accountTitle && acc.Provider == AccountProvider.Google));
     if (accountInfo != null)
     {
         GoogleTaskManager googleTaskManager = new GoogleTaskManager();
         task.AccountInfo = accountInfo;
         bool insertSucess = googleTaskManager.Insert(task);
         ClearErrors();
         if (!insertSucess)
         {
             Errors.Add(googleTaskManager.ErrorMessage, accountInfo);
         }
         return insertSucess;
     }
     return false;
 }
Ejemplo n.º 3
0
 private void FetchGoogleAccounts()
 {
     List<IAccountInfo> googleAccounts = Accounts.FindAll(acc => acc.Provider == AccountProvider.Google);
     foreach (IAccountInfo account in googleAccounts)
     {
         GoogleTaskManager taskManager = new GoogleTaskManager();
         List<Task> query = taskManager.Query(account);
         if (taskManager.ErrorMessage != String.Empty)
         {
             Errors.Add(taskManager.ErrorMessage, account);
             Accounts.Remove(account);
         }
         else
         {
             TaskList.AddRange(query);
         }
     }
 }