private void IsActiveChanged(LayoutUserViewModel layoutUserViewModel) { //if (_layout != null && !_locked) //{ // if (layoutUserViewModel.IsActive && !_layout.Users.Contains(layoutUserViewModel.User.UID)) // _layout.Users.Add(layoutUserViewModel.User.UID); // else if (!layoutUserViewModel.IsActive && _layout.Users.Contains(layoutUserViewModel.User.UID)) // _layout.Users.Remove(layoutUserViewModel.User.UID); // ServiceFactory.SaveService.LayoutsChanged = true; //} }
public void Update(Layout layout) { _layout = layout; if (_layout != null) for (int i = _layout.Users.Count - 1; i >= 0; i--) if (Users.Select(x => x.User.UID == _layout.Users[i]).Count() == 0) _layout.Users.RemoveAt(i); foreach (var layoutUserViewModel in Users) layoutUserViewModel.IsActive = _layout != null && _layout.Users.Contains(layoutUserViewModel.User.UID); SelectedUser = Users.FirstOrDefault(); }
public void Update(Layout layout) { _locked = true; _layout = layout; if (_layout != null) for (int i = _layout.Users.Count - 1; i >= 0; i--) if (!_map.ContainsKey(_layout.Users[i])) _layout.Users.RemoveAt(i); foreach (var layoutUserViewModel in Users) layoutUserViewModel.IsActive = _layout != null && _layout.Users.Contains(layoutUserViewModel.User.UID); SelectedUser = Users.FirstOrDefault(); _locked = false; }
private int Comparison(LayoutUserViewModel x, LayoutUserViewModel y) { return string.Compare(x.Name, y.Name); }