private void _mnuAdd_Click(object sender, EventArgs e)
        {
            try
            {
                ExternalType externalType = (ExternalType)((ToolStripMenuItem)sender).Tag;
                IExternal    external     = externalType.CreateExternal();

                IExternalPropertiesComponent component = externalType.CreateExternalPropertiesComponent();
                component.Load(external);

                SimpleComponentContainer container = new SimpleComponentContainer(component);
                if (_component.DesktopWindow.ShowDialogBox(container, Resources.TitleNewExternal) == DialogBoxAction.Ok)
                {
                    component.Update(external);
                    _component.Externals.Add(external);
                    ListViewItem lvi = CreateItem(external);
                    _listExternals.Items.Add(lvi);
                    lvi.Selected = true;
                    _component.FlagModified();
                }
            }
            catch (Exception ex)
            {
                Platform.Log(LogLevel.Error, ex, "An error occured while adding an external application definition.");
                MessageBox.Show(this, Resources.MessageErrorAddingExternal);
            }
        }
예제 #2
0
		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);
			}
		}
예제 #3
0
        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);
            }
        }
예제 #4
0
		public void Show()
		{
			ColumnPickerComponent component = new ColumnPickerComponent(base.Columns);
			SimpleComponentContainer container = new SimpleComponentContainer(component);
			DialogBoxAction action = base.DesktopWindow.ShowDialogBox(container, SR.AddRemoveColumns);
			if (action == DialogBoxAction.Ok)
			{
				base.Columns.Clear();
				foreach (StudyFilterColumn.ColumnDefinition column in component.Columns)
				{
					base.Columns.Add(column.Create());
				}

				base.RefreshTable();
			}
		}
예제 #5
0
        public void Show()
        {
            ColumnPickerComponent    component = new ColumnPickerComponent(base.Columns);
            SimpleComponentContainer container = new SimpleComponentContainer(component);
            DialogBoxAction          action    = base.DesktopWindow.ShowDialogBox(container, SR.AddRemoveColumns);

            if (action == DialogBoxAction.Ok)
            {
                base.Columns.Clear();
                foreach (StudyFilterColumn.ColumnDefinition column in component.Columns)
                {
                    base.Columns.Add(column.Create());
                }

                base.RefreshTable();
            }
        }
        private void _btnEdit_Click(object sender, EventArgs e)
        {
            if (this.SelectedItem != null)
            {
                try
                {
                    IExternal external = this.SelectedItem.Tag as IExternal;
                    if (external != null)
                    {
                        foreach (ExternalType externalType in _externalTypes)
                        {
                            if (externalType.SupportsExternal(external))
                            {
                                IExternalPropertiesComponent component = externalType.CreateExternalPropertiesComponent();
                                component.Load(external);

                                SimpleComponentContainer container = new SimpleComponentContainer(component);
                                if (_component.DesktopWindow.ShowDialogBox(container, string.Format(Resources.TitleEditProperties, external.Label)) == DialogBoxAction.Ok)
                                {
                                    component.Update(external);
                                    ResetExternalList();
                                    foreach (ListViewItem item in _listExternals.Items)
                                    {
                                        if (item.Tag == external)
                                        {
                                            item.Selected = true;
                                            break;
                                        }
                                    }
                                    _component.FlagModified();
                                }
                                break;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Platform.Log(LogLevel.Error, ex, "An error occured while editing an external application definition.");
                    MessageBox.Show(this, Resources.MessageErrorEditingExternal);
                }
            }
        }
        public SimpleComponentContainerControl(SimpleComponentContainer component)
        {
            _component = component;

            InitializeComponent();

            this.AcceptButton = _okButton;
            this.CancelButton = _cancelButton;

            Control contentControl = _component.ComponentHost.ComponentView.GuiElement as Control;

            // Make the dialog conform to the size of the content
            Size sizeDiff = contentControl.Size - _contentPanel.Size;

            _contentPanel.Controls.Add(contentControl);

            this.Size          += sizeDiff;
            contentControl.Dock = DockStyle.Fill;

            _okButton.Click     += new EventHandler(OnOkButtonClicked);
            _cancelButton.Click += new EventHandler(OnCancelButtonClicked);
        }
		public SimpleComponentContainerControl(SimpleComponentContainer component)
		{
			_component = component;

			InitializeComponent();

			this.AcceptButton = _okButton;
			this.CancelButton = _cancelButton;

			Control contentControl = _component.ComponentHost.ComponentView.GuiElement as Control;

			// Make the dialog conform to the size of the content
			Size sizeDiff = contentControl.Size - _contentPanel.Size;

			_contentPanel.Controls.Add(contentControl);

			this.Size += sizeDiff;
			contentControl.Dock = DockStyle.Fill;

			_okButton.Click += new EventHandler(OnOkButtonClicked);
			_cancelButton.Click += new EventHandler(OnCancelButtonClicked);
		}
예제 #9
0
        public void PublishToServer()
        {
            AENavigatorComponent aeNavigator = new AENavigatorComponent();

            aeNavigator.IsReadOnly             = true;
            aeNavigator.ShowCheckBoxes         = false;
            aeNavigator.ShowLocalDataStoreNode = false;
            aeNavigator.ShowTitlebar           = false;
            aeNavigator.ShowTools = false;

            SimpleComponentContainer dialogContainer = new SimpleComponentContainer(aeNavigator);
            DialogBoxAction          code            = this.Host.DesktopWindow.ShowDialogBox(dialogContainer, SR.SelectDestination);

            if (code != DialogBoxAction.Ok)
            {
                return;
            }

            if (aeNavigator.SelectedServers == null || aeNavigator.SelectedServers.Servers == null || aeNavigator.SelectedServers.Servers.Count == 0)
            {
                return;
            }

            if (aeNavigator.SelectedServers.Servers.Count < 1)
            {
                return;
            }

            BackgroundTask task = new BackgroundTask(
                delegate {
                foreach (Server destinationAE in aeNavigator.SelectedServers.Servers)
                {
                    _studyBuilder.Publish(ServerTree.GetClientAETitle(), destinationAE.AETitle, destinationAE.Host, destinationAE.Port);
                }
            }, false);

            ProgressDialog.Show(task, base.Host.DesktopWindow, true, ProgressBarStyle.Marquee);
        }
예제 #10
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);
                }
            }
        }
        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;
        }
		public void SetComponent(IApplicationComponent component)
		{
			_component = (SimpleComponentContainer)component;
		}
