예제 #1
0
        internal void UpdateBookmark(string uid, LiveMeUser liveMeUser)
        {
            using (var db = _dbContextFactory.CreateApplicationDbContext())
            {
                var bookmark = db.Bookmarks.Find(uid);
                bookmark.ReplayCount    = liveMeUser.CountInfo.VideoCount;
                bookmark.FollowerCount  = liveMeUser.CountInfo.FollowerCount;
                bookmark.FollowingCount = liveMeUser.CountInfo.FollowingCount;
                bookmark.LastUpdated    = DateTime.UtcNow;
                try
                {
                    bookmark.Signature = liveMeUser.UserInfo.usign;
                    bookmark.Face      = liveMeUser.UserInfo.face;
                    bookmark.Nickname  = liveMeUser.UserInfo.uname;
                    bookmark.Shortid   = long.Parse(liveMeUser.UserInfo.short_id);
                }
                catch (Exception)
                {
                    // ignore exception if something went wrong in updting the above UserInfo,
                    // because this is not that important and should not break the scan.
                }

                db.SaveChanges();
            }
        }
예제 #2
0
        public void AddToBookmark(LiveMeUser user)
        {
            var info = user.UserInfo;

            using (var db = _dbContextFactory.CreateApplicationDbContext())
            {
                var found = db.Bookmarks.Find(info.uid);
                if (found != null)
                {
                    found.Deleted = false;
                }
                else
                {
                    db.Bookmarks.Add(new Bookmark
                    {
                        Uid            = info.uid,
                        Face           = info.face,
                        Gender         = info.sex == "male" ? Gender.Male : Gender.Female,
                        Nickname       = info.uname,
                        Shortid        = Convert.ToInt64(info.short_id),
                        Signature      = info.usign,
                        ReplayCount    = user.CountInfo.ReplayCount,
                        FollowerCount  = user.CountInfo.FollowerCount,
                        FollowingCount = user.CountInfo.FollowingCount
                    });
                }


                db.SaveChanges();
            }
        }
예제 #3
0
        public async Task Load(ListWindowPageType pageType)
        {
            PageType = pageType;
            OfUser   = await _livemeApiProvider
                       .GetUserInfo(UserId, CancellationToken.None)
                       .ConfigureAwait(true);

            NofifyChanged();

            await LoadMore().ConfigureAwait(true);
        }
예제 #4
0
        public void ToggleBookmark(LiveMeUser user)
        {
            var uid = user.UserInfo.uid;

            if (IsBookmarked(uid))
            {
                RemoveBookmark(uid);
            }
            else
            {
                AddToBookmark(user);
            }
        }
예제 #5
0
 public void AddToBookmark(LiveMeUser user)
 {
     _dataAccess.AddToBookmark(user);
 }