private void InitCustomStuff() { ConfigurationElements.InitConfig(); AutoMapperInitiazlier autoMapperInit = new AutoMapperInitiazlier(); autoMapperInit.InitMapper(); _logger = IoCContainer.GetInstace <ICustomLogger>(); Database.SetInitializer(new MigrateDatabaseToLatestVersion <DbContext, CustomContextMigrationConfig>()); }
/// <summary> /// Sets HART Communication configuration by checking string parameters for content. /// If parameter is not empty, configuration is done with parameters. /// If parameter is empty, no configuration is done. Default is used. /// </summary> /// <param name="communicationInterface"> /// Communication Interface: /// <br>HART modem</br> /// <br>HART multiplexer</br> /// </param> /// <param name="baudrate"> /// Serial Interface /// <br>1200</br> /// <br>2400</br> /// <br>9600</br> /// <br>19200</br> /// <br>38400</br> /// <br>57600</br> /// </param> /// <param name="rtsControl"> /// <br>Disable</br> /// <br>Enable</br> /// <br>Handshake</br> /// <br>Toggle</br> /// </param> /// <param name="serialInterface"> /// <br>COM1</br> /// <br>COM2</br> /// <br>...</br> /// </param> /// <param name="master"> /// <br>Primary Master</br> /// <br>Secondary Master</br> /// </param> /// <param name="preamble"> /// <br>5 ... 20</br> /// </param> /// <param name="retries"> /// <br>1 ... 10</br> /// </param> /// <param name="startAddress"> /// <br>Start address range: 0 ... 63</br> /// </param> /// <param name="endAddress"> /// <br>End address range: 0 ... 63</br> /// </param> /// <returns> /// <br>True: If call worked fine</br> /// <br>False: If an error occurred</br> /// </returns> public bool SetProperties( string communicationInterface, string baudrate, string rtsControl, string serialInterface, string master, string preamble, string retries, string startAddress, string endAddress) { bool result = false; if (communicationInterface.Length > 0) { try { ConfigurationElements.cobCommunicationInterface.Click(DefaultValues.locDefaultLocation); ConfigurationElements.liComboboxList(communicationInterface).Click(DefaultValues.locDefaultLocation); result = true; } catch (Exception exception) { Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), exception.Message); result = false; } } if (baudrate.Length > 0) { try { ConfigurationElements.cobBaudrate.Click(DefaultValues.locDefaultLocation); ConfigurationElements.liComboboxList(baudrate).Click(DefaultValues.locDefaultLocation); result = true; } catch (Exception exception) { Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), exception.Message); result = false; } } if (rtsControl.Length > 0) { try { ConfigurationElements.cobRTSControl.Click(DefaultValues.locDefaultLocation); ConfigurationElements.liComboboxList(rtsControl).Click(DefaultValues.locDefaultLocation); result = true; } catch (Exception exception) { Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), exception.Message); result = false; } } if (serialInterface.Length > 0) { try { ConfigurationElements.cobSerial.Click(DefaultValues.locDefaultLocation); ConfigurationElements.liComboboxList(serialInterface).Click(DefaultValues.locDefaultLocation); result = true; } catch (Exception exception) { Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), exception.Message); result = false; } } if (master.Length > 0) { try { ConfigurationElements.cobMaster.Click(DefaultValues.locDefaultLocation); ConfigurationElements.liComboboxList(master).Click(DefaultValues.locDefaultLocation); result = true; } catch (Exception exception) { Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), exception.Message); result = false; } } if (preamble.Length > 0) { try { ConfigurationElements.cobPreamble.Click(DefaultValues.locDefaultLocation); ConfigurationElements.liComboboxList(preamble).Click(DefaultValues.locDefaultLocation); result = true; } catch (Exception exception) { Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), exception.Message); result = false; } } if (retries.Length > 0) { try { ConfigurationElements.cobRetries.Click(DefaultValues.locDefaultLocation); ConfigurationElements.liComboboxList(retries).Click(DefaultValues.locDefaultLocation); result = true; } catch (Exception exception) { Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), exception.Message); result = false; } } if (startAddress.Length > 0) { try { ConfigurationElements.cobStartAddress.Click(DefaultValues.locDefaultLocation); ConfigurationElements.liComboboxList(startAddress).Click(DefaultValues.locDefaultLocation); result = true; } catch (Exception exception) { Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), exception.Message); result = false; } } if (endAddress.Length > 0) { try { ConfigurationElements.cobEndAddress.Click(DefaultValues.locDefaultLocation); ConfigurationElements.liComboboxList(endAddress).Click(DefaultValues.locDefaultLocation); result = true; } catch (Exception exception) { Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), exception.Message); result = false; } } return(result); }
public static void setConfigurationElements(ref Data configuration, ConfigurationElements e, String s) { switch (e) { case ConfigurationElements.IEEE_MAL: configuration.IEEE_MAL = s; break; case ConfigurationElements.IEEE_MAM: configuration.IEEE_MAM = s; break; case ConfigurationElements.IEEE_MAS: configuration.IEEE_MAS = s; break; case ConfigurationElements.IEEE_IAB: configuration.IEEE_IAB = s; break; case ConfigurationElements.IEEE_CID: configuration.IEEE_CID = s; break; case ConfigurationElements.IEEE_Ethertype: configuration.IEEE_Ethertype = s; break; case ConfigurationElements.IEEE_Manufacturer: configuration.IEEE_Manufacturer = s; break; case ConfigurationElements.IEEE_Operator: configuration.IEEE_Operator = s; break; } saveConfiguration(ref configuration); }
public static String getConfigurationElements(ref Data configuration, ConfigurationElements e) { switch (e) { case ConfigurationElements.IEEE_MAL: return configuration.IEEE_MAL; case ConfigurationElements.IEEE_MAM: return configuration.IEEE_MAM; case ConfigurationElements.IEEE_MAS: return configuration.IEEE_MAS; case ConfigurationElements.IEEE_IAB: return configuration.IEEE_IAB; case ConfigurationElements.IEEE_CID: return configuration.IEEE_CID; case ConfigurationElements.IEEE_Ethertype: return configuration.IEEE_Ethertype; case ConfigurationElements.IEEE_Manufacturer: return configuration.IEEE_Manufacturer; case ConfigurationElements.IEEE_Operator: return configuration.IEEE_Operator; } return (String.Empty); }
public static DatabaseInfo getDatabaseInfo(ref Data configuration, ConfigurationElements e) { switch (e) { case ConfigurationElements.IEEE_MAL: return (new DatabaseInfo(@"ieeeMAL.csv", configuration.IEEE_MAL)); case ConfigurationElements.IEEE_MAM: return (new DatabaseInfo(@"ieeeMAM.csv", configuration.IEEE_MAM)); case ConfigurationElements.IEEE_MAS: return (new DatabaseInfo(@"ieeeMAS.csv", configuration.IEEE_MAS)); case ConfigurationElements.IEEE_IAB: return (new DatabaseInfo(@"ieeeIAB.csv", configuration.IEEE_IAB)); case ConfigurationElements.IEEE_CID: return (new DatabaseInfo(@"ieeeCID.csv", configuration.IEEE_CID)); case ConfigurationElements.IEEE_Ethertype: return (new DatabaseInfo(@"ieeeETH.csv", configuration.IEEE_Ethertype)); case ConfigurationElements.IEEE_Manufacturer: return (new DatabaseInfo(@"ieeeMID.csv", configuration.IEEE_Manufacturer)); case ConfigurationElements.IEEE_Operator: return (new DatabaseInfo(@"ieeeCID.csv", configuration.IEEE_Operator)); } return (new DatabaseInfo(String.Empty, String.Empty)); }