当用户为特定变量选择错误的CANoe cfg文件时,应将错误的cfg文件通知用户。 cfg文件的正确性应根据内容进行验证(例如:基于加载到每个配置中的dbc文件)
请为当前实现找到以下代码: 我需要根据可能的dbc(cfg中的相应消息和信号)进行检查,如果选择了错误的cfg,则必须在前端通知用户。 目前,我已经提到了各自的配置,但尚未对配置进行任何内容检查。
private void button2_Click(object sender, EventArgs e)
//Function to run/start CANoe measurement
{
// Execute CANoe(Obtain CANoe application objectg)
var mApp = new CANoe.Application();
var mMsr = (CANoe.Measurement)mApp.Measurement;
try
{
if (tcu == '1')
{
CANoe = new cCANoe1();
}
else if (tcu == '2')
{
CANoe = new cCANoe2();
}
log.WritetoFile("Opening CANoe configuration");
Console.WriteLine("Opening CANoe configuration");
// mApp.Open("C:\\Users\\uidr3024\\Downloads\\SRLCam4T0_Validation_ControlTool\\cfg\\SVT_SRLCam4T0_025B.cfg", true, true);
mApp.Open("C:\\MMC_Project\\Dheepika KT\\2013_42_Multibus - Simultaneous\\BR205_Multibus_2013_42_CANoe76.CFG", true, true);
log.WritetoFile("Starting measurement ");
CANoe.startMeasurement(this);
}
catch (System.Exception ex)
{
System.Console.WriteLine(ex.Message);
log.WritetoFile("Exception:" + ex.Message);
MessageBox.Show("CANoe application error", "Error");
}
if (textBox1.Text != String.Empty && System.IO.File.Exists(textBox1.Text))
{
// The textbox has a filename in it, use it
mApp.Open(textBox1.Text, true, true);
}
else
{
// The user hasn't selected a config file, launch with default
mApp.Open("C:\\MMC_Project\\Dheepika KT\\2013_42_Multibus - Simultaneous\\BR205_Multibus_2013_42_CANoe76.CFG", true, true);
}
}
应该完成cfg中的内容验证,如果选择了错误的cfg,则应通知用户。