Ejemplo n.º 1
0
 private void ClientOnRestoreRootMapInheritanceCompleted(object sender, RestoreRootMapInheritanceCompletedEventArgs e)
 {
     if (e.UserState is Guid)
     {
         var guid = (Guid)e.UserState;
         if (ObjectDictionary.ContainsKey(guid) &&
             RestoreRootMapInheritanceCompletedEventHandlers.ContainsKey(guid))
         {
             RestoreRootMapInheritanceCompletedEventHandlers[guid](ObjectDictionary[guid], e);
             RestoreRootMapInheritanceCompletedEventHandlers.Remove(guid);
             ObjectDictionary.Remove(guid);
         }
     }
 }
        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;
                }
            }
        }
Ejemplo n.º 3
0
 private void ClientOnRestoreRootMapInheritanceCompleted(object sender, RestoreRootMapInheritanceCompletedEventArgs e)
 {
     if (e.UserState is Guid)
     {
         var guid = (Guid) e.UserState;
         if (ObjectDictionary.ContainsKey(guid) &&
             RestoreRootMapInheritanceCompletedEventHandlers.ContainsKey(guid))
         {
             RestoreRootMapInheritanceCompletedEventHandlers[guid](ObjectDictionary[guid], e);
             RestoreRootMapInheritanceCompletedEventHandlers.Remove(guid);
             ObjectDictionary.Remove(guid);
         }
     }
 }