private void CheckAll(object[] parameter) { var values = parameter; //string zone = (string)values[0]; bool checkall = (bool)values[1]; if (checkall) { IsChecked = true; Zones = new List <string> { "北京", "上海", "广州", "深圳", "长沙", "苏州", "西安", "佛山", "杭州" }; if (SelectedKpiInfos == null) { SelectedKpiInfos = new ObservableCollection <KpiInfoViewModel>(); } foreach (string zone in Zones) { foreach (KPIinfo item in KPIinfos.FindAll(x => x.Zone.Contains(zone))) { KpiInfoViewModel kpi = new KpiInfoViewModel(); kpi.KPIInfo = item; kpi.IsSelected = true; SelectedKpiInfos.Add(kpi); } } } else { IsChecked = false; Zones = new List <string>(); SelectedKpiInfos = null; } }
private void OnCheck(object[] parameter) { var values = parameter; string zone = (string)values[0]; bool check = (bool)values[1]; DoneTotalForExam = 0; FirstVersionTotal = 0; if (check) { Zones.Add(zone); if (SelectedKpiInfos == null) { SelectedKpiInfos = new ObservableCollection <KpiInfoViewModel>(); } foreach (KPIinfo item in KPIinfos.FindAll(x => x.Zone.Contains(zone))) { KpiInfoViewModel kpi = new KpiInfoViewModel(); kpi.KPIInfo = item; kpi.IsSelected = true; SelectedKpiInfos.Add(kpi); DoneTotalForExam += item.DonePoint; FirstVersionTotal += item.FirstVirsionPoint; } } else { Zones.Remove(zone); List <KpiInfoViewModel> kpis = new List <KpiInfoViewModel>(SelectedKpiInfos); kpis.RemoveAll(x => x.KPIInfo.Zone.Contains(zone)); SelectedKpiInfos = new ObservableCollection <KpiInfoViewModel>(kpis); foreach (KpiInfoViewModel item in SelectedKpiInfos) { DoneTotalForExam += item.KPIInfo.DonePoint; FirstVersionTotal += item.KPIInfo.FirstVirsionPoint; } } }