Esempio n. 1
0
        public void ShareToGroup(string text, long groupId, string groupName)
        {
            WallPostRequestData postData = new WallPostRequestData()
            {
                message       = text,
                AttachmentIds = new List <string>()
                {
                    this._product.ToString()
                }
            };

            if (groupId != 0L)
            {
                postData.owner_id        = -groupId;
                postData.OnBehalfOfGroup = true;
            }
            WallService.Current.Post(postData, (Action <BackendResult <VKClient.Common.Backend.DataObjects.ResponseWithId, ResultCode> >)(result => Execute.ExecuteOnUIThread((Action)(() =>
            {
                if (result.ResultCode == ResultCode.Succeeded)
                {
                    GenericInfoUC.ShowPublishResult(GenericInfoUC.PublishedObj.WallPost, groupId, groupName);
                }
                else
                {
                    new GenericInfoUC().ShowAndHideLater(CommonResources.Error, (FrameworkElement)null);
                }
            }))));
        }
 internal void Share(string text = "", long gid = 0, string groupName = "")
 {
     if (this._wallPostData == null)
     {
         return;
     }
     this._wallPostData.WallPost.reposts.user_reposted = 1;
     this.UpdateCanSomethingProperties();
     WallService.Current.Repost(this._ownerId, this._postId, text, this._wallPostData.WallPost.GetRepostObjectType(), gid, (Action <BackendResult <RepostResult, ResultCode> >)(res => Execute.ExecuteOnUIThread((Action)(() =>
     {
         if (res.ResultCode == ResultCode.Succeeded)
         {
             GenericInfoUC.ShowPublishResult(GenericInfoUC.PublishedObj.WallPost, gid, groupName);
             if (gid != 0L || this.Liked)
             {
                 return;
             }
             this.Liked = true;
             EventAggregator current = EventAggregator.Current;
             WallItemLikedUnliked itemLikedUnliked = new WallItemLikedUnliked();
             itemLikedUnliked.OwnerId = this._wallPostData.WallPost.to_id;
             itemLikedUnliked.WallPostId = this._wallPostData.WallPost.id;
             int num = 1;
             itemLikedUnliked.Liked = num != 0;
             current.Publish((object)itemLikedUnliked);
         }
         else
         {
             new GenericInfoUC().ShowAndHideLater(CommonResources.Error, null);
         }
     }))));
 }
Esempio n. 3
0
        private void publishNowMenuItem_Click(object sender, RoutedEventArgs e)
        {
            WallPostViewModel wallPostViewModel = new WallPostViewModel(this._wallPost, this.AdminLevel, (WallRepostInfo)null);

            wallPostViewModel.WMMode = WallPostViewModel.Mode.PublishWallPost;
            wallPostViewModel.IsPublishSuggestedSuppressed = true;
            IOutboundAttachment timerAttachment = wallPostViewModel.OutboundAttachments.FirstOrDefault <IOutboundAttachment>((Func <IOutboundAttachment, bool>)(a => a.AttachmentId == "timestamp"));

            if (timerAttachment != null)
            {
                wallPostViewModel.OutboundAttachments.Remove(timerAttachment);
            }
            wallPostViewModel.Publish((Action <ResultCode>)(res => Execute.ExecuteOnUIThread((Action)(() =>
            {
                if (res == ResultCode.Succeeded)
                {
                    if (this._wallPost.IsFromGroup())
                    {
                        long groupId = -this._wallPost.owner_id;
                        Group group = this._groups.FirstOrDefault <Group>((Func <Group, bool>)(g => g.id == groupId));
                        if (group == null)
                        {
                            return;
                        }
                        GenericInfoUC.ShowPublishResult(GenericInfoUC.PublishedObj.WallPost, groupId, group.name);
                    }
                    else if (this._wallPost.owner_id >= 0L)
                    {
                        GenericInfoUC.ShowPublishResult(GenericInfoUC.PublishedObj.WallPost, 0L, "");
                    }
                    else
                    {
                        long communityId = -this._wallPost.owner_id;
                        Group group = this._groups.FirstOrDefault <Group>((Func <Group, bool>)(g => g.id == communityId));
                        if (group == null)
                        {
                            return;
                        }
                        GenericInfoUC.ShowPublishResult(GenericInfoUC.PublishedObj.WallPost, communityId, group.name);
                    }
                }
                else if (res == ResultCode.PostsLimitOrAlreadyScheduled)
                {
                    if (timerAttachment != null)
                    {
                        new GenericInfoUC(2000).ShowAndHideLater(CommonResources.ScheduledForExistingTime, null);
                    }
                    else
                    {
                        new GenericInfoUC(2000).ShowAndHideLater(CommonResources.PostsLimitReached, null);
                    }
                }
                else
                {
                    new GenericInfoUC(2000).ShowAndHideLater(CommonResources.Error, null);
                }
            }))));
        }
 internal void Share(string text, long gid = 0, string groupName = "")
 {
     WallService.Current.Repost(this.Video.owner_id, this.Video.vid, text, RepostObject.video, gid, delegate(BackendResult <RepostResult, ResultCode> res)
     {
         Execute.ExecuteOnUIThread(delegate
         {
             if (res.ResultCode == ResultCode.Succeeded)
             {
                 GenericInfoUC.ShowPublishResult(GenericInfoUC.PublishedObj.Video, gid, groupName);
                 return;
             }
             new GenericInfoUC().ShowAndHideLater(CommonResources.Error, null);
         });
     });
 }
