예제 #1
0
        private async void miUpdateVersion_Click(object sender, EventArgs e)
        {
            BeginLoading("Checking for updates");
            UpdateHelper.UpdateCheckResult result = await Configs.Instance.UpdateHelper.CheckForUpdates();

            switch (result)
            {
            case UpdateHelper.UpdateCheckResult.NoUpdates:
                EndLoading("");
                TaskDialogHelper.ShowMessageBox(
                    Handle,
                    "No Updates",
                    $"You are using the most recent version of the {APP_TITLE}.",
                    null,
                    TaskDialogStandardIcon.Information
                    );
                break;

            case UpdateHelper.UpdateCheckResult.UpdateFound:
                EndLoading("");
                UpdateFound(Configs.Instance.UpdateHelper);
                break;

            case UpdateHelper.UpdateCheckResult.Failure:
                EndLoading("Failed to check for updates.");
                TaskDialogHelper.ShowMessageBox(
                    Handle,
                    "Failure",
                    "Unable to check for updates.",
                    null,
                    TaskDialogStandardIcon.Error
                    );
                break;
            }
        }
예제 #2
0
        private void HandleMappingLoadingException(Exception e, string filename)
        {
            this.SetTaskbarProgressValue(100, 100);
            this.SetTaskbarProgressState(Taskbar.ThumbnailProgressState.Error);

            if (e is NanoXmlParsingException ||
                e is ObfuscarParserException ||
                e is IOException)
            {
                TaskDialogHelper.ShowMessageBox(
                    Handle,
                    "Mapping Loading Failed",
                    "Loading of mapping file is failed.",
                    "File:\n" + filename + "\nReason: " + e.Message,
                    TaskDialogStandardIcon.Error
                    );
            }
            else
            {
                RestApi.Instance.SendCrashReport(
                    new CrashReport("Mapping loading thread failed handler", "Error on loading document", CrashType.JustReport)
                {
                    Exception = e
                },
                    this
                    );
            }
        }
예제 #3
0
        private void SearchButton_Click(object sender, EventArgs e)
        {
            Patient patient = DicomUtils.FindPatient(this, _find, _scp, textBoxId.Text);

            if (patient != null)
            {
                textBoxLastname.Text      = patient.Name.Family;
                textBoxFirstname.Text     = patient.Name.Given;
                comboBoxSex.SelectedIndex = comboBoxSex.FindStringExact(patient.Sex);
                if (patient.BirthDate.HasValue)
                {
                    dateTimePickerBirth.Value   = patient.BirthDate.Value;
                    dateTimePickerBirth.Checked = true;
                }

                if (Program.OtherPID.ContainsKey(patient.Id))
                {
                    textBoxOtherPid.Text = Program.OtherPID[patient.Id];
                }
                else
                {
                    OtherPatientIds.Text = string.Empty;
                    textBoxOtherPid.Text = string.Empty;
                }
            }
            else
            {
                TaskDialogHelper.ShowMessageBox(this, "Patient Search", "Patient with specified id was not found.", string.Empty,
                                                string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                null);
            }
            ActionButton.Enabled = patient != null;
        }
