/// <summary> /// 복사 진행 쓰레드 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { try { BackgroundWorker worker = sender as BackgroundWorker; CopyWorker cls = e.Argument as CopyWorker; e.Result = 0; cls.ExecJob(worker, e); } catch (Exception ex) { this.isCopying = false; this.txtProgressView.Text = ex.ToString(); ErrorLog.LogWrite(this, ex.ToString(), Application.StartupPath); } }
/// <summary> /// 복사 시작 /// </summary> private void CopyStart() { if (this.seletedUSB == null) { return; } if (this.isCopying) { MessageBox.Show("지금 복사가 진행되고 있습니다.\r\n복사가 완료된 후 다시 시도해 주세요.", "Rimage Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (!this.seletedUSB.IsReady) { //// 드라이버가 준비되지 않았을 경우 MessageBox.Show("준비된 USB 드라이버가 없습니다.\r\n컴퓨터에 제대로 연결되었는지 체크해주세요.", "Rimage Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.ExistsUSBData()) { //// 다른데이터가 존재할 경우 MessageBox.Show("USB 드라이버에 다른 데이터가 존재합니다.\r\n체크 후 다시 시도해주세요.", "Rimage Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (!this.CheckAvailableSpace()) { //// 공간이 안될 경우 MessageBox.Show("USB 공간이 복사하려는 환자정보의 크기보다 작습니다.\r\n체크 후 다시 시도해주세요.", "Rimage Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } DirectoryInfo dirInfo = new DirectoryInfo(this.OrderInfo.patFolderFullPath); try { if (dirInfo.Exists) { this.txtProgressView.AppendText(String.Format("{0}\\ 로 복사를 시작합니다.\r\n", this.seletedUSB.Name)); this.progressBarControl1.Properties.Maximum = this._orderInfo.ImgFiles.EditList.Count; this.Cursor = Cursors.WaitCursor; if (this.backgroundWorker1.IsBusy == false) { CopyWorker cls = new CopyWorker(); cls.srcDir = dirInfo; cls.targetDrive = this.seletedUSB; this.isCopying = true; this._mainForm.ClearSendUSBPatInfo(this._orderInfo.patFolderFullPath); this._mainForm.AddBurningList(this._orderInfo); //// 시작시 로그 저장 WebUtils.InsertResult(this._orderInfo.OrderId, this._orderInfo.StartDateTime, "", this._orderInfo.patNo, this._orderInfo.patName, this._orderInfo.copies.ToString(), "USB", this._orderInfo.mediSize, "?", ((this._orderInfo.BurnPatientKind.Equals("Y") || this._orderInfo.patList.Count > 1) ? this._orderInfo.DicomDescription : this._orderInfo.StudyModality), Utils.CheckNull(this._orderInfo.BurnPatientKind, "N"), this._orderInfo.TargetServer.IP, NetInfo.MyIP()); this.btnReFind.Enabled = false; this.btnStartCopy.Enabled = false; this.backgroundWorker1.RunWorkerAsync(cls); } else { this.Cursor = Cursors.Default; MessageBox.Show("파일복사가 진행되고 있습니다. 잠시 후 다시 시도하세요.", "Rimage Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { this.Cursor = Cursors.Default; MessageBox.Show("환자폴더가 존재하지 않습니다.\r\n확인 후 다시 시도해주세요.", "Rimage Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { this.Cursor = Cursors.Default; this.isCopying = false; MessageBox.Show("복사 시작 중 에러가 발생했습니다.\r\n" + ex.Message, "Rimage Message : burnCDAfterCopyFiles", MessageBoxButtons.OK, MessageBoxIcon.Error); this.btnReFind.Enabled = true; this.btnStartCopy.Enabled = true; } }