切换CANLIN配置程序后的数据刷新,如果当前的没有,则刷新,不需要展示上一次的数据

This commit is contained in:
2025-08-13 17:12:04 +08:00
parent 1d32e59360
commit d6f6022482
11 changed files with 272 additions and 85 deletions

View File

@@ -55,6 +55,17 @@ namespace CapMachine.Wpf.ViewModels
//MachineDataService = machineDataService;
DialogService = dialogService;
//数据波特率
DataBaudRateCbxItems = new ObservableCollection<CbxItems>()
{
new CbxItems(){ Key="38400",Text="38400"},
new CbxItems(){ Key="19200",Text="19200"},
new CbxItems(){ Key="14400",Text="14400"},
new CbxItems(){ Key="9600",Text="9600"},
new CbxItems(){ Key="4800",Text="4800"},
new CbxItems(){ Key="2400",Text="2400"},
};
WriteNameCbxItems = new ObservableCollection<CbxItems>()
{
new CbxItems(){ Key="转速",Text="转速"},
@@ -156,11 +167,20 @@ namespace CapMachine.Wpf.ViewModels
}
}
else
{
ListWriteCanLinRWConfigDto = new ObservableCollection<CanLinRWConfigDto>();
}
var ReadData = SelectCanLinConfigPro.CanLinConfigContents!.Where(a => a.RWInfo == RW.Read).ToList();
if (ReadData != null && ReadData.Count > 0)
{
ListReadCanLinRWConfigDto = new ObservableCollection<CanLinRWConfigDto>(Mapper.Map<List<CanLinRWConfigDto>>(ReadData));
}
else
{
ListReadCanLinRWConfigDto = new ObservableCollection<CanLinRWConfigDto>();
}
//匹配选中的SelectCanLinConfigPro.CanLinConfigContents和ListLinLdfModel
MatchSeletedAndLinLdfModel();
@@ -508,11 +528,19 @@ namespace CapMachine.Wpf.ViewModels
}
}
else
{
ListWriteCanLinRWConfigDto = new ObservableCollection<CanLinRWConfigDto>();
}
var ReadData = SelectCanLinConfigPro.CanLinConfigContents!.Where(a => a.RWInfo == RW.Read).ToList();
if (ReadData != null && ReadData.Count > 0)
{
ListReadCanLinRWConfigDto = new ObservableCollection<CanLinRWConfigDto>(Mapper.Map<List<CanLinRWConfigDto>>(ReadData));
}
else
{
ListReadCanLinRWConfigDto = new ObservableCollection<CanLinRWConfigDto>();
}
SelectCanLinConfigProConfigName = SelectCanLinConfigPro.ConfigName;
return;
@@ -792,6 +820,16 @@ namespace CapMachine.Wpf.ViewModels
set { _SelectedLINConfigExdDto = value; RaisePropertyChanged(); }
}
private ObservableCollection<CbxItems> _DataBaudRateCbxItems;
/// <summary>
/// CAN 数据波特率
/// </summary>
public ObservableCollection<CbxItems> DataBaudRateCbxItems
{
get { return _DataBaudRateCbxItems; }
set { _DataBaudRateCbxItems = value; RaisePropertyChanged(); }
}
private DelegateCommand<string> _LinOpCmd;
/// <summary>
/// LIN操作的指令
@@ -835,7 +873,7 @@ namespace CapMachine.Wpf.ViewModels
//系统使用了LIN
ConfigService.CanLinRunStateModel.CurSysSelectedCanLin = CanLinEnum.Lin;
}
//LIN LDF配置 有LDF配置的话则直接加载LDF信息
if (!string.IsNullOrEmpty(SelectCanLinConfigPro.LINConfigExd.LdfPath))
{