Ejemplo 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);
                }
            }))));
        }
Ejemplo n.º 2
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);
     }
 }
Ejemplo n.º 3
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);
     }
 }