|
@@ -58,14 +58,27 @@ namespace PLCTool.ViewModels.BasicConfigViewModel
|
|
|
#region 私有方法
|
|
|
private void OnLoad()
|
|
|
{
|
|
|
- DeviceKindNameList = _iBasicDeviceKindService.FindAllDeviceKind();
|
|
|
- ProjectNameList = _iBasicProjectService.FindAllProject();
|
|
|
+ DeviceKindNameList.Clear();
|
|
|
+ DeviceKindNameList.Add("---");
|
|
|
+ ProjectNameList.Clear();
|
|
|
+ ProjectNameList.Add("---");
|
|
|
+ var Kinds = _iBasicDeviceKindService.FindAllDeviceKind();
|
|
|
+ foreach(var kind in Kinds)
|
|
|
+ {
|
|
|
+ DeviceKindNameList.Add(kind);
|
|
|
+ }
|
|
|
+ var projects= _iBasicProjectService.FindAllProject();
|
|
|
+ foreach(var project in projects)
|
|
|
+ {
|
|
|
+ ProjectNameList.Add(project);
|
|
|
+ }
|
|
|
}
|
|
|
private void Reset(object obj)
|
|
|
{
|
|
|
DeviceNo = string.Empty;
|
|
|
DeviceName = string.Empty;
|
|
|
-
|
|
|
+ DeviceKindName = "---";
|
|
|
+ ProjectName = "---";
|
|
|
|
|
|
}
|
|
|
/// <summary>
|
|
@@ -146,7 +159,8 @@ namespace PLCTool.ViewModels.BasicConfigViewModel
|
|
|
conditionDevices = (from a in allDeviceList
|
|
|
where (string.IsNullOrEmpty(DeviceName) ? true : (a.DeviceName == DeviceName))
|
|
|
&& (string.IsNullOrEmpty(DeviceNo) ? true : (a.DeviceNo == DeviceNo))
|
|
|
-
|
|
|
+ && (DeviceKindName == "---") ? true : (a.DeviceKindName == DeviceKindName)
|
|
|
+ &&(ProjectName == "---") ? true : (a.ProjectName == ProjectName)
|
|
|
select a).ToList();
|
|
|
//默认显示的第一页
|
|
|
conditionDevices = conditionDevices.OrderBy(x => x.DeviceId).ToList();
|
|
@@ -343,8 +357,8 @@ namespace PLCTool.ViewModels.BasicConfigViewModel
|
|
|
/// <summary>
|
|
|
/// 项目名称
|
|
|
/// </summary>
|
|
|
- private List<string> projectNameList;
|
|
|
- public List<string> ProjectNameList
|
|
|
+ private ObservableCollection<string> projectNameList=new ObservableCollection<string>();
|
|
|
+ public ObservableCollection<string> ProjectNameList
|
|
|
{
|
|
|
get { return projectNameList; }
|
|
|
set { projectNameList = value; RaisePropertyChanged(); }
|
|
@@ -352,8 +366,8 @@ namespace PLCTool.ViewModels.BasicConfigViewModel
|
|
|
/// <summary>
|
|
|
/// 设备类型
|
|
|
/// </summary>
|
|
|
- private List<string> deviceKindNameList;
|
|
|
- public List<string> DeviceKindNameList
|
|
|
+ private ObservableCollection<string> deviceKindNameList=new ObservableCollection<string>();
|
|
|
+ public ObservableCollection<string> DeviceKindNameList
|
|
|
{
|
|
|
get { return deviceKindNameList; }
|
|
|
set { deviceKindNameList = value; RaisePropertyChanged(); }
|