Example #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";
        }
Example #2
0
 private void Main_Unloaded(object sender, RoutedEventArgs e)
 {
     if (storeScp != null)
     {
         storeScp.Stop();
     }
 }