public void Edit(object obj = null) { if (!SelectValidate(true)) { return; } ProtoFileModel model = null; bool hasSelect = false; //获取选中的数据 foreach (var v in ProtoFiles) { if (v.IsSelected) { model = v; hasSelect = true; break; } } if (!hasSelect) { //MessageBox.Show("请选择修改项", "警告"); return; } //MessageBox.Show("选中 " + model.ProtoFile.FilePath); }
public void Select(int id) { ProtoFileModel md = ProtoFiles.Where(p => p.ProtoFile.ID == id).FirstOrDefault(); if (md != null) { if (!md.IsSelected && IsSelectAll) { IsSelectAll = false; } else if (md.IsSelected && !IsSelectAll) { foreach (var item in ProtoFiles) { if (!item.IsSelected) { return; } } IsSelectAll = true; } } }