Click here to Skip to main content
12,699,489 members (34,929 online)
Click here to Skip to main content
Articles » Languages » C# » Applications » Downloads

Stats

74.3K views
5.9K downloads
48 bookmarked
Posted

Storing ECG to a PACS

, 16 Oct 2008 Apache
An article on a service that will store an ECG copied to a directory at a PACS. (supported formats SCP-ECG, DICOM-ECG and a recent version of HL7 aECG)
ECGtoPACS_demo
dicomcs.dll
ECGConversion.dll
ECGCpluginaECG.dll
ECGCpluginDICOM.dll
ECGtoPACS.exe
log4net.dll
ECGtoPACS_src
ECGtoPACS.csproj.user
ECGtoPACS.ico
ECGtoPACS.suo
libs
dicomcs.dll
ECGConversion.dll
ECGCpluginaECG.dll
ECGCpluginDICOM.dll
log4net.dll
/***************************************************************************
Copyright 2008, Thoraxcentrum, Erasmus MC, Rotterdam, The Netherlands

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Written by Maarten JB van Ettinger.

****************************************************************************/
using System;
using System.Diagnostics;
using System.Text;
using System.Threading;

namespace ECGtoPACS
{
	public class ServiceLogger
	{
		private static ServiceLogger s_Instance;
		private static Mutex s_Mutex = new Mutex();

		public static ServiceLogger Instance
		{
			get
			{
				s_Mutex.WaitOne();

				if (s_Instance == null)
				{
					s_Instance = new ServiceLogger();
				}

				s_Mutex.ReleaseMutex();

				return s_Instance;
			}
		}

		private Boolean m_bLoggingEnabled = false;
		private EventLog m_Log = null;

		private ServiceLogger()
		{
            
		}

		~ServiceLogger()
		{

		}

		public EventLog EventLogger
		{
			set
			{
				m_Log = value;

				m_bLoggingEnabled = m_Log != null;
			}
		}

		public void Log(String message, EventLogEntryType type)
		{
			if (m_bLoggingEnabled)
				m_Log.WriteEntry(message, type);
			else
				Console.Error.WriteLine("{0}: {1}", type.ToString(), message);
		}

		public void Log(String message)
		{
			if (m_bLoggingEnabled)
				m_Log.WriteEntry(message, EventLogEntryType.Information);
			else
				Console.Error.WriteLine("{0}: {1}", EventLogEntryType.Information.ToString(), message);
		}

		public void Log(Exception ex)
		{
			if (m_bLoggingEnabled)
				m_Log.WriteEntry(ex.Message, EventLogEntryType.Error);
			else
				Console.Error.WriteLine("{0}: {1}", EventLogEntryType.Information.ToString(), ex.ToString());
		}

		public void Log(Exception ex, EventLogEntryType type)
		{
			if (m_bLoggingEnabled)
				m_Log.WriteEntry(ex.Message, type);
			else
				Console.Error.WriteLine("{0}: {1}", type.ToString(), ex.ToString());
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0

Share

About the Author

MJB van Ettinger
Software Developer Erasmus MC
Netherlands Netherlands
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170118.1 | Last Updated 16 Oct 2008
Article Copyright 2008 by MJB van Ettinger
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid