protected void OnChange(RightCheckBox box) { if (throwHandler && Changed != null) { if (box.IsChecked.Value && box.Right == null) { box.Right = new Right(); box.Right.objectType = this.ObjectType; box.Right.rightType = box.RightType.ToString(); box.Right.projectReference = ApplicationManager.Instance.File.code; Object item = this.ProfilComboBox.SelectedItem; if (item != null && item is Domain.Profil) { box.Right.profil = (Domain.Profil)item; } else if (item != null && item is Domain.User) { box.Right.user = (Domain.User)item; } } Changed(box.Right, box.IsChecked.Value); if (!box.IsChecked.Value) { box.Right = null; } } }
public List <Right> GetCheckRights() { List <Right> rights = new List <Right>(0); foreach (UIElement check in this.RightsPanel.Children) { if (check is RightCheckBox) { RightCheckBox box = (RightCheckBox)check; if (box.Right != null && box.IsChecked.Value) { rights.Add(box.Right); } } } return(rights); }
public void Select(Right right) { throwHandler = false; foreach (UIElement check in this.RightsPanel.Children) { if (check is RightCheckBox) { RightCheckBox box = (RightCheckBox)check; if (box.RightType.ToString().Equals(right.rightType)) { box.Right = right; box.IsChecked = true; break; } } } throwHandler = true; }
protected void AddCheckBox(RightCheckBox checkBox) { checkBox.Checked += OnHandlingCheckbox; checkBox.Unchecked += OnHandlingCheckbox; RightsPanel.Children.Add(checkBox); }