//readSettings: return a property that define behavior of the connection 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; }
//---- private void cmdReadFromDB() { GroupboxList = dataBase.readGroupboxList(); //cmdGroupList = dataBase.readGroupboxList(); //controlBoxList = dataBase.readControlBoxList(); set = dataBase.readSettings(); meta = dataBase.readMetadataList(); syn = dataBase.readSyntaxList(); //test = dataBase.testread(); //MessageBox.Show(test); }