示例#1
0
        public GPSGatewayService()
        {
            InitializeComponent();

            // TODO: 在此处添加代码以启动服务。
            try
            {
                string filePath = Thread.GetDomain().BaseDirectory;
                FileInfo fileInfo = new FileInfo(filePath + "\\Config\\Environment\\log4net.config");
                log4net.Config.XmlConfigurator.Configure(fileInfo);
            }
            catch (Exception ex)
            {
                Logger.Error(ex, null);
            }

            try
            {
                _GPSServer = new MulitGPSServer();
            }
            catch (Exception ex)
            {
                Logger.Error(ex, null);
            }
        }
示例#2
0
文件: Form1.cs 项目: hhahh2011/CH.Gps
        public Form1()
        {
            InitializeComponent();

            try
            {
                time = new System.Timers.Timer();
                time.AutoReset = true;
                time.Enabled = true;
                time.Elapsed += new System.Timers.ElapsedEventHandler(CheckTime);
                time.Interval = 1000;

                string filePath = Thread.GetDomain().BaseDirectory;
                FileInfo fileInfo = new FileInfo(filePath + "\\Config\\Environment\\log4net.config");
                log4net.Config.XmlConfigurator.Configure(fileInfo);

            }
            catch
            { 
            
            }
            btnClearLog.Click += new EventHandler(btnClearLog_Click);
            try
            {
                _GPSServer = new MulitGPSServer();

                //注册事件
                //_GPSServer.OnPostConnectionMessagEvent += new GPSServer.PostConnectionMessageHandler(_GPSServer_OnPostConnectionMessagEvent);

                //_GPSServer.ReceiveDataEvent += new GPSServer.ReceiveDataHandler(_GPSServer_OnReceiveDataEvent);

                //_GPSServer.CopyDataEvent += new GPSServer.CopyDataEventHandler(_GPSServer_OnCopyDataEvent);
                _GPSServer.DebugDataEvent += new MulitGPSServer.DebugDataEventHandler(_GPSServer_CopyDataEvent);

                //_GPSServer.ParsedDataEvent += new GPSServer.ParsedDataHandler(_GPSServer_OnParsedDataEvent); 

            }
            catch (Exception ex)
            {
                Logger.Error(ex, null);
            }
        }