private void closeDB() { GroupboxList.Clear(); SyntaxList.Clear(); MetadataList.Clear(); settings = null; }
private void readDB() { GroupboxList = database.readGroupboxList(); SyntaxList = database.readSyntaxList(); MetadataList = database.readMetadataList(); settings = database.readSettings(); }
public Settings readSettings() { Settings settings = new Settings(); List<object> values = new List<object>(); values = dbReader(Cmdstring.settings, Cmdstring.settings_fieldlist); if (values[0].GetType().ToString() != "System.DBNull") settings.baudRate = Convert.ToInt32(values[0]); if (values[1].GetType().ToString() != "System.DBNull") settings.dataBits = Convert.ToInt32(values[1]); if (values[2].GetType().ToString() != "System.DBNull") settings.discardNull = Convert.ToBoolean(values[2]); if (values[3].GetType().ToString() != "System.DBNull") settings.dtrEnable = Convert.ToBoolean(values[3]); if (values[4].GetType().ToString() != "System.DBNull") settings.handShake = Convert.ToInt32(values[4]); if (values[5].GetType().ToString() != "System.DBNull") settings.Parity = Convert.ToInt32(values[5]); if (values[6].GetType().ToString() != "System.DBNull") settings.parityReplace = Convert.ToInt32(values[6]); if (values[7].GetType().ToString() != "System.DBNull") settings.portName = values[7].ToString(); if (values[8].GetType().ToString() != "System.DBNull") settings.readBufferSize = Convert.ToInt32(values[8]); if (values[9].GetType().ToString() != "System.DBNull") settings.readTimeOut = Convert.ToInt32(values[9]); if (values[10].GetType().ToString() != "System.DBNull") settings.receivedBytesThreshold = Convert.ToInt32(values[10]); if (values[11].GetType().ToString() != "System.DBNull") settings.rtsEnable = Convert.ToBoolean(values[11]); if (values[12].GetType().ToString() != "System.DBNull") settings.stopBits = Convert.ToInt32(values[12]); if (values[13].GetType().ToString() != "System.DBNull") settings.writeBufferSize = Convert.ToInt32(values[13]); if (values[14].GetType().ToString() != "System.DBNull") settings.writeTimeout = Convert.ToInt32(values[14]); return settings; }