private async static void CheckNewInvitation() { int myid = Constants.me.userid; List <GroupTask> newinvitations = await Communications.GetNewTaskInvite(myid); await Communications.ClearTaskInvite(myid); foreach (GroupTask bt in newinvitations) { FriendTask task = new FriendTask(bt); if (!Constants.displayedAlertNum.Contains(bt.taskid)) { string taskowner = Constants.Friend.getNameOf(bt.creatorid); string baseString = "Your friend {0} has invited you to join his/her task group:\n" + "{1}\n Please check your task page to see it."; string inviteString = string.Format(baseString, taskowner, task.taskname); Constants.mainPage.DisplayInvitation(inviteString); Console.WriteLine(bt.frequency); Constants.displayedAlertNum.Add(bt.taskid); } if (!Constants.FriendTasks.Exists((obj) => obj.taskid == bt.taskid)) { Constants.MyTask.Add(bt); Constants.mainPage.DisplayMyTask(bt); Constants.FriendTasks.Add(task); Constants.mainPage.DisplayFriendTask(task); } } }
internal void DisplayFriendTask(FriendTask friendTask) { //add to database FriendTasks.Children.Add(friendTask.GetView()); }