取消Cmd的console的实时消息和运行cmd窗口弹出

This commit is contained in:
2025-02-26 16:16:35 +08:00
parent 0bbe361ab7
commit f02e336f34
2 changed files with 15 additions and 15 deletions

View File

@@ -350,19 +350,19 @@ namespace CapMachine.Wpf.CanDrive
{
StringBuilder MsgName = new StringBuilder(32);
CAN_DBCParser.DBC_GetMsgName(DBCHandle, i, MsgName);
Console.WriteLine("Msg.Name = {0}", MsgName);
//Console.WriteLine("Msg.Name = {0}", MsgName);
int DBCSigNum = CAN_DBCParser.DBC_GetMsgSignalQuantity(DBCHandle, MsgName);
StringBuilder Publisher = new StringBuilder(32);
CAN_DBCParser.DBC_GetMsgPublisher(DBCHandle, MsgName, Publisher);
long MsgId;
MsgId = CAN_DBCParser.DBC_GetMsgIDByName(DBCHandle, MsgName);
Console.Write("Signals:");
//Console.Write("Signals:");
for (int j = 0; j < DBCSigNum; j++)
{
StringBuilder SigName = new StringBuilder(32);
CAN_DBCParser.DBC_GetMsgSignalName(DBCHandle, MsgName, j, SigName);
Console.Write("{0} ", SigName);
//Console.Write("{0} ", SigName);
//增加信息数据
ListCanDbcModel.Add(new CanDbcModel()
@@ -376,7 +376,7 @@ namespace CapMachine.Wpf.CanDrive
Publisher = Publisher.ToString()
});
}
Console.WriteLine("");
//Console.WriteLine("");
}
//Dbc解析成功
@@ -426,11 +426,11 @@ namespace CapMachine.Wpf.CanDrive
int SendedNum = USB2CAN.CAN_SendMsg(DevHandle, WriteCANIndex, CanMsg, (uint)CanMsg.Length);
if (SendedNum >= 0)
{
Console.WriteLine("Success send frames:{0}", SendedNum);
//Console.WriteLine("Success send frames:{0}", SendedNum);
}
else
{
Console.WriteLine("Send CAN data failed! {0}", SendedNum);
//Console.WriteLine("Send CAN data failed! {0}", SendedNum);
}
}
@@ -527,11 +527,11 @@ namespace CapMachine.Wpf.CanDrive
int SendedNum = USB2CAN.CAN_SendMsg(DevHandle, WriteCANIndex, CanMsg, (uint)CanMsg.Length);
if (SendedNum >= 0)
{
Console.WriteLine("Success send frames:{0}", SendedNum);
//Console.WriteLine("Success send frames:{0}", SendedNum);
}
else
{
Console.WriteLine("Send CAN data failed! {0}", SendedNum);
//Console.WriteLine("Send CAN data failed! {0}", SendedNum);
}
}
catch (Exception ex)
@@ -568,14 +568,14 @@ namespace CapMachine.Wpf.CanDrive
//CanMsgBuffer[i] = (USB2CAN.CAN_MSG)Marshal.PtrToStructure((IntPtr)((UInt32)msgPtRead + i * Marshal.SizeOf(typeof(USB2CAN.CAN_MSG))), typeof(USB2CAN.CAN_MSG)); //有溢出报错
CanMsgBuffer[i] = (USB2CAN.CAN_MSG)Marshal.PtrToStructure((IntPtr)(msgPtRead + i * Marshal.SizeOf(typeof(USB2CAN.CAN_MSG))), typeof(USB2CAN.CAN_MSG));
Console.WriteLine("CanMsg[{0}].ID = 0x{1}", i, CanMsgBuffer[i].ID.ToString("X8"));
Console.WriteLine("CanMsg[{0}].TimeStamp = {1}", i, CanMsgBuffer[i].TimeStamp);
Console.Write("CanMsg[{0}].Data = ", i);
//Console.WriteLine("CanMsg[{0}].ID = 0x{1}", i, CanMsgBuffer[i].ID.ToString("X8"));
//Console.WriteLine("CanMsg[{0}].TimeStamp = {1}", i, CanMsgBuffer[i].TimeStamp);
//Console.Write("CanMsg[{0}].Data = ", i);
for (int j = 0; j < CanMsgBuffer[i].DataLen; j++)
{
Console.Write("{0} ", CanMsgBuffer[i].Data[j].ToString("X2"));
}
Console.WriteLine("");
//Console.WriteLine("");
//报文给高速记录的服务
HighSpeedDataService.AppendOrUpdateMsg(new Models.HighSpeed.CommMsg()
@@ -589,11 +589,11 @@ namespace CapMachine.Wpf.CanDrive
}
else if (CanNum == 0)
{
Console.WriteLine("No CAN data!");
//Console.WriteLine("No CAN data!");
}
else
{
Console.WriteLine("Get CAN data error!");
//Console.WriteLine("Get CAN data error!");
}
Console.WriteLine("");

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>