コード例 #1
0
        private void SupportPost(Entity.PostFeed SelectedPost)
        {
            var updatedSelectedPost = _postFeedManager.GetPostFeed(SelectedPost.PostFeedID);

            if (ProcessInternetConnection(true))
            {
                PostFeedMessage postFeedMessage = new PostFeedMessage
                {
                    CurrentPost = AppUnityContainer.Instance.Resolve <IServiceMapper>().Instance.Map <Contract.PostFeedK>(updatedSelectedPost),
                    CurrentUser = AppUnityContainer.Instance.Resolve <IServiceMapper>().Instance.Map <Contract.ContactK>(CurrentContact)
                };

                MessagingCenter.Send(postFeedMessage, "LikeOrUnlikePostFeedToHub");
                SelectedPost.IsSelfSupported = !SelectedPost.IsSelfSupported;
                var updatePostFeed = _postFeedManager.UpdatePostFeedAndPostFeedLikeToLocal(updatedSelectedPost, CurrentContact);

                if (CurrentPostFeed.Equals(updatedSelectedPost))
                {
                    CurrentPostFeed = updatePostFeed;
                }
                else
                {
                    SelectedComment = updatePostFeed;
                }
            }
        }
コード例 #2
0
        private void SupportPost()
        {
            var updatedSelectedPost = _postFeedManager.GetPostFeed(CurrentPostFeed.PostFeedID);

            if (ProcessInternetConnection(true))
            {
                PostFeedMessage postFeedMessage = new PostFeedMessage
                {
                    CurrentPost = AppUnityContainer.Instance.Resolve <IServiceMapper>().Instance.Map <Contract.PostFeedK>(updatedSelectedPost),
                    CurrentUser = AppUnityContainer.Instance.Resolve <IServiceMapper>().Instance.Map <Contract.ContactK>(CurrentContact)
                };
                _eventAggregator.GetEvent <LikeOrUnlikePostFeedToHubEventModel>().Publish(postFeedMessage);
                CurrentPostFeed.IsSelfSupported = !CurrentPostFeed.IsSelfSupported;
                RaisePropertyChanged(nameof(CurrentPostFeed.IsSelfSupported));
                var updatePostFeed = _postFeedManager.UpdatePostFeedAndPostFeedLikeToLocal(updatedSelectedPost, CurrentContact);

                if (CurrentPostFeed.Equals(updatedSelectedPost))
                {
                    CurrentPostFeed = updatePostFeed;
                }
                else
                {
                    SelectedComment = updatePostFeed;
                }
            }
        }