예제 #13
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);
                }
            }
        }
예제 #14
0
		public void PublishToServer()
		{
			AENavigatorComponent aeNavigator = new AENavigatorComponent();
			aeNavigator.IsReadOnly = true;
			aeNavigator.ShowCheckBoxes = false;
			aeNavigator.ShowLocalDataStoreNode = false;
			aeNavigator.ShowTitlebar = false;
			aeNavigator.ShowTools = false;

			SimpleComponentContainer dialogContainer = new SimpleComponentContainer(aeNavigator);
			DialogBoxAction code = this.Host.DesktopWindow.ShowDialogBox(dialogContainer, SR.SelectDestination );

			if (code != DialogBoxAction.Ok)
				return;

			if (aeNavigator.SelectedServers == null || aeNavigator.SelectedServers.Servers == null || aeNavigator.SelectedServers.Servers.Count == 0) {
				return;
			}

			if (aeNavigator.SelectedServers.Servers.Count < 1) {
				return;
			}

			BackgroundTask task = new BackgroundTask(
				delegate {
					foreach (Server destinationAE in aeNavigator.SelectedServers.Servers) {
						_studyBuilder.Publish(ServerTree.GetClientAETitle(), destinationAE.AETitle, destinationAE.Host, destinationAE.Port);
					}
				}, false);

			ProgressDialog.Show(task, base.Host.DesktopWindow, true, ProgressBarStyle.Marquee);
		}
		private void _mnuAdd_Click(object sender, EventArgs e)
		{
			try
			{
				ExternalType externalType = (ExternalType) ((ToolStripMenuItem) sender).Tag;
				IExternal external = externalType.CreateExternal();

				IExternalPropertiesComponent component = externalType.CreateExternalPropertiesComponent();
				component.Load(external);

				SimpleComponentContainer container = new SimpleComponentContainer(component);
				if (_component.DesktopWindow.ShowDialogBox(container, Resources.TitleNewExternal) == DialogBoxAction.Ok)
				{
					component.Update(external);
					_component.Externals.Add(external);
					ListViewItem lvi = CreateItem(external);
					_listExternals.Items.Add(lvi);
					lvi.Selected = true;
					_component.FlagModified();
				}
			}
			catch (Exception ex)
			{
				Platform.Log(LogLevel.Error, ex, "An error occured while adding an external application definition.");
				MessageBox.Show(this, Resources.MessageErrorAddingExternal);
			}
		}
예제 #16
0
        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);
            }
        }
 public void SetComponent(IApplicationComponent component)
 {
     _component = (SimpleComponentContainer)component;
 }
		private void _btnEdit_Click(object sender, EventArgs e)
		{
			if (this.SelectedItem != null)
			{
				try
				{
					IExternal external = this.SelectedItem.Tag as IExternal;
					if (external != null)
					{
						foreach (ExternalType externalType in _externalTypes)
						{
							if (externalType.SupportsExternal(external))
							{
								IExternalPropertiesComponent component = externalType.CreateExternalPropertiesComponent();
								component.Load(external);

								SimpleComponentContainer container = new SimpleComponentContainer(component);
								if (_component.DesktopWindow.ShowDialogBox(container, string.Format(Resources.TitleEditProperties, external.Label)) == DialogBoxAction.Ok)
								{
									component.Update(external);
									ResetExternalList();
									foreach (ListViewItem item in _listExternals.Items)
									{
										if (item.Tag == external)
										{
											item.Selected = true;
											break;
										}
									}
									_component.FlagModified();
								}
								break;
							}
						}
					}
				}
				catch (Exception ex)
				{
					Platform.Log(LogLevel.Error, ex, "An error occured while editing an external application definition.");
					MessageBox.Show(this, Resources.MessageErrorEditingExternal);
				}
			}
		}