コード例 #1
0
ファイル: ChatWindow.cs プロジェクト: biddyweb/communicator
 public void ProcessFileDownload(String jabberID, String filename, String fileTransferID)
 {
     FileTransfer fileDownload = new FileTransfer();
     fileDownload.DownloadCompleted += new EventHandler(fileDownload_DownloadCompleted);
     fileDownload.DownloadProgressChanged += new EventHandler(fileDownload_DownloadProgressChanged);
     SharedFile fileDownloadInfo = fileDownload.Download(filename, myClientForm.mUserAccount.Username, myClientForm.mUserAccount.Password, jabberID, fileTransferID);
 }
コード例 #2
0
ファイル: ChatWindow.cs プロジェクト: biddyweb/communicator
        private void InitializeFileTransfer(string toJID, string file)
        {
            if (!File.Exists(file)) return;
            try
            {
                String ID = Guid.NewGuid().ToString();
                //PROCESS UPLOAD
                FileInfo fileInfo = new FileInfo(file);
                FileTransfer fileUpload = new FileTransfer();
                fileUpload.UploadCompleted += new EventHandler(fileTransfer_UploadCompleted);
                fileUpload.UploadProgressChanged += new EventHandler(fileUpload_UploadProgressChanged);
                SharedFile fileUploadInfo = fileUpload.Upload(file, myClientForm.mUserAccount.Username, myClientForm.mUserAccount.Password, toJID, ID);
                fileUploadInfo.Size = fileInfo.Length;
                myClientForm.FileTransferInvite(new JabberUser(fileUploadInfo.ToJID), fileUploadInfo.FileName, fileUploadInfo.ID, FileTransfer.FormatFileSize(fileUploadInfo.Size));
            }
            catch (Exception)
            {
#if (DEBUG)
                throw;
#endif
            }
        }
コード例 #3
0
 void fileTransfer_UploadCompleted(object sender, EventArgs e)
 {
     FileTransfer.SharedFile sharedFile = (FileTransfer.SharedFile)sender;
     if (sharedFile.LocalFileName != null)
     {
         myClientForm.FileTransferProcessDone(sharedFile.ToJID, sharedFile.FileName, sharedFile.ID, FileTransfer.FormatFileSize(sharedFile.Size));
     }
 }
コード例 #4
0
ファイル: ChatWindow.cs プロジェクト: biddyweb/communicator
        void toolStripSendFile_Click(object sender, EventArgs e)
        {
            ChatSession tmplChatSession = (ChatSession)myChatSessions[myChatSessionsTabControl.SelectedTab.Tag];
            if (tmplChatSession != null)
            {
                if (DialogResult.OK == myOpenFileDialog.ShowDialog())
                {
                    if (myOpenFileDialog.FileName != null && File.Exists(myOpenFileDialog.FileName))
                    {
                        String ID = Guid.NewGuid().ToString();
                        //PROCESS UPLOAD
                        FileInfo fileInfo = new FileInfo(myOpenFileDialog.FileName);
                        FileTransfer fileUpload = new FileTransfer();
                        fileUpload.UploadCompleted += new EventHandler(fileTransfer_UploadCompleted);
                        FileTransfer.SharedFile fileUploadInfo = fileUpload.Upload(myOpenFileDialog.FileName, myClientForm.mUserAccount.Username, myClientForm.mUserAccount.Password, tmplChatSession.JabberUser.JID, ID);
                        fileUploadInfo.Size = fileInfo.Length;
                        myClientForm.FileTransferInvite(new JabberUser(fileUploadInfo.ToJID), fileUploadInfo.FileName, fileUploadInfo.ID, FileTransfer.FormatFileSize(fileUploadInfo.Size));

                    }
                }
            }
        }
コード例 #5
0
        void toolStripSendFile_Click(object sender, EventArgs e)
        {
            ChatSession tmplChatSession = (ChatSession)myChatSessions[myChatSessionsTabControl.SelectedTab.Tag];

            if (tmplChatSession != null)
            {
                if (DialogResult.OK == myOpenFileDialog.ShowDialog())
                {
                    if (myOpenFileDialog.FileName != null && File.Exists(myOpenFileDialog.FileName))
                    {
                        String ID = Guid.NewGuid().ToString();
                        //PROCESS UPLOAD
                        FileInfo     fileInfo   = new FileInfo(myOpenFileDialog.FileName);
                        FileTransfer fileUpload = new FileTransfer();
                        fileUpload.UploadCompleted += new EventHandler(fileTransfer_UploadCompleted);
                        FileTransfer.SharedFile fileUploadInfo = fileUpload.Upload(myOpenFileDialog.FileName, myClientForm.mUserAccount.Username, myClientForm.mUserAccount.Password, tmplChatSession.JabberUser.JID, ID);
                        fileUploadInfo.Size = fileInfo.Length;
                        myClientForm.FileTransferInvite(new JabberUser(fileUploadInfo.ToJID), fileUploadInfo.FileName, fileUploadInfo.ID, FileTransfer.FormatFileSize(fileUploadInfo.Size));
                    }
                }
            }
        }