Ejemplo n.º 1
0
        public override void Start()
        {
            base.Start();

            _timer = new Timer(OnTimer, null, 500);
            _timer.Start();
        }
Ejemplo n.º 2
0
        public SamplesForm()
        {
            InitializeComponent();
            _buttonStorageScuVerify.Text = STR_Verify;

            if (String.IsNullOrEmpty(Properties.Settings.Default.ScpStorageFolder))
            {
                Properties.Settings.Default.ScpStorageFolder = Path.Combine(Path.GetTempPath(), "DicomImages");
            }

            _destinationSyntaxCombo.Items.Clear();
            _destinationSyntaxCombo.Items.Add(TransferSyntax.ExplicitVrLittleEndian);
            foreach (TransferSyntax syntax in DicomCodecRegistry.GetCodecTransferSyntaxes())
            {
                _destinationSyntaxCombo.Items.Add(syntax);
            }

            ComboBoxQueryScuQueryTypeSelectedIndexChanged(null, null);
            ComboBoxMoveScuQueryTypeSelectedIndexChanged(null, null);

            // Logging stuff
            Closing += SamplesFormClosing;
            BasicConfigurator.Configure(_appender);
            _timer = new Timer(delegate
            {
                try
                {
                    LoggingEvent[] events = _appender.GetEvents();
                    if (events != null && events.Length > 0)
                    {
                        // if there are events, we clear them from the logger,
                        // since we're done with them
                        _appender.Clear();
                        foreach (LoggingEvent ev in events)
                        {
                            // the line we want to log
                            string line = String.Format("({0}) {1} {2} [{3}]: {4}\r\n",
                                                        ev.ThreadName,
                                                        ev.TimeStamp.ToShortDateString(),
                                                        ev.TimeStamp.ToLongTimeString(), ev.Level,
                                                        ev.RenderedMessage);

                            AppendText(line);

                            if (ev.ExceptionObject != null)
                            {
                                AppendText(string.Format("{0}: {1}\r\n", ev.ExceptionObject, ev.ExceptionObject.Message));
                                AppendText("Stack Trace:\r\n" + ev.ExceptionObject.StackTrace + "\r\n");
                            }
                        }
                    }
                }
                catch (Exception x)
                {
                    Platform.Log(LogLevel.Error, x, "Unexpected exception with logging event");
                }
            }, null, 500);
            _timer.Start();
        }
Ejemplo n.º 3
0
        public override void Stop()
        {
            base.Stop();

            _timer.Stop();
            _timer.Dispose();
            _timer = null;
        }