public Task PoolsSetsChanged() { return(Task.Run(() => _model.cmd_SavePools(PoolsSets.ToList()))); }
private void InitializePoolsCommands() { AddPool = new RelayCommand(obj => { Selection.Add(false); PoolsSets.Add(new PoolSet { Name = "New pool" }); _model.cmd_SavePools(PoolsSets.ToList()); }); DeletePools = new RelayCommand(obj => { for (int i = Selection.Count - 1; i > -1; i--) { if (Selection[i]) { Selection.RemoveAt(i); PoolsSets[i].Wach = false; PoolsSets.RemoveAt(i); var x = PVMs.Where(pvm => pvm.Index == i).ToList(); if (x.Count > 0) { PVs = PVs.Where(pv => pv.Index != i).ToList(); PVMs = PVMs.Where(pvm => pvm.Index != i).ToList(); } } } _model.cmd_SavePools(PoolsSets.ToList()); }); UpPools = new RelayCommand(obj => { for (int i = 1; i < Selection.Count; i++) { if (Selection[i] && !Selection[i - 1]) { Selection[i - 1] = true; Selection[i] = false; PVMs.Where(p => p.Index == i).First().Index = i - 1; PVMs.Where(p => p.Index == i - 1).First().Index = i; var ps = PoolsSets[i]; PoolsSets.Insert(i - 1, ps); PoolsSets.RemoveAt(i); SortPoolsViews(); } } }); DownPools = new RelayCommand(obj => { for (int i = Selection.Count - 2; i > -1; i--) { if (Selection[i] && !Selection[i + 1]) { Selection[i + 1] = true; Selection[i] = false; PVMs.Where(p => p.Index == i).First().Index = i + 1; PVMs.Where(p => p.Index == i + 1).First().Index = i; var ps = PoolsSets[i]; PoolsSets.RemoveAt(i); PoolsSets.Insert(i + 1, ps); SortPoolsViews(); } } }); }