private bool ConfirmDeletion() { string message; var notYetDeleted = AllSeries.Where(series => !series.ScheduledDeleteTime.HasValue); if (SelectedSeries.Any(selected => selected.ScheduledDeleteTime.HasValue)) { message = SR.MessageSelectSeriesNotAlreadyScheduledForDeletion; Context.DesktopWindow.ShowMessageBox(message, MessageBoxActions.Ok); return(false); } if (notYetDeleted.All(notDeleted => SelectedSeries.Any(selected => selected.SeriesInstanceUid == notDeleted.SeriesInstanceUid))) { message = SR.MessageConfirmDeleteEntireStudy; } else { message = Context.SelectedSeries.Count == 1 ? SR.MessageConfirmDeleteSeries : String.Format(SR.MessageFormatConfirmDeleteSeries, Context.SelectedSeries.Count); message = String.Format("{0} {1}", SR.MessagePartialStudyWarning, message); } return(DialogBoxAction.Yes == Context.DesktopWindow.ShowMessageBox(message, MessageBoxActions.YesNo)); }
private async Task ApproveSelectedSeries(bool?approve) { await CancelPipeline(); if (!approve.GetValueOrDefault() || !SelectedSeries.Any()) { SeriesSelected?.Invoke(this, new Series[] { }); return; } DownloadImagesProgress = 0; var selectedSeries = SelectedSeries.Select(vm => vm.Series); // unwrap var request = new GetSeriesImagesRequest { Series = selectedSeries }; request.Progress += (s, e) => { DownloadImagesProgress = e; }; await _searchService.GetSeriesImagesAsync(request, CancellationToken.None); SeriesSelected?.Invoke(this, selectedSeries.ToArray()); SelectedSeries.Clear(); DownloadImagesProgress = 0; }
private void SendSeriesInternal() { if (!Enabled || this.Context.SelectedSeries == null) { return; } if (SelectedSeries.Any(series => series.ScheduledDeleteTime.HasValue)) { Context.DesktopWindow.ShowMessageBox(SR.MessageCannotSendSeriesScheduledForDeletion, MessageBoxActions.Ok); return; } var serverTreeComponent = new ServerTreeComponent { IsReadOnly = true, ShowCheckBoxes = false, ShowLocalServerNode = false, ShowTitlebar = false, ShowTools = false }; var dialogContainer = new SimpleComponentContainer(serverTreeComponent); ApplicationComponentExitCode code = ApplicationComponent.LaunchAsDialog( Context.DesktopWindow, dialogContainer, SR.TitleSendSeries); if (code != ApplicationComponentExitCode.Accepted) { return; } if (serverTreeComponent.SelectedServers.Count == 0) { Context.DesktopWindow.ShowMessageBox(SR.MessageSelectDestination, MessageBoxActions.Ok); return; } if (serverTreeComponent.SelectedServers.Count > 1) { if (Context.DesktopWindow.ShowMessageBox(SR.MessageConfirmSendToMultipleServers, MessageBoxActions.YesNo) == DialogBoxAction.No) { return; } } var client = new DicomSendBridge(); var seriesUids = Context.SelectedSeries.Select(item => item.SeriesInstanceUid).ToList(); foreach (var destination in serverTreeComponent.SelectedServers) { try { client.SendSeries(destination, Context.Study, seriesUids.ToArray(), WorkItemPriorityEnum.High); DateTime?studyDate = DateParser.Parse(Context.Study.StudyDate); Context.DesktopWindow.ShowAlert(AlertLevel.Info, string.Format(SR.MessageFormatSendSeriesScheduled, seriesUids.Count, destination.Name, Context.Study.PatientsName.FormattedName, studyDate.HasValue ? Format.Date(studyDate.Value) : string.Empty, Context.Study.AccessionNumber), SR.LinkOpenActivityMonitor, ActivityMonitorManager.Show, true); } catch (EndpointNotFoundException) { Context.DesktopWindow.ShowMessageBox(SR.MessageSendDicomServerServiceNotRunning, MessageBoxActions.Ok); } catch (Exception e) { ExceptionHandler.Report(e, SR.MessageFailedToSendSeries, Context.DesktopWindow); } } }