Beispiel #1
0
        private async void CheckUnreadFollowsMethod()
        {
            if (null == _notify)
            {
                return;
            }

            FollowsVisible = Visibility.Collapsed;

            var result = await _notify.CheckFollowsAsync(LoginUser.Current.Token, "notifications/unread_follows", true);

            ContentsLoading = false;

            if (result == null)
            {
                return;
            }

            if (result.Error != null)
            {
                ToasteIndicator.Instance.Show(String.Empty, result.Error.Message, null, 3);

                Debug.WriteLine(Regex.Unescape(result.Error.Message));

                return;
            }

            Follows.Clear();
            foreach (var item in result.Result.GetItems().Select(item => item as NotifyItem))
            {
                Follows.Add(item);
            }

            FollowsVisible = Follows.Count > 0 ? Visibility.Visible : Visibility.Collapsed;
        }
Beispiel #2
0
        public void Delete()
        {
            ICollection <Post> temp  = AuthorPosts;
            List <Post>        temp2 = new List <Post>();

            // Supprime les posts du membre
            foreach (Post post in AuthorPosts)
            {
                if (post.IsParent)
                {
                    temp2.AddRange(post.Thread.Posts);
                    post.Delete();
                }
            }
            Model.Posts.RemoveRange(temp);
            Model.Posts.RemoveRange(temp2);
            AuthorPosts.Clear();
            if (Role == Role.Professor)
            {
                List <Course> temp3 = new List <Course>();
                foreach (Course course in Model.Courses)
                { // Supprime le professeur du cours
                    if (course.Professor.Equals(this))
                    {
                        temp3.Add(course);
                        course.Delete();
                    }
                }
                Model.Courses.RemoveRange(temp3);
            }
            Follows.Clear();
            Model.Subscriptions.RemoveRange(this.Subscription);
            foreach (Competition compet in Model.Competitions)
            { // Supprime le membre dans les competitions
                if (compet.Participants.Contains(this))
                {
                    compet.Participants.Remove(this);
                }
            }
            // Supprime le membre lui-même
            Model.Members.Remove(this);
        }