コード例 #1
0
        public IDeletedFileMetadata HasDependencies(IExplorerItemViewModel explorerItemViewModel, IDependencyGraphGenerator graphGenerator, IExecuteMessage dep)
        {
            var graph = graphGenerator.BuildGraph(dep.Message, "", 1000, 1000, 1);

            _popupController = CustomContainer.Get <IPopupController>();
            if (graph.Nodes.Count > 1)
            {
                var result = _popupController.Show(string.Format(StringResources.Delete_Error, explorerItemViewModel.ResourceName),
                                                   string.Format(StringResources.Delete_Error_Title, explorerItemViewModel.ResourceName),
                                                   MessageBoxButton.OK, MessageBoxImage.Warning, "false", true, false, true, false, true, true);

                if (_popupController.DeleteAnyway)
                {
                    return(new DeletedFileMetadata
                    {
                        IsDeleted = false,
                        ResourceId = explorerItemViewModel.ResourceId,
                        ShowDependencies = false,
                        ApplyToAll = _popupController.ApplyToAll,
                        DeleteAnyway = _popupController.DeleteAnyway
                    });
                }

                if (result == MessageBoxResult.OK)
                {
                    return(BuildMetadata(explorerItemViewModel.ResourceId, false, false, _popupController.ApplyToAll, _popupController.DeleteAnyway));
                }
                explorerItemViewModel.ShowDependencies();
                return(BuildMetadata(explorerItemViewModel.ResourceId, false, true, _popupController.ApplyToAll, _popupController.DeleteAnyway));
            }
            return(new DeletedFileMetadata
            {
                IsDeleted = true,
                ResourceId = explorerItemViewModel.ResourceId,
                ShowDependencies = false
            });
        }