/// <summary> /// 다른 사용자(들)에게 파일 전송 준비 /// </summary> /// <param name="list">파일 전송 대상자 목록</param> /// <param name="filename">파일명</param> /// <param name="timekey">파일전송시간(여러 파일전송작업 간 구분키가 됨)</param> public bool NotifyFileSend(List <MemberObj> receiverList, string fileName, string formKey) { bool result = false; try { FileInfo fi = new FileInfo(fileName); long fileSize = fi.Length; //파일 정보 보내기(F|파일명|파일크기|파일key|전송자id) foreach (MemberObj receiver in receiverList) { if (Members.ContainLoginUserNode(receiver.Id)) //전송대상자가 로그인 상태인 경우 { //msgClient.NotifyFTPStart(new IPEndPoint(Utils.getIPfromHost(mHostName), SocConst.FTP_PORT), MsgDef.FTP_ON_SERVER, mFullFileName, mFileSize); this.SendMsgNotifyFileInfo(fileName, fileSize, formKey, receiver.Id); SendFileForms.AddClientKey(fileName, fileSize, receiver.Id, formKey); } else { //전송대상자가 로그아웃 상태인 경우 } } result = true; } catch (Exception exception) { Logger.error(exception.ToString()); } return(result); }
/// <summary> /// 파일전송 진행보이기 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void DisplayOnFTPSendingProgressed(object sender, FTPStatusEventArgs e) { try { if (SendFileForms.ContainClientKey(this, e.Status.Key)) { setProgress(e.ProgressIndex); label_result.Text = e.Msg; } } catch (Exception exception) { Logger.error(exception.ToString()); } }
/// <summary> /// 파일전송 완료 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void DisplayOnFTPSendingFinished(object sender, FTPStatusEventArgs e) { try { if (SendFileForms.ContainClientKey(this, e.Status.Key)) { label_result.Text = "파일 전송이 완료되었습니다."; ButtonCancel.Text = "닫 기"; ButtonCancel.Click -= CancelOnButtonCancelClicked; } } catch (Exception exception) { Logger.error(exception.ToString()); } }
/// <summary> /// FTP 전송자: 전송진행시 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ProcessOnFTPSendingProgressed(object sender, FTPStatusEventArgs e) { try { if (SendFileForms.ContainClientKey(e.Status.Key)) { OnFTPSendingProgressed(e); } else { Logger.info(string.Format("에러 : SendFileForms 해당화면없음.Status.Key[{0}]", e.Status.Key)); } } catch (Exception ex) { Logger.error(ex.ToString()); } }
/// <summary> /// FTP 전송자: 파일전송 승락이벤트받음 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ProcessOnFTPSendingAccepted(object sender, SocFTPInfoEventArgs <FTPSendObj> e) { try { if (SendFileForms.ContainClientKey(this, e.GetObj.Key)) { Logger.info(string.Format("ProcessOnFTPSendingAccepted : 파일수신승락 파일[{0}]수신자[{1}]", e.GetObj.FileName, e.GetObj.ReceiverId)); setProgress(0); label_result.Text = "전송 시작"; ButtonCancel.Click += CancelOnButtonCancelClicked; sendFileTimer.Stop(); } } catch (Exception exception) { Logger.error(exception.ToString()); } }
private void _StartFileSending() { try { Logger.info("파일전송시작"); ButtonFTPStart.Visible = false; ButtonCancel.Left += 40; label_result.Text = "전송 대기중"; //전송 상태 자세히 보기 생성 connection.SendMsgNotifyFileInfo(sendObj.FileName, sendObj.FileSize, this.formKey, sendObj.ReceiverId); SendFileForms.AddClientKey(sendObj.FileName, sendObj.FileSize, sendObj.ReceiverId, this.formKey); sendFileTimer.Start(); } catch (Exception exception) { Logger.error(exception.ToString()); } }
private void FileSendDetailListView_FormClosing(object sender, FormClosingEventArgs e) { try { if (SendFileForms.Contain(this.formKey)) { e.Cancel = true; Hide(); } else { FileSendDetailListViews.RemoveForm(this.formKey); } } catch (Exception exception) { Logger.error(exception.ToString()); } }
/// <summary> /// FTP 전송자: 파일전송 승락이벤트받음 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ProcessOnFTPSendingAccepted(object sender, SocFTPInfoEventArgs <FTPSendObj> e) { //수신준비된것이 확인됨.==> 상위에서 이미 FTP기동 try { if (SendFileForms.ContainClientKey(e.GetObj.Key)) { OnFTPSendingAccepted(e); } else { Logger.info(string.Format("에러 : SendFileForms 해당화면없음.Status.Key[{0}]", e.GetObj.Key)); } } catch (Exception ex) { Logger.error(ex.ToString()); } }
/// <summary> /// 열린 창 닫기 /// 로그아웃 전에 열린 폼 닫기 및 정보테이블 삭제 /// </summary> public void DisposeFormsOnLogOut() { //자원해제 대상 try { if (noticelistform != null && !noticelistform.IsDisposed) { noticelistform.Close(); noticelistform.Dispose(); } if (noticeresultform != null && !noticeresultform.IsDisposed) { noticeresultform.Close(); noticeresultform.Dispose(); } if (noreceiveboardform != null && !noreceiveboardform.IsDisposed) { noreceiveboardform.Close(); noreceiveboardform.Dispose(); } if (mMemoListForm != null && !mMemoListForm.IsDisposed) { mMemoListForm.Close(); mMemoListForm.Dispose(); } ChatForms.Dispose(); SendMemoForms.Dispose(); Members.ClearAll(); FileSendDetailListViews.Dispose(); SendFileForms.Dispose(); DownloadForms.Dispose(); NoticeDetailForms.Dispose(); MemoForms.Dispose(); } catch (Exception e) { Logger.error(e.ToString()); } }
/// <summary> /// FTP 전송자: 파일전송 거부이벤트받음 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ProcessOnFTPSendingRejected(object sender, SocFTPInfoEventArgs <FTPSendObj> e) { try { if (SendFileForms.ContainClientKey(this, e.GetObj.Key)) { Logger.info(string.Format("ProcessOnFTPSendingRejected : 파일수신거부 파일[{0}]수신자[{1}]", e.GetObj.FileName, e.GetObj.ReceiverId)); MessageBox.Show(this, string.Format("{0}님이 파일받기를 거부하셨습니다.", Members.GetByUserId(e.GetObj.ReceiverId).Name) + Environment.NewLine + string.Format("전송 파일명:{0}", e.GetObj.FileName), "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); label_result.Text = "파일수신거부"; sendFileTimer.Stop(); Close(); } } catch (Exception exception) { Logger.error(exception.ToString()); } }
private void SendFileForm_FormClosed(object sender, FormClosedEventArgs e) { try { if (SendFileForms.Contain(this.formKey)) { SendFileForms.RemoveForm(this.formKey); Logger.info("SendFileForms.Remove(key) :" + this.formKey); } connection.FTPSendingProgressed -= DisplayOnFTPSendingProgressed; connection.FTPSendingFinished -= DisplayOnFTPSendingFinished; connection.FTPSendingCanceled -= DisplayOnFTPSendingCanceled; connection.FTPSendingFailed -= DisplayOnFTPSendingFailed; connection.FTPSendingAccepted -= ProcessOnFTPSendingAccepted; connection.FTPSendingRejected -= ProcessOnFTPSendingRejected; } catch (Exception ex) { Logger.error(ex.ToString()); } }
private void Initialize() { ToolTip tip = new ToolTip(); tip.IsBalloon = true; tip.ToolTipIcon = ToolTipIcon.Info; tip.ToolTipTitle = "받는사람"; tip.SetToolTip(txtbox_FileReceiver, txtbox_FileReceiver.Text); ButtonFTPStart.Enabled = false; txtbox_FileReceiver.Text += receiverObj.Name + "(" + receiverObj.Id + ");"; connection.FTPSendingProgressed += DisplayOnFTPSendingProgressed; connection.FTPSendingFinished += DisplayOnFTPSendingFinished; connection.FTPSendingCanceled += DisplayOnFTPSendingCanceled; connection.FTPSendingFailed += DisplayOnFTPSendingFailed; connection.FTPSendingAccepted += ProcessOnFTPSendingAccepted; connection.FTPSendingRejected += ProcessOnFTPSendingRejected; sendFileTimer.Tick += new EventHandler(CheckSendFileTimeOutOnTick); sendFileTimer.Interval = 30000; //30초 경과후 타임아웃처리 SendFileForms.AddForm(formKey, this); }