private static void SelectPriorsServers(ServerTreeComponent serverTreeComponent) { ServerTree serverTree = serverTreeComponent.ServerTree; var priorsServers = ServerDirectory.GetPriorsServers(false); CheckPriorsServers(serverTree, priorsServers); IServerTreeNode initialSelection = GetFirstPriorsServerOrGroup(serverTree.RootServerGroup); UncheckAllServers(serverTree); if (initialSelection == null) { if (serverTreeComponent.ShowLocalServerNode) { initialSelection = serverTreeComponent.ServerTree.LocalServer; } else { initialSelection = serverTreeComponent.ServerTree.RootServerGroup; } } serverTreeComponent.SetSelection(initialSelection); }
public void SendStudy() { if (!Enabled) return; var serverTreeComponent = new ServerTreeComponent { IsReadOnly = true, ShowCheckBoxes = false, ShowLocalServerNode = false, ShowTitlebar = false, ShowTools = false }; var dialogContainer = new SimpleComponentContainer(serverTreeComponent); var code = ApplicationComponent.LaunchAsDialog(Context.DesktopWindow, dialogContainer, SR.TitleSendStudy); 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; } try { if (Context.SelectedStudies.Count > 1) { var count = ProcessItemsAsync(Context.SelectedStudies, study => SendStudy(study, serverTreeComponent.SelectedServers), false); AlertMultipleStudiesSent(count); } else if (Context.SelectedStudies.Count == 1) { var study = Context.SelectedStudies.First(); SendStudy(study, serverTreeComponent.SelectedServers); AlertStudySent(study, serverTreeComponent.SelectedServers); } } catch (EndpointNotFoundException) { Context.DesktopWindow.ShowMessageBox(SR.MessageSendDicomServerServiceNotRunning, MessageBoxActions.Ok); } catch (Exception e) { ExceptionHandler.Report(e, SR.MessageErrorSendingStudies, Context.DesktopWindow); } }
private static void SelectPriorsServerNode(ServerTreeComponent serverTreeComponent) { if (serverTreeComponent.ShowLocalServerNode && !DicomExplorerConfigurationSettings.Default.SelectDefaultServerOnStartup) { serverTreeComponent.SetSelection(serverTreeComponent.ServerTree.LocalServer); } else { SelectPriorsServers(serverTreeComponent); } }
private AEInformation get_server() { ServerTreeComponent serverTreeComponent = new ServerTreeComponent(); serverTreeComponent.IsReadOnly = false; serverTreeComponent.ShowCheckBoxes = false; serverTreeComponent.ShowLocalDataStoreNode = true; serverTreeComponent.ShowTitlebar = true; serverTreeComponent.ShowTools = true; SimpleComponentContainer dialogContainer = new SimpleComponentContainer(serverTreeComponent); ApplicationComponentExitCode code = ApplicationComponent.LaunchAsDialog( this.Context.DesktopWindow, dialogContainer, "Choose Server"); if (code == ApplicationComponentExitCode.Accepted) { if (serverTreeComponent.SelectedServers.IsLocalDatastore == true) { this.Context.DesktopWindow.ShowMessageBox("Cannot send to 'My Studies'", MessageBoxActions.Ok); return(null); } if (serverTreeComponent.SelectedServers == null || serverTreeComponent.SelectedServers.Servers == null || serverTreeComponent.SelectedServers.Servers.Count == 0) { this.Context.DesktopWindow.ShowMessageBox("Invalid selection", MessageBoxActions.Ok); return(null); } if (serverTreeComponent.SelectedServers.Servers.Count > 1) { this.Context.DesktopWindow.ShowMessageBox("Cannot select multiple servers", MessageBoxActions.Ok); return(null); } Server selected_server = (Server)serverTreeComponent.SelectedServers.Servers[0]; AEInformation destination = new AEInformation(); destination.AETitle = selected_server.AETitle; destination.HostName = selected_server.Host; destination.Port = selected_server.Port; return(destination); } else { return(null); } }
public static DicomExplorerComponent Create() { var serverTreeComponent = new ServerTreeComponent { ShowLocalServerNode = StudyStore.IsSupported }; bool hasEditPermission = PermissionsHelper.IsInRole(AuthorityTokens.Configuration.MyServers); serverTreeComponent.IsReadOnly = !hasEditPermission; var studyBrowserComponent = CreateComponentFromExtensionPoint <StudyBrowserComponentExtensionPoint, IStudyBrowserComponent>() ?? new StudyBrowserComponent(); serverTreeComponent.SelectedServerChanged += delegate { studyBrowserComponent.SelectedServers = serverTreeComponent.SelectedServers; }; var searchPanelComponent = CreateComponentFromExtensionPoint <SearchPanelComponentExtensionPoint, ISearchPanelComponent>() ?? new SearchPanelComponent(); SelectPriorsServerNode(serverTreeComponent); var leftPane = new SplitPane(SR.TitleServerTreePane, serverTreeComponent, 0.25f); var rightPane = new SplitPane(SR.TitleStudyBrowserPane, studyBrowserComponent, 0.75f); var bottomContainer = new SplitComponentContainer( leftPane, rightPane, SplitOrientation.Vertical); var topPane = new SplitPane(SR.TitleSearchPanelPane, searchPanelComponent, true); var bottomPane = new SplitPane(SR.TitleStudyNavigatorPane, bottomContainer, false); var component = new DicomExplorerComponent(topPane, bottomPane) { _studyBrowserComponent = studyBrowserComponent, _searchPanelComponent = searchPanelComponent, _serverTreeComponent = serverTreeComponent }; return(component); }
public ServerTreeComponentControl(ServerTreeComponent component) { Platform.CheckForNullReference(component, "component"); InitializeComponent(); _component = component; this.DataBindings.Add("Enabled", _component, "IsEnabled"); _titleBar.Visible = _component.ShowTitlebar; _serverTools.Visible = _component.ShowTools; _aeTreeView.AllowDrop = !_component.IsReadOnly; _aeTreeView.ItemDrag += TreeViewItemDrag; _aeTreeView.DragEnter += TreeViewDragEnter; _aeTreeView.DragOver += TreeViewDragOver; _aeTreeView.DragDrop += TreeViewDragDrop; _aeTreeView.MouseDown += AETreeViewClick; _aeTreeView.AfterSelect += AETreeViewAfterSelect; _component.SelectedServerChanged += new EventHandler(OnSelectedServerChanged); _component.ServerTree.ServerTreeUpdated += OnServerTreeUpdated; if (_component.ShowTools) { _toolStripItemDisplayStyle = ToolStripItemDisplayStyle.Image; ToolbarModel = _component.ToolbarModel; MenuModel = _component.ContextMenuModel; } if (_component.ShowLocalServerNode) { // A bit cheap, but by doing this we can force a refresh of the tooltip text. _aeTreeView.MouseEnter += OnMouseEnter; } BuildServerTreeView(_aeTreeView, _component.ServerTree); SetInitialSelection(); }
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); } } }
public void SetComponent(IApplicationComponent component) { _component = component as ServerTreeComponent; }
private AEInformation get_server() { ServerTreeComponent serverTreeComponent = new ServerTreeComponent(); serverTreeComponent.IsReadOnly = false; serverTreeComponent.ShowCheckBoxes = false; serverTreeComponent.ShowLocalDataStoreNode = true; serverTreeComponent.ShowTitlebar = true; serverTreeComponent.ShowTools = true; SimpleComponentContainer dialogContainer = new SimpleComponentContainer(serverTreeComponent); ApplicationComponentExitCode code = ApplicationComponent.LaunchAsDialog( this.Context.DesktopWindow, dialogContainer, "Choose Server"); if (serverTreeComponent.SelectedServers == null || serverTreeComponent.SelectedServers.Servers == null || serverTreeComponent.SelectedServers.Servers.Count == 0) { this.Context.DesktopWindow.ShowMessageBox("Invalid Selection", MessageBoxActions.Ok); return null; } if (serverTreeComponent.SelectedServers.Servers.Count > 1) { this.Context.DesktopWindow.ShowMessageBox("Cannot select multiple servers?", MessageBoxActions.Ok); return null; } Server selected_server = (Server)serverTreeComponent.SelectedServers.Servers[0]; AEInformation destination = new AEInformation(); destination.AETitle = selected_server.AETitle; destination.HostName = selected_server.Host; destination.Port = selected_server.Port; return destination; }
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); } } }
public void SendStudy() { if (!Enabled) { return; } var serverTreeComponent = new ServerTreeComponent { IsReadOnly = true, ShowCheckBoxes = false, ShowLocalServerNode = false, ShowTitlebar = false, ShowTools = false }; var dialogContainer = new SimpleComponentContainer(serverTreeComponent); var code = ApplicationComponent.LaunchAsDialog(Context.DesktopWindow, dialogContainer, SR.TitleSendStudy); 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; } } try { if (Context.SelectedStudies.Count > 1) { var count = ProcessItemsAsync(Context.SelectedStudies, study => SendStudy(study, serverTreeComponent.SelectedServers), false); AlertMultipleStudiesSent(count); } else if (Context.SelectedStudies.Count == 1) { var study = Context.SelectedStudies.First(); SendStudy(study, serverTreeComponent.SelectedServers); AlertStudySent(study, serverTreeComponent.SelectedServers); } } catch (EndpointNotFoundException) { Context.DesktopWindow.ShowMessageBox(SR.MessageSendDicomServerServiceNotRunning, MessageBoxActions.Ok); } catch (Exception e) { ExceptionHandler.Report(e, SR.MessageErrorSendingStudies, Context.DesktopWindow); } }