private void OnSend(object sender, EventArgs e) { ToggleSendButtons(false); SaveConfig(); CStoreClient scu = new CStoreClient(); scu.DisableFileStreaming = true; scu.CallingAE = Config.LocalAE; scu.CalledAE = Config.RemoteAE; scu.MaxPduSize = Config.MaxPdu; scu.ConnectTimeout = 0; scu.SocketTimeout = Config.Timeout; scu.DimseTimeout = Config.Timeout; scu.SerializedPresentationContexts = true; scu.PreferredTransferSyntax = TransferSyntaxes[Config.TransferSyntax]; //if (scu.PreferredTransferSyntax == DicomTransferSyntax.JPEGProcess1 || // scu.PreferredTransferSyntax == DicomTransferSyntax.JPEGProcess2_4) { // DcmJpegParameters param = new DcmJpegParameters(); // param.Quality = Config.Quality; // scu.PreferredTransferSyntaxParams = param; //} //else if (scu.PreferredTransferSyntax == DicomTransferSyntax.JPEG2000Lossy) { // DcmJpeg2000Parameters param = new DcmJpeg2000Parameters(); // param.Rate = Config.Quality; // scu.PreferredTransferSyntaxParams = param; //} scu.OnCStoreResponseReceived = delegate(CStoreClient client, CStoreRequestInfo info) { Invoke(new CStoreRequestCallback(UpdateSendInfo), client, info); }; foreach (ListViewItem lvi in lvSendImages.Items) { lvi.ImageIndex = 0; lvi.SubItems[3].Text = "Pending"; CStoreRequestInfo info = (CStoreRequestInfo)lvi.Tag; scu.AddFile(info); } ThreadPool.QueueUserWorkItem(new WaitCallback(RunDicomSend), scu); }
private void UpdateSendInfo(CStoreClient client, CStoreRequestInfo info) { ListViewItem lvi = (ListViewItem)info.UserState; lvi.ImageIndex = (info.Status == DcmStatus.Success) ? 1 : 2; lvi.SubItems[3].Text = info.Status.Description; lvSendImages.EnsureVisible(lvi.Index); }
private void OnSendAddImage(object sender, EventArgs e) { OpenFileDialog fd = new OpenFileDialog(); fd.Multiselect = true; if (fd.ShowDialog(this) == DialogResult.OK) { foreach (string filename in fd.FileNames) { try { CStoreRequestInfo info = new CStoreRequestInfo(filename); ListViewItem item = new ListViewItem(filename, 0); item.SubItems.Add(info.SOPClassUID.Description); item.SubItems.Add(info.TransferSyntax.UID.Description); item.SubItems.Add(info.Status.Description); item.Tag = info; info.UserState = item; lvSendImages.Items.Add(item); } catch { } } } }