Esempio n. 5
0
 public void Share(string text, long gid = 0, string groupName = "")
 {
     if (!this._isGif)
     {
         WallService.Current.Repost(this._ownerId, this._picId, text, RepostObject.photo, gid, (Action <BackendResult <RepostResult, ResultCode> >)(res => Execute.ExecuteOnUIThread((Action)(() =>
         {
             if (res.ResultCode == ResultCode.Succeeded)
             {
                 GenericInfoUC.ShowPublishResult(GenericInfoUC.PublishedObj.Photo, gid, groupName);
             }
             else
             {
                 new GenericInfoUC().ShowAndHideLater(CommonResources.Error, (FrameworkElement)null);
             }
         }))));
     }
     else
     {
         string              str      = string.IsNullOrWhiteSpace(this._accessKey) ? string.Format("doc{0}_{1}", (object)this._ownerId, (object)this._picId) : string.Format("doc{0}_{1}_{2}", (object)this._ownerId, (object)this._picId, (object)this._accessKey);
         WallService         current  = WallService.Current;
         WallPostRequestData postData = new WallPostRequestData();
         postData.owner_id      = -gid;
         postData.message       = text;
         postData.AttachmentIds = new List <string>()
         {
             str
         };
         Action <BackendResult <ResponseWithId, ResultCode> > callback = (Action <BackendResult <ResponseWithId, ResultCode> >)(res => Execute.ExecuteOnUIThread((Action)(() =>
         {
             if (res.ResultCode == ResultCode.Succeeded)
             {
                 GenericInfoUC.ShowPublishResult(GenericInfoUC.PublishedObj.Doc, gid, groupName);
             }
             else
             {
                 new GenericInfoUC().ShowAndHideLater(CommonResources.Error, (FrameworkElement)null);
             }
         })));
         current.Post(postData, callback);
     }
 }
Esempio n. 6
0
 public void Share(string text, long gid = 0, string groupName = "")
 {
     if (!this.IsGif)
     {
         WallService.Current.Repost(this._ownerId, this._pid, text, RepostObject.photo, gid, (Action <BackendResult <RepostResult, ResultCode> >)(res => Execute.ExecuteOnUIThread((Action)(() =>
         {
             if (res.ResultCode == ResultCode.Succeeded)
             {
                 GenericInfoUC.ShowPublishResult(GenericInfoUC.PublishedObj.Photo, gid, groupName);
             }
             else
             {
                 new GenericInfoUC().ShowAndHideLater(CommonResources.Error, null);
             }
         }))));
     }
     else
     {
         WallService         current  = WallService.Current;
         WallPostRequestData postData = new WallPostRequestData();
         postData.owner_id      = gid > 0L ? -gid : AppGlobalStateManager.Current.LoggedInUserId;
         postData.message       = text;
         postData.AttachmentIds = new List <string>()
         {
             this._doc.UniqueIdForAttachment
         };
         Action <BackendResult <VKClient.Common.Backend.DataObjects.ResponseWithId, ResultCode> > callback = (Action <BackendResult <VKClient.Common.Backend.DataObjects.ResponseWithId, ResultCode> >)(res => Execute.ExecuteOnUIThread((Action)(() =>
         {
             if (res.ResultCode == ResultCode.Succeeded)
             {
                 GenericInfoUC.ShowPublishResult(GenericInfoUC.PublishedObj.Doc, gid, groupName);
             }
             else
             {
                 new GenericInfoUC().ShowAndHideLater(CommonResources.Error, null);
             }
         })));
         current.Post(postData, callback);
     }
 }
        private void Share(long groupId = 0, string groupName = "")
        {
            string message = UIStringFormatterHelper.CorrectNewLineCharacters(this._sharePostUC.Text);

            if (groupId == 0L)
            {
                if (!this.UserReposted)
                {
                    this.RepostsCount = this.RepostsCount + 1;
                    this.UserReposted = true;
                }
                if (!this.UserLikes)
                {
                    this.UserLikes  = true;
                    this.LikesCount = this.LikesCount + 1;
                }
            }
            WallService.Current.Repost(this.OwnerId, this.ItemId, message, this.RepostObjectType, groupId, (Action <BackendResult <RepostResult, ResultCode> >)(res => Execute.ExecuteOnUIThread((Action)(() =>
            {
                if (res.ResultCode == ResultCode.Succeeded)
                {
                    GenericInfoUC.ShowPublishResult(GenericInfoUC.PublishedObj.WallPost, groupId, groupName);
                    RepostResult resultData = res.ResultData;
                    if (resultData == null)
                    {
                        return;
                    }
                    this.RepostsCount = resultData.reposts_count;
                    this.LikesCount = resultData.likes_count;
                    this.UpdateLikesCommentsAndReposts();
                }
                else
                {
                    new GenericInfoUC().ShowAndHideLater(CommonResources.Error, null);
                }
            }))));
            this._sharePopup.Hide();
            this.UpdateLikesCommentsAndReposts();
        }