private void ClientOnGetSecurityAssociationsCompleted(object sender, GetSecurityAssociationsCompletedEventArgs e) { if (e.Result != null) { if (!e.Result.HasError) { var securityObject = sender as ManagementConsoleObject; if (securityObject != null) { securityObject.Load(e.Result.Result, e.Result.Result.IsInherited); var selectedItem = XTreeView.SelectedItem; if (selectedItem != null) { PermissionDetails.DataContext = null; var binding = new Binding { Source = XTreeView, Path = new PropertyPath("SelectedItem"), Mode = BindingMode.TwoWay, }; PermissionDetails.SetBinding(DataContextProperty, binding); PermissionDetails.Visibility = Visibility.Visible; XTreeView.SelectedItem = selectedItem; } } } else { SuperMessageBoxService.ShowError("Error Occurred", "An error occurred while retrieving the Glyma permissions."); } } }
private void RestoreRootMapInheritanceCompleted(object sender, RestoreRootMapInheritanceCompletedEventArgs e) { var rootMap = sender as RootMap; if (rootMap != null) { rootMap.IsInherited = true; var project = _projects.FirstOrDefault(q => q.Id == rootMap.ParentId); if (project != null) { foreach (var groupPair in rootMap.PermissionGroups) { foreach (var group in groupPair) { group.IsEnabled = false; var value = project.GetValue(group.Group); group.IsSelected = value; group.ResetValue(value); } } var selectedItem = XTreeView.SelectedItem; if (selectedItem != null) { PermissionDetails.DataContext = null; var binding = new Binding { Source = XTreeView, Path = new PropertyPath("SelectedItem"), Mode = BindingMode.TwoWay, }; PermissionDetails.SetBinding(DataContextProperty, binding); PermissionDetails.Visibility = Visibility.Visible; XTreeView.SelectedItem = selectedItem; } Updates.Clear(); PermissionDetails.ApplyEnabled = false; } } }