示例#1
0
        private void RunCommandOnPackageInUnloadedProject(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 projectGuid = tracker.GetSelectedProjectGuid();

            SolutionExplorerExtensions.SaveSolution();
            SolutionExplorerExtensions.UnloadProject(projectGuid);

            var info = new PackageInfo();

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

            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(_ =>
            {
                SolutionExplorerExtensions.ReloadProject(projectGuid);
            });
        }