예제 #4
0
        private void MoveSeries()
        {
            ReasonDialog dlgReason = new ReasonDialog("Input Reason For Moving Series");

            if (dlgReason.ShowDialog(this) == DialogResult.OK)
            {
                MoveSeries             move     = new MoveSeries();
                DicomCommandStatusType status   = DicomCommandStatusType.Success;
                ProgressDialog         progress = new ProgressDialog();

                move.PatientId = textBoxId.Text.Replace(@"\", @"\\").Replace("'", @"''");
                move.PatientToMerge.Add(new MergePatientSequence(_Patient.Id));
                move.SeriesInstanceUID = _Series.InstanceUID;
                move.Reason            = dlgReason.Reason;
                move.Operator          = Environment.UserName != string.Empty ? Environment.UserName : Environment.MachineName;
                move.Description       = "Move Series";

                Thread thread = new Thread(() =>
                {
                    try
                    {
                        status = _naction.SendNActionRequest <MoveSeries>(_scp, move, NActionScu.MoveSeries,
                                                                          NActionScu.PatientUpdateInstance);
                    }
                    catch (Exception e)
                    {
                        ApplicationUtils.ShowException(this, e);
                        status = DicomCommandStatusType.Failure;
                    }
                });

                progress.ActionThread = thread;
                progress.Title        = "Moving Series";
                progress.ProgressInfo = "Performing series move to patient: " + textBoxFirstname.Text + " " + textBoxLastname.Text + ".";
                progress.ShowDialog(this);

                if (status == DicomCommandStatusType.Success)
                {
                    _Action = ActionType.Merge;
                    TaskDialogHelper.ShowMessageBox(this, "Move Series", "The series has been successfully move.", GetMergeInfo(),
                                                    string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    string message = "The series was not move.\r\nError - " + _naction.GetErrorMessage();

                    if (status == DicomCommandStatusType.MissingAttribute)
                    {
                        message = "The series was not move.\r\nSeries not found on server.";
                    }

                    TaskDialogHelper.ShowMessageBox(this, "Move Series Error", "The series was not moved.", message,
                                                    string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                }
            }
        }
예제 #5
0
        private void DeletePatientButton_Click(object sender, EventArgs e)
        {
            ReasonDialog dlgReason = new ReasonDialog("Input Reason For Deleting Patient")
            {
                Icon = Icon
            };

            if (dlgReason.ShowDialog(this) == DialogResult.OK)
            {
                ProgressDialog         progress   = new ProgressDialog();
                Patient                patient    = listViewPatients.SelectedItems[0].Tag as Patient;
                DeletePatient          delPatient = new DeletePatient();
                DicomCommandStatusType status     = DicomCommandStatusType.Success;

                delPatient.Reason      = dlgReason.Reason;
                delPatient.Operator    = Environment.UserName != string.Empty?Environment.UserName:Environment.MachineName;
                delPatient.Station     = Environment.MachineName;
                delPatient.PatientId   = patient.Id;
                delPatient.Description = "Patient Delete";
                Thread thread = new Thread(() =>
                {
                    try
                    {
                        status = _naction.SendNActionRequest <DeletePatient>(_server, delPatient, NActionScu.DeletePatient,
                                                                             NActionScu.PatientUpdateInstance);
                    }
                    catch (Exception ex)
                    {
                        ApplicationUtils.ShowException(this, ex);
                    }
                });

                progress.ActionThread = thread;
                progress.Title        = "Deleting Patient: " + patient.Name.Full;
                progress.ProgressInfo = "Performing patient delete.";
                progress.ShowDialog(this);
                if (status == DicomCommandStatusType.Success)
                {
                    //
                    // Remove the deleted patient from the list
                    //
                    DeletePatient(listViewPatients.SelectedItems[0]);
                }
                else
                {
                    if (status == DicomCommandStatusType.UnrecognizedOperation)
                    {
                        TaskDialogHelper.ShowMessageBox(this, "Error Deleting Patient", "Check Server Permissions", "There was an error deleting the patient. " +
                                                        "This is usually caused by invalid AE permissions.", string.Empty, TaskDialogStandardButtons.Ok, TaskDialogStandardIcon.Error, null);
                    }
                    else
                    {
                        TaskDialogHelper.ShowMessageBox(this, "Error Deleting Patient", "Check Server Log", "There was an error deleting the patient. " +
                                                        string.Format("The server return the following error: {0}.", _naction.GetErrorMessage()), string.Empty, TaskDialogStandardButtons.Ok, TaskDialogStandardIcon.Error, null);
                    }
                }
            }
        }
예제 #6
0
        public async void OpenInVisualStudio(string filename, int line)
        {
            if (!File.Exists(filename))
            {
                if (TaskDialogHelper.ShowTaskDialog(
                        Handle,
                        "File Not Exists",
                        "File not found. Would you like to locate file by sourself?",
                        "Filename: " + filename,
                        TaskDialogStandardIcon.Error,
                        new string[] { "Browse", "Cancel" },
                        null,
                        new TaskDialogResult[] { TaskDialogResult.Yes, TaskDialogResult.No, }
                        ) != TaskDialogResult.Yes)
                {
                    return;
                }

                string file = PathUtils.GetFilename(filename);
                odSourceFile.Filter   = file + "|" + file;
                odSourceFile.FileName = file;
                if (odSourceFile.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }

                filename = odSourceFile.FileName;
            }
            string vs = Configs.Instance.GetRecentProperty(mapping.Mapping.Filename, Configs.PROPERTY_EDITOR);

            if (vs == null)
            {
                vs = Configs.Instance.Editor;
            }
            IVisualStudioInfo visualStudio = VisualStudioDetector.GetVisualStudioInfo(vs);

            BeginLoading("Starting the Visual Studio...");
            try
            {
                await Task.Run(() => visualStudio.OpenFile(filename, line));
            }
            catch (Exception ex)
            {
                this.SetTaskbarProgressValue(100, 100);
                this.SetTaskbarProgressState(Taskbar.ThumbnailProgressState.Error);
                TaskDialogHelper.ShowMessageBox(
                    Handle,
                    "Failed to Open in Visual Studio",
                    "Failed to open in Visual Studio. Try to use another version of Visual Studio.",
                    filename + ":" + line + "\n" + ex.Message,
                    TaskDialogStandardIcon.Error
                    );
            }
            EndLoading("");
        }
 private void btnProcess_Click(object sender, EventArgs e)
 {
     try
     {
         tbValue.Text = mapping.Mapping.ProcessCrashlogText(tbValue.Text, btnSkipPrefix.Checked);
     }
     catch (Exception ex)
     {
         TaskDialogHelper.ShowMessageBox(
             Handle,
             "Failed",
             "Unable to process crashlog.",
             "Reason: " + ex.Message,
             TaskDialogStandardIcon.Error
             );
     }
 }
예제 #8
0
        private void DeleteSeriesButton_Click(object sender, EventArgs e)
        {
            ReasonDialog dlgReason = new ReasonDialog("Input Reason For Deleting Series")
            {
                Icon = Icon
            };

            if (dlgReason.ShowDialog(this) == DialogResult.OK)
            {
                Series                 series    = listViewSeries.SelectedItems[0].Tag as Series;
                DeleteSeries           delSeries = new DeleteSeries();
                DicomCommandStatusType status    = DicomCommandStatusType.Success;

                delSeries.Reason            = dlgReason.Reason;
                delSeries.Operator          = Environment.UserName != string.Empty ? Environment.UserName : Environment.MachineName;
                delSeries.Description       = "Series Delete";
                delSeries.StudyInstanceUID  = listViewSeries.SelectedItems[0].SubItems[listViewSeries.SelectedItems[0].SubItems.Count - 1].Text;
                delSeries.SeriesInstanceUID = series.InstanceUID;

                status = _naction.SendNActionRequest <DeleteSeries>(_server, delSeries, NActionScu.DeleteSeries,
                                                                    NActionScu.PatientUpdateInstance);
                if (status == DicomCommandStatusType.Success)
                {
                    DeleteSeries(listViewSeries.SelectedItems[0]);
                }
                else
                {
                    if (status == DicomCommandStatusType.UnrecognizedOperation)
                    {
                        TaskDialogHelper.ShowMessageBox(this, "Error Deleting Series", "Check Server Permissions", "There was an error deleting the series. " +
                                                        "This is usually caused by invalid AE permissions.", string.Empty, TaskDialogStandardButtons.Ok, TaskDialogStandardIcon.Error, null);
                    }
                    else
                    {
                        TaskDialogHelper.ShowMessageBox(this, "Error Deleting Series", "Check Server Log", "There was an error deleting the series. " +
                                                        string.Format("The server return the following error: {0}.", _naction.GetErrorMessage()), string.Empty, TaskDialogStandardButtons.Ok, TaskDialogStandardIcon.Error, null);
                    }
                }
            }
        }
예제 #9
0
        private void VerifyButton_Click(object sender, EventArgs e)
        {
            DicomScp scp = new DicomScp();
            PatientUpdaterConnection scu = new PatientUpdaterConnection();

            scp.AETitle     = _textBoxServerAE.Text;
            scp.PeerAddress = ResolveIPAddress(_textBoxServerIP.Text);
            scp.Port        = Convert.ToInt32(_textBoxServerPort.Text);
            scu.AETitle     = _textBoxClientAE.Text;
            try
            {
                bool   ret     = scu.Verify(scp);
                string scpInfo = scp.PeerAddress.ToString() + " (" + scp.Port.ToString() + ")";

                if (!scu.Rejected)
                {
                    if (ret)
                    {
                        TaskDialogHelper.ShowMessageBox(this, "Successful Verification", "Verified " + scp.AETitle, string.Empty,
                                                        scpInfo, TaskDialogStandardButtons.Ok, TaskDialogStandardIcon.Information, null);
                    }
                    else
                    {
                        TaskDialogHelper.ShowMessageBox(this, "Failed Verification", "Unable to verify " + scp.AETitle, string.Empty,
                                                        scpInfo, TaskDialogStandardButtons.Ok, TaskDialogStandardIcon.Error, null);
                    }
                }
                else
                {
                    TaskDialogHelper.ShowMessageBox(this, "Failed Verification", "Unable to verify " + scp.AETitle, scu.Reason,
                                                    scpInfo, TaskDialogStandardButtons.Ok, TaskDialogStandardIcon.Error, null);
                }
            }
            catch (Exception ex)
            {
                ApplicationUtils.ShowException(this, ex);
            }
        }
예제 #10
0
        private void ChangeSeries()
        {
            ReasonDialog dlgReason = new ReasonDialog("Input Reason For Changing Series");

            if (dlgReason.ShowDialog(this) == DialogResult.OK)
            {
                ChangeSeries           change   = new ChangeSeries();
                DicomCommandStatusType status   = DicomCommandStatusType.Success;
                ProgressDialog         progress = new ProgressDialog();

                change.SeriesInstanceUID = _Series.InstanceUID;
                change.Operator          = Environment.UserName != string.Empty ? Environment.UserName : Environment.MachineName;
                change.Reason            = dlgReason.Reason;
                change.Description       = "Change Series";
                change.Modality          = comboBoxModality.Text;
                change.SeriesDescription = textBoxDescription.Text.Replace(@"\", @"\\").Replace("'", @"''");
                if (dateTimePickerSeriesDate.Checked)
                {
                    change.SeriesDate = dateTimePickerSeriesDate.Value;
                }
                else
                {
                    change.SeriesDate = null;
                }

                if (dateTimePickerSeriesTime.Checked)
                {
                    change.SeriesTime = dateTimePickerSeriesTime.Value;
                }
                else
                {
                    change.SeriesTime = null;
                }

                Thread thread = new Thread(() =>
                {
                    try
                    {
                        status = _naction.SendNActionRequest <ChangeSeries>(_scp, change, NActionScu.ChangeSeries,
                                                                            NActionScu.PatientUpdateInstance);
                    }
                    catch (Exception e)
                    {
                        ApplicationUtils.ShowException(this, e);
                        status = DicomCommandStatusType.Failure;
                    }
                });

                progress.ActionThread = thread;
                progress.Title        = "Changing Series";
                progress.ProgressInfo = "Performing series change.";
                progress.ShowDialog(this);
                if (status == DicomCommandStatusType.Success)
                {
                    _Series.Modality    = comboBoxModality.Text;
                    _Series.Description = textBoxDescription.Text;
                    if (dateTimePickerSeriesDate.Checked)
                    {
                        _Series.Date = change.SeriesDate;
                    }
                    else
                    {
                        _Series.Date = null;
                    }

                    if (dateTimePickerSeriesTime.Checked)
                    {
                        _Series.Time = change.SeriesTime;
                    }
                    else
                    {
                        _Series.Time = null;
                    }

                    _Action = ActionType.Change;
                    TaskDialogHelper.ShowMessageBox(this, "Series Changed", "The series has been successfully changed.", string.Empty,
                                                    string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    string message = "The series was not changed.\r\nError - " + _naction.GetErrorMessage();

                    if (status == DicomCommandStatusType.MissingAttribute)
                    {
                        message = "The series was not changed.\r\nSeries not found on server.";
                    }

                    TaskDialogHelper.ShowMessageBox(this, "Change Series Error", "The series was not changed.", message,
                                                    string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                }
            }
        }
예제 #11
0
        private void MergePatient()
        {
            ReasonDialog dlgReason = new ReasonDialog("Input Reason For Merging Patient");

            if (dlgReason.ShowDialog(this) == DialogResult.OK)
            {
                MergePatient           merge    = new MergePatient();
                DicomCommandStatusType status   = DicomCommandStatusType.Success;
                ProgressDialog         progress = new ProgressDialog();

                merge.PatientId   = textBoxId.Text;
                merge.Operator    = Environment.UserName != string.Empty ? Environment.UserName : Environment.MachineName;
                merge.Reason      = dlgReason.Reason;
                merge.Description = "Merge Patient";
                merge.PatientToMerge.Add(new MergePatientSequence(_Patient.Id));

                Thread thread = new Thread(() =>
                {
                    try
                    {
                        status = _naction.SendNActionRequest <MergePatient>(_scp, merge, NActionScu.MergePatient,
                                                                            NActionScu.PatientUpdateInstance);
                    }
                    catch (Exception e)
                    {
                        ApplicationUtils.ShowException(this, e);
                        status = DicomCommandStatusType.Failure;
                    }
                });

                progress.ActionThread = thread;
                progress.Title        = "Merging Patient: " + _Patient.Name.Full;
                progress.ProgressInfo = "Performing patient merge.";
                progress.ShowDialog(this);
                if (status == DicomCommandStatusType.Success)
                {
                    Action = ActionType.Merge;
                    TaskDialogHelper.ShowMessageBox(this, "Patient Merge", "The patient has been successfully merged.", GetMergeInfo(),
                                                    string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    string message = "The patient has not been merged.\r\nError - ";
                    string footer  = string.Empty;

                    if (status == DicomCommandStatusType.Reserved2)
                    {
                        message += "Missing Files";
                    }
                    else
                    {
                        message += _naction.GetErrorMessage();
                    }

                    if (status == DicomCommandStatusType.MissingAttribute)
                    {
                        message = "The patient has not been merged.\r\nPatient not found on server.";
                    }
                    else if (status == DicomCommandStatusType.Reserved2)
                    {
                        footer = "Contact system administrator for help in resolving this issue.";
                    }

                    TaskDialogHelper.ShowMessageBox(this, "Merge Patient Error", "The patient has not been merged.", message,
                                                    footer, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                }
            }
        }
예제 #12
0
        private void CopyPatient()
        {
            //
            // If the patient ID has changed then we need to see if a patient with that id already exists
            //
            if (_Patient.Id != textBoxId.Text)
            {
                PatientRootQueryPatient query    = new PatientRootQueryPatient();
                List <Patient>          patients = new List <Patient>();

                query.PatientQuery.PatientId = textBoxId.Text;
                try
                {
                    _find.Find <PatientRootQueryPatient, Patient>(_scp, query, (patient, ds) => patients.Add(patient));
                    if (patients.Count > 0)
                    {
                        TaskDialogResult result = TaskDialogResult.Yes;

                        result = TaskDialogHelper.ShowMessageBox(this, "Patient Id Already Exits", "Would you like to merge with existing patient?",
                                                                 "The patient id already exisits.", "Existing Patient: " + patients[0].Name.Full,
                                                                 TaskDialogStandardButtons.Yes | TaskDialogStandardButtons.No, TaskDialogStandardIcon.Error, TaskDialogStandardIcon.Warning);

                        if (result == TaskDialogResult.Yes)
                        {
                            radioButtonMerge.Checked = true;
                            textBoxLastname.Text     = patients[0].Name.Family;
                            textBoxFirstname.Text    = patients[0].Name.Given;
                            if (string.IsNullOrEmpty(patients[0].Sex))
                            {
                                comboBoxSex.Text = string.Empty;
                            }
                            else
                            {
                                comboBoxSex.SelectedIndex = comboBoxSex.FindStringExact(patients[0].Sex);
                            }
                            if (patients[0].BirthDate.HasValue)
                            {
                                dateTimePickerBirth.Value   = patients[0].BirthDate.Value;
                                dateTimePickerBirth.Checked = true;
                            }
                            else
                            {
                                dateTimePickerBirth.Checked = false;
                            }
                        }
                        else
                        {
                            textBoxId.Text = _Patient.Id;
                            return;
                        }
                    }
                }
                catch (Exception e)
                {
                    ApplicationUtils.ShowException(this, e);
                    return;
                }
            }

            ReasonDialog dlgReason = new ReasonDialog("Input Reason For Copying Patient");

            if (dlgReason.ShowDialog(this) == DialogResult.OK)
            {
                CopyPatient            change = new CopyPatient();
                DicomCommandStatusType status = DicomCommandStatusType.Success;

                change.OriginalPatientId = _Patient.Id.Replace(@"\", @"\\").Replace("'", @"''");
                change.Operator          = Environment.UserName != string.Empty ? Environment.UserName : Environment.MachineName;
                change.PatientId         = textBoxId.Text.Replace(@"\", @"\\").Replace("'", @"''");
                change.Reason            = dlgReason.Reason;
                change.Description       = "Copy Patient";
                change.Name.Given        = textBoxFirstname.Text.Replace(@"\", @"\\").Replace("'", @"''");
                change.Name.Family       = textBoxLastname.Text.Replace(@"\", @"\\").Replace("'", @"''");
                change.Sex = comboBoxSex.Text;
                if (dateTimePickerBirth.Checked)
                {
                    change.Birthdate = dateTimePickerBirth.Value;
                }
                else
                {
                    change.Birthdate = null;
                }

#if (LEADTOOLS_V19_OR_LATER)
                if (textBoxOtherPid.Text.Length > 0)
                {
                    Leadtools.Dicom.Common.DataTypes.PatientUpdater.OtherPatientID opid = new Leadtools.Dicom.Common.DataTypes.PatientUpdater.OtherPatientID();

                    change.OtherPatientIdsSequence = new List <Leadtools.Dicom.Common.DataTypes.PatientUpdater.OtherPatientID>();
                    opid.PatientId       = textBoxOtherPid.Text.Replace(@"\", @"\\").Replace("'", @"''");
                    opid.TypeOfPatientId = "TEXT";
                    change.OtherPatientIdsSequence.Add(opid);
                }
#endif

                status = _naction.SendNActionRequest <CopyPatient>(_scp, change, NActionScu.CopyPatient, NActionScu.PatientUpdateInstance);
                if (status == DicomCommandStatusType.Success)
                {
                    //_Patient.Id = textBoxId.Text;
                    //_Patient.Name.Given = textBoxFirstname.Text;
                    //_Patient.Name.Family = textBoxLastname.Text;
                    //_Patient.Sex = comboBoxSex.Text;
                    //if (dateTimePickerBirth.Checked)
                    //    _Patient.BirthDate = dateTimePickerBirth.Value;
                    //else
                    //    _Patient.BirthDate = null;
                    Action = ActionType.CopyPatient;
                    TaskDialogHelper.ShowMessageBox(this, "Patient Copied", "The patient has been successfully copied.", string.Empty,
                                                    string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    TaskDialogHelper.ShowMessageBox(this, "Copy Error", "The patient has not been successfully copied.", string.Empty,
                                                    "Error - " + _naction.GetErrorMessage(), TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                }
            }
        }
예제 #13
0
        private void MoveToNewPatient()
        {
            ReasonDialog dlgReason = new ReasonDialog("Input Reason For Moving Study To New Patient");

            if (dlgReason.ShowDialog(this) == DialogResult.OK)
            {
                MoveToNewPatient       move     = new MoveToNewPatient();
                DicomCommandStatusType status   = DicomCommandStatusType.Success;
                ProgressDialog         progress = new ProgressDialog();

                move.PatientId = textBoxId.Text.Replace(@"\", @"\\").Replace("'", @"''");

#if (LEADTOOLS_V19_OR_LATER)
                if (textBoxOtherPid.Text.Length > 0)
                {
                    move.OtherPatientIds = new List <string>();
                    string textBoxStringOtherPid = textBoxOtherPid.Text.Replace("'", @"''");

                    if (!string.IsNullOrEmpty(textBoxStringOtherPid))
                    {
                        char[]   delimiterChars  = { '\\' };
                        string[] otherPatientIds = textBoxStringOtherPid.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);

                        foreach (string otherPatientId in otherPatientIds)
                        {
                            move.OtherPatientIds.Add(otherPatientId);
                        }
                    }
                }
#endif

                move.Name.Given  = textBoxFirstname.Text.Replace(@"\", @"\\").Replace("'", @"''");
                move.Name.Family = textBoxLastname.Text.Replace(@"\", @"\\").Replace("'", @"''");
                move.Sex         = comboBoxSex.Text;
                move.PatientToMerge.Add(new MergePatientSequence(_Patient.Id));
                if (dateTimePickerBirth.Checked)
                {
                    move.Birthdate = dateTimePickerBirth.Value;
                }
                else
                {
                    move.Birthdate = null;
                }
                move.StudyInstanceUID = _StudyInstanceUID;
                move.Reason           = dlgReason.Reason;
                move.Operator         = Environment.UserName != string.Empty ? Environment.UserName : Environment.MachineName;
                move.Description      = "Move Study To New Patient";

                Thread thread = new Thread(() =>
                {
                    try
                    {
                        status = _naction.SendNActionRequest <MoveToNewPatient>(_scp, move, NActionScu.MoveStudyToNewPatient,
                                                                                NActionScu.PatientUpdateInstance);
                    }
                    catch (Exception e)
                    {
                        ApplicationUtils.ShowException(this, e);
                        status = DicomCommandStatusType.Failure;
                    }
                });

                progress.ActionThread = thread;
                progress.Title        = "Moving Study To New Patient";
                progress.ProgressInfo = "Performing study move to patient: " + textBoxFirstname.Text + " " + textBoxLastname.Text + ".";
                progress.ShowDialog(this);

                if (status == DicomCommandStatusType.Success)
                {
                    _Patient.Id          = textBoxId.Text;
                    _Patient.Name.Given  = textBoxFirstname.Text;
                    _Patient.Name.Family = textBoxLastname.Text;
                    _Patient.Sex         = comboBoxSex.Text;
                    if (dateTimePickerBirth.Checked)
                    {
                        _Patient.BirthDate = dateTimePickerBirth.Value;
                    }
                    else
                    {
                        _Patient.BirthDate = null;
                    }
                    _Action = ActionType.Move;
                    TaskDialogHelper.ShowMessageBox(this, "Study Moved To New Patient", "The study has been successfully moved.", string.Empty,
                                                    string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    string message = "The series was not moved.\r\nError - " + _naction.GetErrorMessage();

                    if (status == DicomCommandStatusType.MissingAttribute)
                    {
                        message = "The series was not moved.\r\nSeries not found on server.";
                    }

                    TaskDialogHelper.ShowMessageBox(this, "Move Series Error", "The series was not moved.", message,
                                                    string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                }
            }
        }
예제 #14
0
        private void ChangePatient()
        {
            //
            // If the patient ID has changed then we need to see if a patient with that id already exists
            //
            if (_Patient.Id != textBoxId.Text)
            {
                PatientRootQueryPatient query    = new PatientRootQueryPatient();
                List <Patient>          patients = new List <Patient>();

                query.PatientQuery.PatientId = textBoxId.Text;
                try
                {
                    _find.Find <PatientRootQueryPatient, Patient>(_scp, query, (patient, ds) => patients.Add(patient));
                    if (patients.Count > 0)
                    {
                        TaskDialogResult result = TaskDialogResult.Yes;

                        result = TaskDialogHelper.ShowMessageBox(this, "Patient Id Already Exits", "Would you like to merge with existing patient?",
                                                                 "The patient id already exisits.", "Existing Patient: " + patients[0].Name.Full,
                                                                 TaskDialogStandardButtons.Yes | TaskDialogStandardButtons.No, TaskDialogStandardIcon.Error, TaskDialogStandardIcon.Warning);

                        if (result == TaskDialogResult.Yes)
                        {
                            radioButtonMerge.Checked  = true;
                            textBoxLastname.Text      = patients[0].Name.Family;
                            textBoxFirstname.Text     = patients[0].Name.Given;
                            comboBoxSex.SelectedIndex = comboBoxSex.FindStringExact(patients[0].Sex);
                            if (patients[0].BirthDate.HasValue)
                            {
                                dateTimePickerBirth.Value   = patients[0].BirthDate.Value;
                                dateTimePickerBirth.Checked = true;
                            }
                            else
                            {
                                dateTimePickerBirth.Checked = false;
                            }
                            MergePatient();
                            return;
                        }
                        else
                        {
                            textBoxId.Text = _Patient.Id;
                            return;
                        }
                    }
                }
                catch (Exception e)
                {
                    ApplicationUtils.ShowException(this, e);
                    return;
                }
            }

            bool isError = VerifyPatientSettings();

            if (isError)
            {
                return;
            }

            ReasonDialog dlgReason = new ReasonDialog("Input Reason For Changing Patient");

            if (dlgReason.ShowDialog(this) == DialogResult.OK)
            {
                ChangePatient          change = new ChangePatient();
                DicomCommandStatusType status = DicomCommandStatusType.Success;

                change.OriginalPatientId = _Patient.Id.Replace(@"\", @"\\").Replace("'", @"''");
                change.Operator          = Environment.UserName != string.Empty ? Environment.UserName : Environment.MachineName;
                change.PatientId         = textBoxId.Text.Replace(@"\", @"\\").Replace("'", @"''");
                change.Reason            = dlgReason.Reason;
                change.Description       = "Change Patient";
                change.Name.Given        = textBoxFirstname.Text.Replace(@"\", @"\\").Replace("'", @"''");
                change.Name.Family       = textBoxLastname.Text.Replace(@"\", @"\\").Replace("'", @"''");
                change.Sex = comboBoxSex.Text;
                if (dateTimePickerBirth.Checked)
                {
                    change.Birthdate = dateTimePickerBirth.Value;
                }
                else
                {
                    change.Birthdate = null;
                }

#if (LEADTOOLS_V19_OR_LATER)
                if (textBoxOtherPid.Text.Length > 0)
                {
                    change.OtherPatientIdsSequence = new List <Leadtools.Dicom.Common.DataTypes.PatientUpdater.OtherPatientID>();
                    string textBoxStringOtherPid = textBoxOtherPid.Text.Replace("'", @"''");

                    if (!string.IsNullOrEmpty(textBoxStringOtherPid))
                    {
                        char[]   delimiterChars  = { '\\' };
                        string[] otherPatientIds = textBoxStringOtherPid.Split(delimiterChars, StringSplitOptions.RemoveEmptyEntries);

                        foreach (string otherPatientId in otherPatientIds)
                        {
                            Leadtools.Dicom.Common.DataTypes.PatientUpdater.OtherPatientID opid = new Leadtools.Dicom.Common.DataTypes.PatientUpdater.OtherPatientID();
                            opid.PatientId       = otherPatientId;
                            opid.TypeOfPatientId = "TEXT";
                            change.OtherPatientIdsSequence.Add(opid);
                        }
                    }
                }
#endif

                status = _naction.SendNActionRequest <ChangePatient>(_scp, change, NActionScu.ChangePatient,
                                                                     NActionScu.PatientUpdateInstance);
                if (status == DicomCommandStatusType.Success)
                {
                    _Patient.Id          = textBoxId.Text;
                    _Patient.Name.Given  = textBoxFirstname.Text;
                    _Patient.Name.Family = textBoxLastname.Text;
                    _Patient.Sex         = comboBoxSex.Text;
                    if (dateTimePickerBirth.Checked)
                    {
                        _Patient.BirthDate = dateTimePickerBirth.Value;
                    }
                    else
                    {
                        _Patient.BirthDate = null;
                    }
                    Action = ActionType.Change;
                    TaskDialogHelper.ShowMessageBox(this, "Patient Changed", "The patient has been successfully changed.", string.Empty,
                                                    string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                    DialogResult = DialogResult.OK;

                    if (change.OriginalPatientId != _Patient.Id)
                    {
                        if (Program.OtherPID.ContainsKey(change.OriginalPatientId))
                        {
                            Program.OtherPID.Remove(change.OriginalPatientId);
                        }
                    }

                    Program.OtherPID[_Patient.Id] = textBoxOtherPid.Text;
                }
                else
                {
                    string message = "The patient was not changed.\r\nError - " + _naction.GetErrorMessage();

                    if (status == DicomCommandStatusType.MissingAttribute)
                    {
                        message = "The patient was not changed.\r\nPatient not found on server.";
                    }

                    TaskDialogHelper.ShowMessageBox(this, "Change Patient Error", "The patient was not changed.", message,
                                                    string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                }
            }
        }
예제 #15
0
        private async void MainForm_DragDrop(object sender, DragEventArgs e)
        {
            IDataObject dataObject = e.Data;

            if (!dataObject.GetDataPresent(DataFormats.FileDrop))
            {
                return;
            }

            List <string> files    = new List <string>((string[])e.Data.GetData(DataFormats.FileDrop));
            List <string> pdbFiles = null;

            string fileToOpen = null;
            int    i          = 0;

            do
            {
                string ext = Path.GetExtension(files[i]).ToLower();

                // search for xml files to open
                if (FormatFactory.HasExtension(ext))
                {
                    fileToOpen = files[i];
                    files.RemoveAt(i);
                    continue;
                }

                // search for pdb files to attach after open
                if (ext == ".pdb")
                {
                    if (pdbFiles == null)
                    {
                        pdbFiles = new List <string>();
                    }
                    pdbFiles.Add(files[i]);
                }

                i++;
            }while (i < files.Count);

            // open file if found. found pdbs will be attached after open (pdbToAttach)
            if (fileToOpen != null)
            {
                if (TaskDialogHelper.ShowMessageBox(
                        Handle,
                        "Open File",
                        "Open file?",
                        fileToOpen,
                        TaskDialogStandardIcon.Information,
                        TaskDialogStandardButtons.Yes | TaskDialogStandardButtons.No
                        ) !=
                    TaskDialogResult.Yes
                    )
                {
                    return;
                }

                await OpenFile(fileToOpen);

                return;
            }

            if (mapping == null)
            {
                return;
            }

            AttachPDB(pdbFiles, true);
        }
예제 #16
0
        private void CopyStudy()
        {
            ReasonDialog dlgReason = new ReasonDialog("Input Reason For Copying Study");

            if (dlgReason.ShowDialog(this) == DialogResult.OK)
            {
                CopyStudy move = new CopyStudy();
                DicomCommandStatusType status   = DicomCommandStatusType.Success;
                ProgressDialog         progress = new ProgressDialog();

                move.PatientId       = textBoxId.Text.Replace(@"\", @"\\").Replace("'", @"''");
                move.OtherPatientIDs = textBoxOtherPid.Text;
                move.Name.Given      = textBoxFirstname.Text.Replace(@"\", @"\\").Replace("'", @"''");
                move.Name.Family     = textBoxLastname.Text.Replace(@"\", @"\\").Replace("'", @"''");
                move.Sex             = comboBoxSex.Text;
                move.PatientToMerge.Add(new MergePatientSequence(_Patient.Id));
                if (dateTimePickerBirth.Checked)
                {
                    move.Birthdate = dateTimePickerBirth.Value;
                }
                else
                {
                    move.Birthdate = null;
                }
                move.StudyInstanceUID = _StudyInstanceUID;
                move.Reason           = dlgReason.Reason;
                move.Operator         = Environment.UserName != string.Empty ? Environment.UserName : Environment.MachineName;
                move.Description      = "Copy Study";

                Thread thread = new Thread(() =>
                {
                    try
                    {
                        status = _naction.SendNActionRequest <CopyStudy>(_scp, move, NActionScu.CopyStudy,
                                                                         NActionScu.PatientUpdateInstance);
                    }
                    catch (Exception e)
                    {
                        ApplicationUtils.ShowException(this, e);
                        status = DicomCommandStatusType.Failure;
                    }
                });

                progress.ActionThread = thread;
                progress.Title        = "Copying Study";
                progress.ProgressInfo = "Performing study copy: " + textBoxFirstname.Text + " " + textBoxLastname.Text + ".";
                progress.ShowDialog(this);

                if (status == DicomCommandStatusType.Success)
                {
                    _Action = ActionType.CopyStudy;
                    TaskDialogHelper.ShowMessageBox(this, "Study Copied", "The study has been successfully copied.", string.Empty,
                                                    string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    string message = "The series was not copied.\r\nError - " + _naction.GetErrorMessage();

                    if (status == DicomCommandStatusType.MissingAttribute)
                    {
                        message = "The series was not copied.\r\nSeries not found on server.";
                    }

                    TaskDialogHelper.ShowMessageBox(this, "Copy Series Error", "The series was not copied.", message,
                                                    string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                }
            }
        }
예제 #17
0
        private void SearchButton_Click(object sender, EventArgs e)
        {
            Patient patient = DicomUtils.FindPatient(this, _find, _scp, textBoxId.Text);

            if (!radioButtonMoveStudyToNewPatient.Checked)
            {
                if (patient != null)
                {
                    textBoxLastname.Text  = patient.Name.Family;
                    textBoxFirstname.Text = patient.Name.Given;
                    if (Program.OtherPID.ContainsKey(patient.Id))
                    {
                        textBoxOtherPid.Text = Program.OtherPID[patient.Id];
                    }
                    else
                    {
                        textBoxOtherPid.Text = string.Empty;
                    }
                    if (string.IsNullOrEmpty(patient.Sex))
                    {
                        comboBoxSex.Text = string.Empty;
                    }
                    else
                    {
                        comboBoxSex.SelectedIndex = comboBoxSex.FindStringExact(patient.Sex);
                    }
                    if (patient.BirthDate.HasValue)
                    {
                        dateTimePickerBirth.Value   = patient.BirthDate.Value;
                        dateTimePickerBirth.Checked = true;
                    }
                    else
                    {
                        dateTimePickerBirth.Checked = false;
                    }
                }
                else
                {
                    TaskDialogHelper.ShowMessageBox(this, "Patient Search", "Patient with specified id was not found.", string.Empty,
                                                    string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                }
                ActionButton.Enabled = patient != null;
            }
            else
            {
                if (patient != null)
                {
                    TaskDialogResult result = TaskDialogResult.Yes;

                    result = TaskDialogHelper.ShowMessageBox(this, "Patient Id Already Exits", "Would you like to merge the study with existing patient?",
                                                             "The patient id already exisits.", "Existing Patient: " + patient.Name.Full,
                                                             TaskDialogStandardButtons.Yes | TaskDialogStandardButtons.No, TaskDialogStandardIcon.Error, TaskDialogStandardIcon.Warning);
                    if (result == TaskDialogResult.Yes)
                    {
                        radioButtonMoveStudyToExistingPatient.Checked = true;
                        textBoxLastname.Text  = patient.Name.Family;
                        textBoxFirstname.Text = patient.Name.Given;
                        if (string.IsNullOrEmpty(patient.Sex))
                        {
                            comboBoxSex.Text = string.Empty;
                        }
                        else
                        {
                            comboBoxSex.SelectedIndex = comboBoxSex.FindStringExact(patient.Sex);
                        }
                        if (patient.BirthDate.HasValue)
                        {
                            dateTimePickerBirth.Value   = patient.BirthDate.Value;
                            dateTimePickerBirth.Checked = true;
                        }
                        else
                        {
                            dateTimePickerBirth.Checked = false;
                        }
                        ActionButton.Enabled = true;
                    }
                    else
                    {
                        ActionButton.Enabled = false;
                    }
                }
                else
                {
                    ActionButton.Enabled = true;
                }
            }

            CopyButton.Enabled = ActionButton.Enabled && !radioButtonMoveSeriesToExistingPatient.Checked;
        }
예제 #18
0
        /*
         * Example for deleting a study
         *
         * private void DeleteStudy()
         * {
         *   ReasonDialog dlgReason = new ReasonDialog("Input Reason For Deleting Study");
         *
         *   if (dlgReason.ShowDialog(this) == DialogResult.OK)
         *   {
         *      Leadtools.Dicom.Common.DataTypes.PatientUpdater.DeleteStudy deleteStudy = new Leadtools.Dicom.Common.DataTypes.PatientUpdater.DeleteStudy();
         *       DicomCommandStatusType status = DicomCommandStatusType.Success;
         *       ProgressDialog progress = new ProgressDialog();
         *
         *       deleteStudy.StudyInstanceUID = _StudyInstanceUID;
         *       deleteStudy.Operator = Environment.UserName != string.Empty ? Environment.UserName : Environment.MachineName;
         *       deleteStudy.Reason = dlgReason.Reason;
         *       deleteStudy.Description = "Delete Study";
         *
         *       Thread thread = new Thread(() =>
         *           {
         *               try
         *               {
         *                  status = _naction.SendNActionRequest<Leadtools.Dicom.Common.DataTypes.PatientUpdater.DeleteStudy>(_scp, deleteStudy,
         *                     Leadtools.Dicom.Common.DataTypes.PatientUpdater.PatientUpdaterConstants.Action.DeleteStudy,
         *                                                               NActionScu.PatientUpdateInstance);
         *               }
         *               catch (Exception e)
         *               {
         *                   ApplicationUtils.ShowException(this, e);
         *                   status = DicomCommandStatusType.Failure;
         *               }
         *           });
         *
         *       progress.ActionThread = thread;
         *       progress.Title = "Deleting Study";
         *       progress.ProgressInfo = "Performing study delete.";
         *       progress.ShowDialog(this);
         *       if (status == DicomCommandStatusType.Success)
         *       {
         *           _Action = ActionType.Change;
         *           TaskDialogHelper.ShowMessageBox(this, "Study Deleted", "The study has been successfully deleted.", string.Empty,
         *                                           string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
         *                                           null);
         *           DialogResult = DialogResult.OK;
         *       }
         *       else
         *       {
         *          string message = "The study was not deleted.\r\nError - " + _naction.GetErrorMessage();
         *
         *           if (status == DicomCommandStatusType.MissingAttribute)
         *               message = "The study was not deleted.\r\nStudy not found on server.";
         *
         *           TaskDialogHelper.ShowMessageBox(this, "Delete Study Error", "The study was not deleted.", message,
         *                                       string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
         *                                       null);
         *       }
         *   }
         * }*/


        //Example for changing study information

        private void ChangeStudy()
        {
            ReasonDialog dlgReason = new ReasonDialog("Input Reason For Changing Study");

            if (dlgReason.ShowDialog(this) == DialogResult.OK)
            {
#if LEADTOOLS_V19_OR_LATER
                ChangeStudy change = new ChangeStudy();
#else
                Leadtools.Dicom.Common.DataTypes.PatientUpdater.ChangeStudy change = new Leadtools.Dicom.Common.DataTypes.PatientUpdater.ChangeStudy();
#endif
                DicomCommandStatusType status   = DicomCommandStatusType.Success;
                ProgressDialog         progress = new ProgressDialog();
                change.StudyID          = txtID.Text;
                change.AccessionNumber  = txtAccession.Text;
                change.Description      = "Change Study";
                change.StudyDescription = txtDescription.Text;

                if (dateTimePickerStudyDate.Checked)
                {
                    change.StudyDate = dateTimePickerStudyDate.Value;
                }
                else
                {
                    change.StudyDate = null;
                }

                change.StudyInstanceUID = _StudyInstanceUID;
                change.Operator         = Environment.UserName != string.Empty ? Environment.UserName : Environment.MachineName;
                change.Reason           = dlgReason.Reason;

                Thread thread = new Thread(() =>
                {
                    try
                    {
#if LEADTOOLS_V19_OR_LATER
                        status = _naction.SendNActionRequest <ChangeStudy>(_scp, change, NActionScu.ChangeStudy,
                                                                           NActionScu.PatientUpdateInstance);
#else
                        status = _naction.SendNActionRequest <Leadtools.Dicom.Common.DataTypes.PatientUpdater.ChangeStudy>(_scp, change, NActionScu.ChangeStudy,
                                                                                                                           NActionScu.PatientUpdateInstance);
#endif
                    }
                    catch (Exception e)
                    {
                        ApplicationUtils.ShowException(this, e);
                        status = DicomCommandStatusType.Failure;
                    }
                });

                progress.ActionThread = thread;
                progress.Title        = "Changing Study";
                progress.ProgressInfo = "Performing study change.";
                progress.ShowDialog(this);
                if (status == DicomCommandStatusType.Success)
                {
                    _Action = ActionType.Change;
                    TaskDialogHelper.ShowMessageBox(this, "Study Changed", "The study has been successfully changed.", string.Empty,
                                                    string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    string message = "The study was not changed.\r\nError - " + _naction.GetErrorMessage();

                    if (status == DicomCommandStatusType.MissingAttribute)
                    {
                        message = "The study was not changed.\r\nStudy not found on server.";
                    }

                    TaskDialogHelper.ShowMessageBox(this, "Change Study Error", "The study was not changed.", message,
                                                    string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information,
                                                    null);
                }
            }
        }
예제 #19
0
        private void DoSearch()
        {
            ProgressDialog progress = new ProgressDialog();

            _query.PatientQuery.PatientId   = textBoxPatientId.Text;
            _query.PatientQuery.PatientName = GetPatientNameSearch();
            listViewSeries.BeginUpdate();
            listViewSeries.Items.Clear();
            listViewSeries.EndUpdate();
            //listViewPatients.BeginUpdate();
            listViewPatients.Items.Clear();
            _CurrentPatient             = null;
            EditPatientButton.Enabled   = false;
            DeletePatientButton.Enabled = false;
            EditSeriesButton.Enabled    = false;
            DeleteSeriesButton.Enabled  = false;

            DicomAE scp = GetScp();

            if (scp == null)
            {
                return;
            }

            _server.AETitle     = scp.AE;
            _server.PeerAddress = OptionsDialog.ResolveIPAddress(scp.IPAddress);
            _server.Port        = scp.Port;
            _server.Timeout     = scp.Timeout;

            Program.OtherPID.Clear();

            Thread thread = new Thread(delegate()
            {
                try
                {
                    _patientSearch = true;
                    _find.Find <PatientRootQueryPatient, Patient>(_server, _query, (p, ds) =>
                    {
                        string id = ds.GetValue <string>(DicomTag.OtherPatientIDs, string.Empty);

                        if (!string.IsNullOrEmpty(id))
                        {
                            Program.OtherPID[p.Id] = id;
                        }

                        SynchronizedInvoke(() => AddPatient(p));
                    });
                    if (_find.Rejected)
                    {
                        SynchronizedInvoke(() =>
                        {
                            TaskDialogHelper.ShowMessageBox(this, "No Records Found", "Association Failed", _find.Reason,
                                                            "Modify options and try again.", TaskDialogStandardButtons.Ok, TaskDialogStandardIcon.Error, TaskDialogStandardIcon.Information);
                        });
                    }
                }
                catch (Exception e)
                {
                    ApplicationUtils.ShowException(this, e);
                }
                SynchronizedInvoke(() => listViewPatients.Sort());
            });

            progress.Cancel = () =>
            {
                if (_find.IsAssociated())
                {
                    _find.AbortRequest(DicomAbortSourceType.User, DicomAbortReasonType.Unexpected);
                }
            };
            progress.ActionThread = thread;
            progress.Title        = "Finding Patients";
            progress.ProgressInfo = "Performing a patient search.";
            progress.ShowDialog(this);
            //listViewPatients.EndUpdate();
        }