当前位置: 首页>>代码示例>>C#>>正文


C# IPackage.Select方法代码示例

本文整理汇总了C#中IPackage.Select方法的典型用法代码示例。如果您正苦于以下问题:C# IPackage.Select方法的具体用法?C# IPackage.Select怎么用?C# IPackage.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPackage的用法示例。


在下文中一共展示了IPackage.Select方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BuildStatus

        public static AgentStatusReport BuildStatus(IPackagesList availablePackages, ILocalPackageCache packageCache, IInstalledPackageArchive installCache, RunningInstallationTaskList runningTasks, IAgentSettingsManager settingsManager, ICurrentlyDownloadingList currentlyDownloadingList, CompletedInstallationTaskList completedInstallations)
        {
            // copying these collections to variables because sometimes they get modified while building the status report object
            string[] updating = new string[currentlyDownloadingList != null ? currentlyDownloadingList.Count : 0];
            if (currentlyDownloadingList != null) currentlyDownloadingList.CopyTo(updating, 0);

            IPackage[] packages = new IPackage[availablePackages != null ? availablePackages.Count : 0];
            if (availablePackages != null) availablePackages.CopyTo(packages, 0);

            var watchedPackageList = availablePackages.GetWatched().ToList();
            IPackage[] watchedPackages = new IPackage[watchedPackageList != null ? watchedPackageList.Count : 0];
            if (watchedPackageList != null) watchedPackageList.CopyTo(watchedPackages);

            InstallationTask[] tasks=new InstallationTask[runningTasks != null ? runningTasks.Count : 0];
            if (runningTasks != null) runningTasks.CopyTo(tasks);

            var status = new AgentStatusReport
                       {
                           packages = BuildPackageInformation(watchedPackages, installCache, tasks, completedInstallations),
                           currentTasks = tasks.Select(t =>
                                                           {
                                                               var installation = new InstallTaskViewModel();
                                                               installation.Messages =
                                                                   t.ProgressReports.Select(pr => pr.Message).ToArray();
                                                               if (t.Task != null)
                                                               {
                                                                   installation.Status =
                                                                       Enum.GetName(typeof (TaskStatus), t.Task.Status);
                                                               }
                                                               installation.PackageId = t.PackageId;
                                                               installation.Version = t.Version;
                                                               installation.LastMessage = t.ProgressReports.Count > 0
                                                                                              ? t.ProgressReports.
                                                                                                    LastOrDefault().
                                                                                                    Message
                                                                                              : "";
                                                               return installation;
                                                           }).ToList(),
                           availableVersions = packages.Select(p => p.Version.ToString()).Distinct().OrderByDescending(s => s).ToList(),
                           environment = settingsManager.Settings.DeploymentEnvironment,
                           updating = updating.ToList(),
                           isUpdating = currentlyDownloadingList.Downloading
                       };

            status.OutOfDate =
                status.packages.Any(p => p.OutOfDate);

            return status;
        }
开发者ID:andrewmyhre,项目名称:DeployD,代码行数:49,代码来源:AgentStatusFactory.cs


注:本文中的IPackage.Select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。