private void LeftView_NodeCheckStateChanged(object sender, DevExpress.Xpf.Grid.TreeList.TreeListNodeEventArgs e) { if (e.Node.IsChecked == true) { selectedMenu.Add(e.Node.Content as TB_Menu); } else { selectedMenu.Remove(e.Node.Content as TB_Menu); } }
public void IsSelected(DevExpress.Xpf.Grid.TreeList.TreeListNodeEventArgs e) { try { var CheckByRoleResource = (CheckPointByRoleResource)e.Row; var parent = (RoleCollectionViewModel)this.GetParentViewModel <CheckpointViewModel>().ParentViewModel; var checkPoints = new CheckpointByRole { RoleId = CheckByRoleResource.IdRole, CheckpointId = CheckByRoleResource.Id, Id = CheckByRoleResource.CheckpointByRoleId }; if (CheckByRoleResource.Selected == null || CheckByRoleResource.Selected == true) { foreach (var item in parent.Entities.Where(y => y.Id == CheckByRoleResource.IdRole)) { var listChecks = item.CheckpointByRole.ToList(); if (!listChecks.Where(y => y.RoleId == CheckByRoleResource.IdRole && y.CheckpointId == CheckByRoleResource.Id).Any()) { listChecks.Add(checkPoints); item.CheckpointByRole = listChecks; } } parent.Save(parent.SelectedEntity); } else { foreach (var item in parent.Entities.Where(y => y.Id == CheckByRoleResource.IdRole)) { var listChecks = item.CheckpointByRole.ToList(); listChecks.RemoveAll(y => y.RoleId == CheckByRoleResource.IdRole && y.CheckpointId == CheckByRoleResource.Id); item.CheckpointByRole = listChecks; } parent.Save(parent.SelectedEntity); } parent.SendRefreshCollectionsMessage(); } catch (Exception ex) { MessageBoxService.ShowMessage(GetStringValue(Next.Enums.Enums.MessageError.SaveError) + ex.Message, ex.Message, MessageButton.OK, MessageIcon.Error); } }
private void treeView_NodeCollapsed(object sender, DevExpress.Xpf.Grid.TreeList.TreeListNodeEventArgs e) { this.updateWidth(); }