更改了CAN和LIN的标志着色问题
保存图片触发两次 CANLIN的一些数据回读到PLC
This commit is contained in:
@@ -18,6 +18,7 @@ using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using Microsoft.Win32;
|
||||
using static CapMachine.Wpf.Models.ComEnum;
|
||||
using ImTools;
|
||||
|
||||
namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
@@ -37,7 +38,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
/// <param name="machineRtDataService"></param>
|
||||
public LinConfigViewModel(IDialogService dialogService, IFreeSql freeSql,
|
||||
IEventAggregator eventAggregator, IRegionManager regionManager, SysRunService sysRunService,
|
||||
ConfigService configService, LinDriveService linDriveService,ComActionService comActionService,
|
||||
ConfigService configService, LinDriveService linDriveService, ComActionService comActionService,
|
||||
IMapper mapper, MachineRtDataService machineRtDataService)
|
||||
{
|
||||
//LogService = logService;
|
||||
@@ -113,6 +114,8 @@ namespace CapMachine.Wpf.ViewModels
|
||||
if (SelectCanLinConfigPro != null)
|
||||
{
|
||||
SelectCanLinConfigPro = canLinConfigPros.Where(a => a.Id == SelectCanLinConfigPro.Id).FirstOrDefault()!;
|
||||
//无数据就返回
|
||||
if (SelectCanLinConfigPro == null) return;
|
||||
|
||||
SelectedLINConfigExdDto = Mapper.Map<LINConfigExdDto>(SelectCanLinConfigPro!.LINConfigExd);
|
||||
|
||||
@@ -146,11 +149,47 @@ namespace CapMachine.Wpf.ViewModels
|
||||
if (ReadData != null && ReadData.Count > 0)
|
||||
{
|
||||
ListReadCanLinRWConfigDto = new ObservableCollection<CanLinRWConfigDto>(Mapper.Map<List<CanLinRWConfigDto>>(ReadData));
|
||||
}
|
||||
|
||||
//匹配选中的SelectCanLinConfigPro.CanLinConfigContents和ListLinLdfModel
|
||||
MatchSeletedAndLinLdfModel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 匹配选中的SelectCanLinConfigPro.CanLinConfigContents和LinLdfModel
|
||||
/// 为了标注和着色使用
|
||||
/// </summary>
|
||||
private void MatchSeletedAndLinLdfModel()
|
||||
{
|
||||
//通过CanLinConfigContents标注ListLinLdfModel的选中状态属性,方便着色
|
||||
if (ListLinLdfModel != null && ListLinLdfModel!.Count() > 0 && SelectCanLinConfigPro.CanLinConfigContents != null && SelectCanLinConfigPro.CanLinConfigContents.Count() > 0)
|
||||
{
|
||||
foreach (var itemLinLdfModel in ListLinLdfModel)
|
||||
{
|
||||
var FindData = SelectCanLinConfigPro.CanLinConfigContents.FindFirst(a => a.SignalName == itemLinLdfModel.SignalName);
|
||||
if (FindData != null)//找到了就标注
|
||||
{
|
||||
switch (FindData.RWInfo)
|
||||
{
|
||||
case RW.Write:
|
||||
itemLinLdfModel.IsSeletedInfo = 1;
|
||||
break;
|
||||
case RW.Read:
|
||||
itemLinLdfModel.IsSeletedInfo = 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//没有找到了就标注为0
|
||||
itemLinLdfModel.IsSeletedInfo = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private bool _IsLinConfigProActive = false;
|
||||
@@ -611,7 +650,6 @@ namespace CapMachine.Wpf.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 选中的LinLdfModel
|
||||
/// </summary>
|
||||
@@ -648,8 +686,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ((par as SelectionChangedEventArgs)!.AddedItems[0] == null)
|
||||
if ((par as SelectionChangedEventArgs)!.AddedItems.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -788,6 +825,10 @@ namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
var LdfData = LinDriveService.StartLdf(SelectedLINConfigExdDto.LdfPath);
|
||||
ListLinLdfModel = LdfData;
|
||||
|
||||
//ListLinLdfModel有数据后就要看看是否有配置信息,有的话就要标注
|
||||
//匹配选中的SelectCanLinConfigPro.CanLinConfigContents和ListLinLdfModel
|
||||
MatchSeletedAndLinLdfModel();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user