コード例 #1
0
        private void RunCommandOnPackageAndReloadAllDependendProjects(string helpTopic, Action <PackageInfo> command)
        {
            var node = tracker.SelectedGraphNode;

            if (node == null || !node.HasCategory(PaketGraphSchema.PaketCategory))
            {
                return;
            }

            PaketOutputPane.OutputPane.Activate();
            PaketErrorPane.Clear();
            StatusBarService.UpdateText("Paket command started.");

            var info = new PackageInfo();

            info.DependenciesFileName = node.Id.GetFileName();
            info.PackageName          = node.GetPackageName();
            info.GroupName            = node.GetGroupName();

            var projectGuids =
                Dependencies.Locate(info.DependenciesFileName)
                .FindProjectsFor(info.GroupName, info.PackageName)
                .Select(project => project.GetProjectGuid())
                .ToArray();

            SolutionExplorerExtensions.SaveSolution();
            foreach (var projectGuid in projectGuids)
            {
                SolutionExplorerExtensions.UnloadProject(projectGuid);
            }

            System.Threading.Tasks.Task.Run(() =>
            {
                try
                {
                    command(info);
                    PaketOutputPane.OutputPane.OutputStringThreadSafe("Ready\r\n");
                    StatusBarService.UpdateText("Ready");
                }
                catch (Exception ex)
                {
                    PaketErrorPane.ShowError(ex.Message, info.DependenciesFileName, helpTopic);
                    PaketOutputPane.OutputPane.OutputStringThreadSafe(ex.Message + "\r\n");
                }
            }).ContinueWith(_ =>
            {
                foreach (var projectGuid in projectGuids)
                {
                    SolutionExplorerExtensions.ReloadProject(projectGuid);
                }
            });
        }
コード例 #2
0
        private void RunCommandAndReloadAllProjects(string helpTopic, Action <SolutionInfo> command)
        {
            PaketOutputPane.OutputPane.Activate();
            PaketErrorPane.Clear();
            StatusBarService.UpdateText("Paket command started.");

            var info = new SolutionInfo();

            info.Directory = SolutionExplorerExtensions.GetSolutionDirectory();
            info.FileName  = SolutionExplorerExtensions.GetSolutionDirectory();
            var projectGuids = SolutionExplorerExtensions.GetAllProjectGuids();

            SolutionExplorerExtensions.SaveSolution();

            // https://github.com/fsprojects/Paket.VisualStudio/issues/84
            // explicitly save unsaved projects
            foreach (var project in SolutionExplorerExtensions.GetAllProjects().Where(p => false == p.Saved))
            {
                project.Save();
            }

            foreach (var projectGuid in projectGuids)
            {
                SolutionExplorerExtensions.UnloadProject(projectGuid);
            }

            System.Threading.Tasks.Task.Run(() =>
            {
                try
                {
                    command(info);
                    PaketOutputPane.OutputPane.OutputStringThreadSafe("Ready\r\n");
                    StatusBarService.UpdateText("Ready");
                }
                catch (Exception ex)
                {
                    PaketErrorPane.ShowError(ex.Message, info.FileName, helpTopic);
                    PaketOutputPane.OutputPane.OutputStringThreadSafe(ex.Message + "\r\n");
                }
            }).ContinueWith(_ =>
            {
                foreach (var projectGuid in projectGuids)
                {
                    SolutionExplorerExtensions.ReloadProject(projectGuid);
                }
            });
        }
コード例 #3
0
        private void RunCommandAndReloadAllProjects(string helpTopic, Action <SolutionInfo> command)
        {
            PaketOutputPane.OutputPane.Activate();
            PaketErrorPane.Clear();
            StatusBarService.UpdateText("Paket command started.");

            var info = new SolutionInfo();

            info.Directory = SolutionExplorerExtensions.GetSolutionDirectory();
            info.FileName  = SolutionExplorerExtensions.GetSolutionDirectory();
            var projectGuids = SolutionExplorerExtensions.GetAllProjectGuids();

            SolutionExplorerExtensions.SaveSolution();
            foreach (var projectGuid in projectGuids)
            {
                SolutionExplorerExtensions.UnloadProject(projectGuid);
            }

            System.Threading.Tasks.Task.Run(() =>
            {
                try
                {
                    command(info);
                    PaketOutputPane.OutputPane.OutputStringThreadSafe("Ready\r\n");
                    StatusBarService.UpdateText("Ready");
                }
                catch (Exception ex)
                {
                    PaketErrorPane.ShowError(ex.Message, info.FileName, helpTopic);
                    PaketOutputPane.OutputPane.OutputStringThreadSafe(ex.Message + "\r\n");
                }
            }).ContinueWith(_ =>
            {
                foreach (var projectGuid in projectGuids)
                {
                    SolutionExplorerExtensions.ReloadProject(projectGuid);
                }
            });
        }