using System;
using System.Windows.Forms;

using Medivators.Common;
using Medivators.Common.Settings;
using Medivators.Common.Logging;
using Medivators.SerialDevices;
using Medivators.Parser;

namespace TestApp
{
	static class Program
	{
//		private static SerialDeviceCollection _devices = null;

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main()
		{
			//	all this init stuff has been commented out
			//	use the virtual service form to do this. 

			////	init log providers
			//ApplicationLog primaryLog = new ApplicationLog();
			//TextLog secondaryLog = new TextLog(Utilities.PathSlash(Utilities.GetAppFolder()) + 
			//                                   Utilities.PathSlash(Utilities.GetAppName())	+
			//                                   Utilities.GetAppName() + 
			//                                   ".log");
			//primaryLog.Initialize();
			//secondaryLog.Initialize();

			////  init log
			//Log.GetInstance().Provider = primaryLog;

			////	initialize error handler
			//ErrorHandler.GetInstance().Initialize(
			//    primaryLog,
			//    secondaryLog);

			try
			{
				//	load settings
				TextSettings.GetInstance().Load(Constants.MedivatorsProgramFiles,
												Constants.MedivatorsSettingsFile);

				////	initialize devices
				//_devices = new SerialDeviceCollection(primaryLog);
				//_devices.SerialDeviceType = SupportedSerialDevices.DSD201;
				//_devices.LoadDevices();

				Application.EnableVisualStyles();
				Application.SetCompatibleTextRenderingDefault(false);
				Application.Run(new frmTest());
			}
			catch (Exception ex)
			{
				ErrorHandler.GetInstance().LogException("Main:", ex);
			}
			finally
			{
				TextSettings.GetInstance().Save();
			}
		}
	}
}