Ejemplo n.º 1
0
        internal FileSendRequestChatElement LogFileSendRequest(String message, string userName)
        {
            var chatElement = new FileSendRequestChatElement()
            {
                Message   = message,
                SpeakTime = DateTime.Now,
                UserName  = userName
            };

            Chat.Conversation.AddMessage(chatElement);
            // Fire the event
            OnNewActivity(new ChatActivity(_engagement, ChatActivity.LOG_FILE_SEND_REQUEST)
            {
                From    = _engagement.SecondParty.Party.Username,
                To      = _appContext.CurrentUserManager.CurrentUser.Username,
                Message = message
            });
            return(chatElement);
        }
Ejemplo n.º 2
0
        // Called when someone is requesting to send a file to us
        internal void ProcessIncomingFileSendRequest(string filename, string fileSendId, long fileSize)
        {
            Logger.Info(_engagement.SecondParty.Party.Username + " requests to send the file " + filename);

            var fileSendInfo = new FileSendInfo()
            {
                Filename   = filename,
                FileSendId = fileSendId,
                FileSize   = fileSize,
                Direction  = FileSendDirection.Receive,
                State      = FileSendState.PendingReceive
            };

            IsActive = true;
            _pendingFileReceives.Add(fileSendId, fileSendInfo);
            FileSendRequestChatElement chatElement = LogFileSendRequest(_engagement.SecondParty.Party.Firstname + " offered you the file " + filename + ".", _engagement.SecondParty.Party.Username);

            chatElement.AnswerHandler.AnsweredTrue  += (sender, args) => ProcessAcceptFile(fileSendInfo);
            chatElement.AnswerHandler.AnsweredFalse += (sender, args) => ProcessDenyFile(fileSendInfo);
            OnNewActivity(new FileSendActivity(_engagement, FileSendActivity.FILE_SEND_REQUEST)
            {
                To = "_SELF", From = _engagement.SecondParty.Party.Username, FileInfo = fileSendInfo
            });
        }