public void Share(string statusId) { this.Init(); var share = new Share { TimeShared = DateTime.Now, StatusId = statusId, UserId = this._curUserChat.UserId }; this._shareRepository.AddShare(share); var message = this._statusMessageRepository.GetMessageByStatusId(statusId); var messageProcessed = ProcessMessage.ProcessMessageStatus(statusId, this._curUserChat, message, null); var newFeedId = SequentialGuid.Create(); NewFeeds newfeed = new NewFeeds { UserId = this._curUserChat.UserId, NewFeedId = newFeedId, TypeActionId = TypeAction.SHARE, StatusId_Or_UserId = statusId }; this._newFeedRepository.AddNewFeed(newfeed); var ownerStatus = this._statusRepository.GetShortStatusByStatusId(statusId); Clients.Clients(this._allUserRelate_ConnectionId).share(this._curUserChat.Displayname, messageProcessed); Clients.Clients(this._friendListConnectionId_Online).likeNewFeeds(this._curUserChat, statusId, ownerStatus.UserOwner.Displayname); }
public void Like(string statusId) { this.Init(); var like = new Like { TimeLiked = DateTime.Now, StatusId = statusId, UserId = this._curUserChat.UserId }; this._likeRepository.Like(like); var newFeedId = SequentialGuid.Create(); NewFeeds newfeed = new NewFeeds { UserId = this._curUserChat.UserId, NewFeedId = newFeedId, TypeActionId = TypeAction.LIKE, StatusId_Or_UserId = statusId }; this._newFeedRepository.AddNewFeed(newfeed); var ownerStatus = this._statusRepository.GetShortStatusByStatusId(statusId); Clients.Clients(this._allUserRelate_ConnectionId).like(this._curUserChat.Displayname, statusId); Clients.Clients(this._friendListConnectionId_Online).likeNewFeeds(this._curUserChat, statusId, ownerStatus.UserOwner.Displayname); }
public void Comment(string statusId, string cmtMessage) { this.Init(); var commentId = SequentialGuid.Create(); var comment = new DemoSignalRChat.Models.Comment { CommentId = commentId, Content = cmtMessage, StatusId = statusId, UserId = this._curUserChat.UserId, TimeComment = DateTime.Now }; this._commentRepository.AddComment(comment); var newFeedId = SequentialGuid.Create(); NewFeeds newfeed = new NewFeeds { UserId = this._curUserChat.UserId, NewFeedId = newFeedId, TypeActionId = TypeAction.COMMENT, StatusId_Or_UserId = commentId }; this._newFeedRepository.AddNewFeed(newfeed); string commentDisplay = ProcessComment.ProcessNewComment(this._curUserChat, cmtMessage); Clients.Clients(this._allUserRelate_ConnectionId).comment(this._curUserChat.Displayname, statusId, commentDisplay); }
/// <summary> /// 移除订阅源 /// </summary> void RemoveFeed() { Messenger.Default.Send <NotificationMessageWithCallback>(new NotificationMessageWithCallback("确定删除订阅源\"" + CurrentFeed.Name + "\"吗?", (Action)(async() => { if (NewFeeds.Contains(CurrentFeed)) { NewFeeds.Remove(CurrentFeed); await NewFeeds.SaveAsync(); } })), "ShowUserCheckedForm"); }
/// <summary> /// 确定添加订阅源 /// </summary> async void ConfirmAdd() { try { NewFeeds.Add(CurrentFeed); await CurrentFeed.RefreshAsync(); await NewFeeds.SaveAsync(); Messenger.Default.Send <NotificationMessage>(new NotificationMessage("成功添加"), "AddSuccess"); } catch (Exception ex) { } }
/// <summary> /// 数据初始化 /// </summary> async void Init() { FavoritesFeed = await FeedDataHandler.GetFavoritesAsync() ?? FavoritesFeed; if (string.IsNullOrWhiteSpace(FavoritesFeed.Name)) { FavoritesFeed.Name = "收藏"; } if (FavoritesFeed.Articles == null) { FavoritesFeed.Articles = new ObservableCollection <ArticleViewModel>(); } NewFeeds.CollectionChanged += NewFeeds_CollectionChanged; NewFeeds.Clear(); FeedDataHandler.GetFeedsAsync().ForEach(feed => NewFeeds.Add(feed)); FavoritesFeed.Articles.CollectionChanged += Articles_CollectionChanged; }
public void PostStatus(string message, string location) { this.Init(); var statusId = SequentialGuid.Create(); Status status = new Status { StatusId = statusId, UserId = this._curUserChat.UserId }; this._statusRepository.AddStatus(status); this._statusMessageRepository.AddMessage(new StatusMessage { StatusId = statusId, Message = message }); if (!string.IsNullOrEmpty(location)) { this._statusLocationRepository.AddLocation(statusId, location); } var newFeedId = SequentialGuid.Create(); NewFeeds newfeed = new NewFeeds { UserId = this._curUserChat.UserId, NewFeedId = newFeedId, TypeActionId = TypeAction.POST_STATUS, StatusId_Or_UserId = statusId }; this._newFeedRepository.AddNewFeed(newfeed); message = ProcessMessage.ProcessMessageStatus(statusId, this._curUserChat, message, null); Clients.Clients(this._allUserRelate_ConnectionId).postCastStatus(this._curUserChat.Displayname, message); Clients.Clients(this._friendListConnectionId_Online).statusNewFeeds(this._curUserChat); }
public void AddNewFeed(NewFeeds newFeed) { this._db.NewFeeds.Add(newFeed); this.Save(); }