Example #1
0
        private void SecurityBlockSelection_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            SecurityManagementBox.ItemsSource = null;

            SecurityManagementBox.Visibility = Visibility.Collapsed;
            IManagementConsoleObject securityObject = e.NewValue as IManagementConsoleObject;

            if (securityObject != null)
            {
                if (securityObject is RootMap)
                {
                    NoAssociationsWarningTextblock.Text = ROOTMAP_WARNING;
                }
                else if (securityObject is Project)
                {
                    NoAssociationsWarningTextblock.Text = PROJECT_WARNING;
                }

                if (securityObject.IsLoaded)
                {
                    if (securityObject.HasNoSecurityAssociations)
                    {
                        NoAssociationWarning.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        NoAssociationWarning.Visibility = Visibility.Collapsed;
                    }
                }
                else
                {
                    securityObject.LoadCompleted += securityObject_LoadCompleted;
                }
            }
        }
 private void AddUpdate(IManagementConsoleObject managementConsoleObject, GlymaSecurityGroup group, bool?value,
                        bool isUpdatable = true)
 {
     if (Updates.ContainsKey(managementConsoleObject))
     {
         if (Updates[managementConsoleObject].ContainsKey(group) &&
             Updates[managementConsoleObject][group].IsUpdatable == isUpdatable)
         {
             Updates[managementConsoleObject][group].IsChecked = value.HasValue && value.Value;
         }
         else
         {
             Updates[managementConsoleObject].Add(group,
                                                  new UpdateValue(value.HasValue && value.Value, isUpdatable));
         }
     }
     else
     {
         var newGroups = new Dictionary <GlymaSecurityGroup, UpdateValue>
         {
             { group, new UpdateValue(value.HasValue && value.Value, isUpdatable) }
         };
         Updates.Add(managementConsoleObject, newGroups);
     }
 }
Example #3
0
        private void securityObject_LoadCompleted(object sender, System.EventArgs e)
        {
            IManagementConsoleObject securityObject = DataContext as IManagementConsoleObject;

            if (securityObject != null)
            {
                if (securityObject.HasNoSecurityAssociations)
                {
                    NoAssociationWarning.Visibility = Visibility.Visible;
                }
                else
                {
                    NoAssociationWarning.Visibility = Visibility.Collapsed;
                }
            }
        }
        private void CreateNewMap(IManagementConsoleObject project)
        {
            var mapNameDialog = new NewMapDialog();

            mapNameDialog.Closed += delegate
            {
                if (mapNameDialog.DialogResult != null && mapNameDialog.DialogResult.Value)
                {
                    Dispatcher.BeginInvoke(() =>
                    {
                        if (!string.IsNullOrWhiteSpace(mapNameDialog.MapName)) //extra check that the map name isn't blank
                        {
                            MapManager.CreateRootMapCompleted.RegisterEvent(OnMapNodeCreated);
                            MapManager.CreateRootMap(project.Id, mapNameDialog.MapName,
                                                     MapManager.NodeTypes["CompendiumMapNode"], string.Empty);
                        }
                    });
                }
            };
            mapNameDialog.Show();
        }
        private void NewMap(IManagementConsoleObject item)
        {
            var project = item as Project;

            if (project != null)
            {
                CreateNewMap(project);
            }
            else
            {
                var map = item as RootMap;
                if (map != null)
                {
                    var parentProject = _projects.FirstOrDefault(q => q.Id == map.ParentId);
                    if (parentProject != null)
                    {
                        CreateNewMap(parentProject);
                    }
                }
            }
        }
        private void Delete(IManagementConsoleObject item)
        {
            var project = item as Project;

            if (project != null)
            {
                SuperMessageBoxService.ShowWarning("Delete Project",
                                                   "You will lose all maps within the project. Are you sure you wish to continue?", "Yes", "No",
                                                   () =>
                {
                    Guid domainId = project.ParentId;
                    _projects.Remove(project);
                    ProjectListViewControlPanel.DataContext = null;

                    MapManager.DeleteDomainCompleted.RegisterEvent(domainId, OnDeletionCompleted);
                    ((MainPage)Application.Current.RootVisual).Loader.Visibility           = Visibility.Visible;
                    ((MainPage)Application.Current.RootVisual).Progress.Visibility         = Visibility.Collapsed;
                    ((MainPage)Application.Current.RootVisual).LoaderStatusText.Visibility = Visibility.Visible;
                    ((MainPage)Application.Current.RootVisual).StatusText.Text             = "We're working on deleting your project...";
                    MapManager.DeleteDomain(domainId);
                });
            }
            else
            {
                var map = item as RootMap;
                if (map != null)
                {
                    SuperMessageBoxService.ShowWarning("Delete Map",
                                                       "You will lose any content within the map. Are you sure you wish to continue?", "Yes", "No",
                                                       () =>
                    {
                        Guid domainId  = Guid.Empty;
                        Guid rootMapId = Guid.Empty;

                        var parentProject = _projects.FirstOrDefault(q => q.Id == map.ParentId);

                        if (parentProject != null)
                        {
                            if (map.Node != null)
                            {
                                domainId  = map.Node.DomainId;
                                rootMapId = map.Node.Id;
                            }

                            parentProject.RootMaps.Remove(map);
                        }

                        ProjectListViewControlPanel.DataContext = null;

                        if (domainId != Guid.Empty && rootMapId != Guid.Empty)
                        {
                            MapManager.DeleteRootMapCompleted.RegisterEvent(rootMapId, OnDeletionCompleted);
                            ((MainPage)Application.Current.RootVisual).Loader.Visibility           = Visibility.Visible;
                            ((MainPage)Application.Current.RootVisual).Progress.Visibility         = Visibility.Collapsed;
                            ((MainPage)Application.Current.RootVisual).LoaderStatusText.Visibility = Visibility.Visible;
                            ((MainPage)Application.Current.RootVisual).StatusText.Text             = "We're working on deleting your map...";
                            MapManager.DeleteRootMap(domainId, rootMapId);
                        }
                    });
                }
            }
        }