Пример #1
0
        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
            }
        }
Пример #2
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));
                    }
                }
            }
        }
Пример #3
0
        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
            }
        }
Пример #4
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));

                    }
                }
            }
        }