/// <summary> /// 대화창에서 파일보내기 버튼 클릭시 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void chatSendFile_Click(object sender, EventArgs e) { try { if (ChattersTree.Nodes.Count == 0) {//채팅참가자 리스트뷰에 참가자가 없다면 MessageBox.Show("파일전송을 할 대상자가 없습니다.", "알림", MessageBoxButtons.OK, MessageBoxIcon.Information); Logger.info("ChattersTree 에 파일수신 상대방 없음"); } string fileName = null; if (openFileDialog.ShowDialog(this) == DialogResult.OK) { fileName = openFileDialog.FileName; foreach (TreeNode node in ChattersTree.Nodes) { MemberObj userObj = (MemberObj)node.Tag; if (userObj.Status != MsgrUserStatus.LOGOUT) { SendFileForm sendform = new SendFileForm(connection, userObj, fileName); sendform.Show(); sendform.Activate(); } } } } catch (Exception exception) { Logger.error(exception.ToString()); } }
private void MakeSendFileForm(MemberObj userObj, string fileName)//key=id, value=name { try { SendFileForm sendform = new SendFileForm(connection, userObj, fileName); sendform.Show(); sendform.Activate(); } catch (Exception e) { Logger.error(e.ToString()); } }
private void MakeSendFileForm(List<MemberObj> userList)//key=id, value=name { try { foreach (MemberObj user in userList) { SendFileForm sendform = new SendFileForm(connection, user); sendform.Show(); sendform.Activate(); } } catch (Exception e) { Logger.error(e.ToString()); } }
private void MakeSendFileForm(List <MemberObj> userList)//key=id, value=name { try { foreach (MemberObj user in userList) { SendFileForm sendform = new SendFileForm(connection, user); sendform.Show(); sendform.Activate(); } } catch (Exception e) { Logger.error(e.ToString()); } }
private void ShowFileSelectDialog(SendFileForm sendform) { try { bool FileSelected = false; DialogResult result = openFileDialog.ShowDialog(sendform); string filename = null; if (result == DialogResult.OK) { if (openFileDialog.FileName != null || openFileDialog.FileName.Length != 0) { filename = openFileDialog.FileName; FileSelected = true; sendform.Enabled = true; } } else sendform.Enabled = true; if (FileSelected == true) { string[] filenameArray = filename.Split('\\'); if (filenameArray.Length > 2) { sendform.label_filename.Text = filenameArray[0] + "\\..\\" + filenameArray[(filenameArray.Length - 1)]; sendform.label_filename.Tag = filename; } else sendform.label_filename.Text = filename; ToolTip tip = new ToolTip(); tip.SetToolTip(sendform.label_filename, filename); FileInfo fi = new FileInfo(filename); int fsize = Convert.ToInt32(fi.Length / 1000); if (fsize.ToString().Length > 3) { fsize = fsize / 1000; sendform.label_filesize.Text = fsize + " MB (" + fi.Length.ToString() + " byte)"; } else sendform.label_filesize.Text = fsize + " Kb (" + fi.Length.ToString() + " byte)"; } } catch (Exception e) { logWrite(e.ToString()); } }
private void MakeSendFileForm(Hashtable list)//key=id, value=name { try { SendFileForm sendform = new SendFileForm(); sendform.formkey.Text = DateTime.Now.ToLongTimeString();//CHOI_DEBUG sendform.btn_start.MouseClick += new MouseEventHandler(btn_start_Click); sendform.btn_cancel.MouseClick += new MouseEventHandler(btn_cancel_Click); sendform.btn_receivers.MouseClick += new MouseEventHandler(btn_receivers_Click); sendform.label_detail.MouseClick += new MouseEventHandler(label_detail_Click); sendform.btn_selectfile.MouseClick += new MouseEventHandler(btn_selectfile_Click); ToolTip tip = new ToolTip(); tip.IsBalloon = true; tip.ToolTipIcon = ToolTipIcon.Info; tip.ToolTipTitle = "받는사람"; tip.SetToolTip(sendform.txtbox_FileReceiver, sendform.txtbox_FileReceiver.Text); FileSendFormList[sendform.formkey.Text] = sendform; bool isAll = false; if (list != null && list.Count != 0) { foreach (DictionaryEntry de in list) { if (de.Value != null) { if (((string)de.Value).Equals("all")) { sendform.txtbox_FileReceiver.Text = "상담원전체;"; isAll = true; } else sendform.txtbox_FileReceiver.Text += (string)de.Value + "(" + (string)de.Key + ");"; } if (isAll == true) break; } sendform.Show(); sendform.Activate(); } else { sendform.Show(); sendform.Activate(); } } catch (Exception e) { logWrite(e.ToString()); } }
/// <summary> /// 파일 전송 상태값 변경 /// </summary> /// <param name="stat">상태</param> /// <param name="form">대상 전송 폼</param> private void ShowFileSendStatEx(int status, string desc, int idx, SendFileForm form) { try { switch (status) { case DownloadStatus.SUCCESS: form.label_result.Text = "모든 파일 전송이 완료되었습니다."; form.btn_cancel.Text = "닫 기"; break; case DownloadStatus.FAILED: form.label_result.Text = "파일 전송이 실패되었습니다."; form.setProgress(-1); form.btn_cancel.Text = "닫 기"; break; case DownloadStatus.SENDING: form.setProgress(idx); form.label_result.Text = desc; break; case DownloadStatus.CANCELED: form.label_result.Text = "파일 전송이 취소되었습니다."; form.setProgress(-1); form.btn_cancel.Text = "닫 기"; break; } } catch (Exception exception) { logWrite(exception.ToString()); } }
/// <summary> /// 파일 전송 상태값 변경 /// </summary> /// <param name="stat">상태</param> /// <param name="form">대상 전송 폼</param> private void ShowFileSendStat(string stat, int idx, SendFileForm form) { try { if (stat.Equals("Finish")) { form.label_result.Text = "모든 파일 전송이 완료되었습니다."; form.btn_cancel.Text = "닫 기"; } else { form.setProgress(idx); form.label_result.Text = stat; } } catch (Exception exception) { logWrite(exception.ToString()); } }
private void ChangeKey(string key, SendFileForm form) { form.formkey.Text = key; }
/// <summary> /// ���� ���� ���°� ���� /// </summary> /// <param name="stat">����</param> /// <param name="form">��� ���� ��</param> private void ShowFileSendStat(string stat, SendFileForm form) { try { if (stat.Equals("Finish")) { form.label_result.Text = "��� ���� ������ �Ϸ�Ǿ����ϴ�."; form.btn_cancel.Text = "�� ��"; form.btn_start.Visible = false; } else form.label_result.Text = stat; } catch (Exception exception) { logWrite(exception.ToString()); } }