diff --git a/MTC_Adapter/MTC_Adapter/AdapterOsai.cs b/MTC_Adapter/MTC_Adapter/AdapterOsai.cs index b84a00d..e5b6d90 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterOsai.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterOsai.cs @@ -1289,23 +1289,26 @@ namespace MTC_Adapter } } - // verifica se si debba aggiornare XML (e salva in adapter dati vari) - needSave = procOreMaccOn(needSave); - needSave = procOreMaccLav(needSave); - needSave = procProgrName(needSave); - needSave = procPartId(needSave); - needSave = procPzProd(needSave); - needSave = procGiriTotUnOp(needSave); - needSave = procNumCU(needSave); - needSave = procMovTotAssi(needSave); - needSave = procAccTimeAssi(needSave); - needSave = procNumInvAssi(needSave); - needSave = procVacPump(needSave); - needSave = procVacAct(needSave); - needSave = procLubro(needSave); + if (persistenceLayer != null) + { + // verifica se si debba aggiornare XML (e salva in adapter dati vari) + needSave = procOreMaccOn(needSave); + needSave = procOreMaccLav(needSave); + needSave = procProgrName(needSave); + needSave = procPartId(needSave); + needSave = procPzProd(needSave); + needSave = procGiriTotUnOp(needSave); + needSave = procNumCU(needSave); + needSave = procMovTotAssi(needSave); + needSave = procAccTimeAssi(needSave); + needSave = procNumInvAssi(needSave); + needSave = procVacPump(needSave); + needSave = procVacAct(needSave); + needSave = procLubro(needSave); - // salvo se necessario! - if (needSave) parentForm.persistData(); + // salvo se necessario! + if (needSave) parentForm.persistData(); + } // ------------------------------------------- } diff --git a/MTC_Adapter/MTC_Adapter/MainForm.cs b/MTC_Adapter/MTC_Adapter/MainForm.cs index 13e92cd..0933427 100644 --- a/MTC_Adapter/MTC_Adapter/MainForm.cs +++ b/MTC_Adapter/MTC_Adapter/MainForm.cs @@ -159,12 +159,12 @@ namespace MTC_Adapter // se abilitato autoload conf leggo file corretto... if (utils.CRB("autoLoadConf")) { + loadXmlFile(defConfFilePath); + lg.Info("XML LOADED"); loadPersistLayer(defPersLayerFile); lg.Info("PersLayerFile READ"); agObj.loadPersData(); lg.Info("PersLayerFile LOADED"); - loadXmlFile(defConfFilePath); - lg.Info("XML LOADED"); } else { @@ -491,31 +491,38 @@ namespace MTC_Adapter public void avviaAdapter() { displayTaskAndWait("Adapter starting"); - - int porta = Convert.ToInt32(port.Text); - agObj.startAdapter(porta); - displayTaskAndWait("Adapter started!"); - - // fix buttons start/stop/dump - start.Enabled = false; - stop.Enabled = true; - dump.Enabled = true; - if (utils.CRB("openDumpOnStart")) + // se NON sta girando... + if (!agObj.adpRunning) { - displayTaskAndWait("Dump Window starting"); - apriDumpAgent(); - displayTaskAndWait("Dump Windows OK"); - } + int porta = Convert.ToInt32(port.Text); + agObj.startAdapter(porta); + displayTaskAndWait("Adapter started!"); - displayTaskAndWait("Start Timers"); - // inizializzo contatori fast/mid/slow - fastCount = utils.CRI("fastCount"); - normCount = utils.CRI("normCount"); - slowCount = utils.CRI("slowCount"); - alarmSyncCount = utils.CRI("alarmSyncCount"); - displayTaskAndWait("Adapter Running..."); - // forzo check allarmi.. - agObj.forceAlarmCheck(); + // fix buttons start/stop/dump + start.Enabled = false; + stop.Enabled = true; + dump.Enabled = true; + if (utils.CRB("openDumpOnStart")) + { + displayTaskAndWait("Dump Window starting"); + apriDumpAgent(); + displayTaskAndWait("Dump Windows OK"); + } + + displayTaskAndWait("Start Timers"); + // inizializzo contatori fast/mid/slow + fastCount = utils.CRI("fastCount"); + normCount = utils.CRI("normCount"); + slowCount = utils.CRI("slowCount"); + alarmSyncCount = utils.CRI("alarmSyncCount"); + displayTaskAndWait("Adapter Running..."); + // forzo check allarmi.. + agObj.forceAlarmCheck(); + } + else + { + displayTaskAndWait("Adapter STILL Running..."); + } } /// @@ -1131,12 +1138,12 @@ namespace MTC_Adapter if (userClickedOK == DialogResult.OK) { string XmlConfFile = openFileDial.FileName; + loadXmlFile(XmlConfFile); + lg.Info("XML LOADED"); loadPersistLayer(defPersLayerFile); lg.Info("PersLayerFile READ"); agObj.loadPersData(); lg.Info("PersLayerFile LOADED"); - loadXmlFile(XmlConfFile); - lg.Info("XML LOADED"); } } ///