public static void Unfriend(AbstractLogger logger, INotificationQueue notificationQueue, IMixWebCallFactory mixWebCallFactory, string friendSwid, Action successCallback, Action failureCallback)
 {
     try
     {
         RemoveFriendshipRequest removeFriendshipRequest = new RemoveFriendshipRequest();
         removeFriendshipRequest.FriendUserId = friendSwid;
         RemoveFriendshipRequest request = removeFriendshipRequest;
         IWebCall <RemoveFriendshipRequest, RemoveFriendshipResponse> webCall = mixWebCallFactory.FriendshipDeletePost(request);
         webCall.OnResponse += delegate(object sender, WebCallEventArgs <RemoveFriendshipResponse> e)
         {
             RemoveFriendshipResponse     response     = e.Response;
             RemoveFriendshipNotification notification = response.Notification;
             if (NotificationValidator.Validate(notification))
             {
                 notificationQueue.Dispatch(notification, successCallback, failureCallback);
             }
             else
             {
                 logger.Critical("Failed to validate remove friendship response: " + JsonParser.ToJson(response));
                 failureCallback();
             }
         };
         webCall.OnError += delegate
         {
             failureCallback();
         };
         webCall.Execute();
     }
     catch (Exception arg)
     {
         logger.Critical("Unhandled exception: " + arg);
         failureCallback();
     }
 }
 public static bool Validate(RemoveFriendshipNotification notification)
 {
     return(Validate((BaseNotification)notification) && notification.FriendUserId != null);
 }
Beispiel #3
0
 public RemoveFriendshipNotificationEventArgs(RemoveFriendshipNotification notification)
 {
     Notification = notification;
 }
        private void Dispatch(RemoveFriendshipNotification notification)
        {
            RemoveFriendshipNotificationEventArgs e = new RemoveFriendshipNotificationEventArgs(notification);

            this.OnFriendshipRemoved(this, e);
        }