private void AddClick(object sender, RoutedEventArgs e) { UsersDataGrid.UnselectAll(); string resultPath = string.Empty; using (var dialog = new FolderBrowserDialog()) { DialogResult result = dialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { resultPath = dialog.SelectedPath; } else { return; } } if (ListOfDirectories.FirstOrDefault(dir => dir.Path == resultPath) != null) { return; } int count = Directory.CreateDirectory(resultPath).GetFiles().Length; DirectoryObject directoryObject = new DirectoryObject(Rules.FirstOrDefault(rule => rule.AccessID == 0), resultPath, count); _allDirectories.Add(directoryObject); ListOfDirectories.Add(directoryObject); }
private void AddRoleClick(object sender, RoutedEventArgs e) { UsersDataGrid.UnselectAll(); int id = Roles.Select(rule => rule.RoleID).Max() + 1; Roles.Add(new AccessRole(id, $"Новая роль {id}", "0,1", Rules)); }
private void AddRuleClick(object sender, RoutedEventArgs e) { UsersDataGrid.UnselectAll(); int id = Rules.Select(rule => rule.AccessID).Max() + 1; Rules.Add(new AccessRule(id, $"Новый уровень доступа {id}")); }
private void AddUserClick(object sender, RoutedEventArgs e) { UsersDataGrid.UnselectAll(); int id = 0; if (Users.Any()) { id = Users.Select(rule => rule.UserId).Max() + 1; } Users.Add(new MyUser(id, $"Новый пользователь {id}", "0", Roles)); }
private void ClearFocusClick(object sender, RoutedEventArgs e) { UsersDataGrid.UnselectAll(); }
private void RulesDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { UsersDataGrid.UnselectAll(); }