示例#1
0
 // Async callback on result of requesting to send a file
 private void ProcessFileSendRequestRs(FileSendRequestRq request, FileSendRequestRs res, Exception e, FileSendInfo fileInfo)
 {
     if (e != null)
     {
         Chat.LogSystemMessage("An error occured trying to send " + _engagement.SecondParty.Party.Username + " a request to send them " + fileInfo.Filename);
         Logger.Error("Failed to send file send request for " + fileInfo.Filename);
         RemovePendingFileSend(fileInfo.FileSendId);
         OnNewActivity(new FileSendActivity(_engagement, FileSendActivity.FILE_SEND_REQUEST_FAILED)
         {
             From = "_SELF", To = _engagement.SecondParty.Party.Username, FileInfo = fileInfo
         });
     }
     else
     {
     }
 }
        internal override UserToUserResponse ProcessWithEngagement(Engagement engagement, UserToUserRequest req)
        {
            FileSendRequestRq request  = (FileSendRequestRq)req;
            FileSendRequestRs response = new FileSendRequestRs();

            try
            {
                ((Function)engagement.GetFunction("FileSend")).ProcessIncomingFileSendRequest(request.filename, request.fileSendId, request.fileSize);
            }
            catch (Exception e)
            {
                Logger.Error("Failed to process incoming File Send request : " + e.Message, e);
                response.error        = "UNKNOWN_ERROR";
                response.errorMessage = "Failed to process incoming File Send request";
            }
            return(response);
        }