public void StartConnectEngine(EngineLogin login) { Log.Info("StartConnectEngine:" + login.EngineIp); //int mockCount = int.Parse(TbMockTagPowerCount0.Text); if (engineDa == null) { //engineDa = new PositionEngineDA("192.168.10.155", "192.168.10.19");//todo:ip写到配置文件中 engineDa = new PositionEngineDA(login);//todo:ip写到配置文件中 engineDa.MockCount = MockCount; //engineDa.MessageReceived += EngineDa_MessageReceived; engineDa.MessageReceived += (obj) => { WriteLogLeft(GetLogText(obj)); }; //engineDa.PositionRecived += EngineDa_PositionRecived; engineDa.PositionListRecived += EngineDa_PositionListRecived; } engineDa.Start(); if (IsWriteToDb) { InitTagPosition(MockCount); StartInsertPositionTimer(); } }
public void StartConnectEngine(EngineLogin login) { //Log.Info(LogTags.Engine,"StartConnectEngine:" + login.EngineIp); WriteLogLeft(GetLogText("StartConnectEngine:" + login.EngineIp)); LocationHistoryDb db = new LocationHistoryDb(); bool r1 = db.Database.Exists(); WriteLogLeft(GetLogText("数据库是否存在:" + r1)); if (r1 == false) { bool r2 = db.Database.CreateIfNotExists(); WriteLogLeft(GetLogText("数据库创建是否成功:" + r2)); } //int mockCount = int.Parse(TbMockTagPowerCount0.Text); if (engineDa == null) { //engineDa = new PositionEngineDA("192.168.10.155", "192.168.10.19");//todo:ip写到配置文件中 engineDa = new PositionEngineDA(login);//todo:ip写到配置文件中 engineDa.MockCount = MockCount; //engineDa.MessageReceived += EngineDa_MessageReceived; engineDa.MessageReceived += (msg) => { psCount++; string m = string.Format("{0}||{1}", psCount, msg); WriteLogLeft(GetLogText(m)); }; //engineDa.PositionRecived += EngineDa_PositionRecived; engineDa.PositionListRecived += EngineDa_PositionListRecived; } engineDa.Start(); if (IsWriteToDb) { InitTagPosition(MockCount); StartInsertPositionTimer(); } }