Esempio n. 1
0
        private void ToggleService()
        {
            if (_server == null)
            {
                SaveSettings();

                if (Config.Instance.Printers.Count == 0)
                {
                    MessageBox.Show(this, "Please configure your printer before starting the DICOM server.", "Configuration Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                EnableControls(false);
                bttnStartStop.Text = "Stop";

                try {
                    _server = new DcmServer <NPrintService>();
                    _server.AddPort((int)nuDicomPort.Value, DcmSocketType.TCP);
                    _server.Start();
                    return;
                }
                catch (Exception ex) {
                    MessageBox.Show(this, ex.Message, "DICOM Server Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            _server.Stop();
            _server = null;

            EnableControls(true);
            bttnStartStop.Text = "Start";
        }
Esempio n. 2
0
        private void Main_Loaded(object sender, RoutedEventArgs e)
        {
            storeScp = new DcmServer <CStoreService>();
            storeScp.AddPort(104, DcmSocketType.TCP);

            storeScp.OnDicomClientCreated +=
                delegate(DcmServer <CStoreService> server, CStoreService client, DcmSocketType socketType)
            {
                client.OnCStoreRequest +=
                    delegate(CStoreService client1, byte presentationId, ushort messageId,
                             DicomUID affectedInstance, DcmPriority priority, string moveAe,
                             ushort moveMessageId, DcmDataset dataset, string fileName)
                {
                    if (dataset != null)
                    {
                        dataset.PreloadDeferredBuffers();
                        Dispatcher.BeginInvoke(
                            new AddToSelectedStudyDatasetsDelegate(d => SelectedStudyDatasets.Add(d)),
                            dataset);
                    }
                    return(new DcmStatus("0000", DcmState.Success, "Success"));
                };
            };
            storeScp.Start();
        }
Esempio n. 3
0
        protected override void OnStart(string[] args)
        {
            server = new DcmServer<CImageServer>();

            //server.OnDicomClientCreated = (a, s, t) => { s.ThrottleSpeed = 0; };

            ConfigureServerToListenOnAllPorts();

            server.Start();

            LogStartup();
        }
Esempio n. 4
0
        private static void StartStorageServer(int port)
        {
            _storageServer = new Dicom.Network.Server.DcmServer<CStoreService>();
            _storageServer.AddPort(port, DcmSocketType.TCP);
            _storageServer.OnDicomClientCreated = (s, c, t) =>
            {
                c.UseFileBuffer = false;
                //c.OnCStoreRequestProgress +=
                //    (client, pcid, command, dataset, progress) =>
                //        {
                //         //   Console.WriteLine("{0} {1}%",progress.BytesTransfered,
                //         //                     (double)progress.BytesTransfered/progress.EstimatedBytesTotal);

                //        };
            };
            _storageServer.Start();
        }
Esempio n. 5
0
        private void Main_Loaded(object sender, RoutedEventArgs e)
        {
            storeScp = new DcmServer<CStoreService>();
            storeScp.AddPort(104, DcmSocketType.TCP);

            storeScp.OnDicomClientCreated +=
                delegate(DcmServer<CStoreService> server, CStoreService client, DcmSocketType socketType)
                {
                    client.OnCStoreRequest +=
                        delegate(CStoreService client1, byte presentationId, ushort messageId,
                                 DicomUID affectedInstance, DcmPriority priority, string moveAe,
                                 ushort moveMessageId, DcmDataset dataset, string fileName)
                        {
                            if (dataset != null)
                            {
                                dataset.PreloadDeferredBuffers();
                                Dispatcher.BeginInvoke(
                                    new AddToSelectedStudyDatasetsDelegate(d => SelectedStudyDatasets.Add(d)),
                                    dataset);
                            }
                            return new DcmStatus("0000", DcmState.Success, "Success");
                        };

                };
            storeScp.Start();
        }
Esempio n. 6
0
		private void ToggleService() {
			if (_server == null) {
				SaveSettings();

				if (Config.Instance.Printers.Count == 0) {
					MessageBox.Show(this, "Please configure your printer before starting the DICOM server.", "Configuration Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
					return;
				}

				EnableControls(false);
				bttnStartStop.Text = "Stop";

				try {
					_server = new DcmServer<NPrintService>();
					_server.AddPort((int)nuDicomPort.Value, DcmSocketType.TCP);
					_server.Start();
					return;
				}
				catch (Exception ex) {
					MessageBox.Show(this, ex.Message, "DICOM Server Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}

			_server.Stop();
			_server = null;

			EnableControls(true);
			bttnStartStop.Text = "Start";
		}