private void checkIfConfigExists() { ReadInConfig config = new ReadInConfig(); if (!config.runConfig()) { MessageBox.Show("Config file is not setup. DeviceID is mandatory to fill in, rest is optional."); sendButton.Enabled = false; } else { getSettingsFromConfig(config); } }
private void getSettingsFromConfig(ReadInConfig config) { config.readConfig(ref deviceID, ref user, ref password, ref writeToExcelCheck, ref computerName); if (deviceID.Length < 15) { MessageBox.Show("Config file does not containe DeviceID. DeviceID and ComputerName is mandatory to fill in."); sendButton.Enabled = false; } else if (computerName.Length < 5) { MessageBox.Show("Config file does not contain ComputerName. DeviceID and ComputerName is mandatory to fill in."); sendButton.Enabled = false; } writeToExcelChkBox.Checked = writeToExcelCheck; userID.Text = user; passwordTxtBox.Text = password; }