X-Git-Url: http://git.sourceforge.jp/view?p=applistation%2FAppliStation.git;a=blobdiff_plain;f=AppliStation%2FPackageListViewForm.cs;h=e348e6f1d7354ff55eb3700662abf5b3a1cb2bc9;hp=5e4dedb4f549ff35b12d8409fa0d8cb0882b059c;hb=f5fb531435af7d3414a68975776b474d2f3d8736;hpb=766054a533704906284987fa970962bfeeeecfce diff --git a/AppliStation/PackageListViewForm.cs b/AppliStation/PackageListViewForm.cs index 5e4dedb..e348e6f 100644 --- a/AppliStation/PackageListViewForm.cs +++ b/AppliStation/PackageListViewForm.cs @@ -108,6 +108,7 @@ namespace AppliStation webResourceToolStripMenuItem.Visible = (pkgCount == 1); uninstallToolStripMenuItem.Visible = uninstallBtnEnabled; installToolStripMenuItem.Visible = installBtnEnabled; + downloadToolStripMenuItem.Visible = (pkgCount > 0); // detailBoxのメッセージ設定 switch (pkgCount) { @@ -547,6 +548,27 @@ namespace AppliStation } } + internal void downloadActionInvoke(Installation[] pkgs) + { + AppliStation.Util.ExecutionProgressViewer prog = new AppliStation.Util.ExecutionProgressViewer(); + prog.Shown += delegate(object sender2, EventArgs e2) { + NaGet.SubCommands.NaGetDownloadToCache tasks = new NaGet.SubCommands.NaGetDownloadToCache(pkgListsMan, pkgs); + prog.SetTaskSet(tasks); + prog.Refresh(); + prog.StartTaskSet(); + }; + prog.Text = string.Format("キャッシュへのダウンロード"); + prog.ShowDialog(this); + } + + void DownloadToolStripMenuItemClick(object sender, EventArgs e) + { + Installation[] insts = Installation.ConvertInstallations( NaGet.Utils.IEnumerable2Array(packageListView.SelectedPackages) ); + + downloadActionInvoke(insts); + + UpdatePackageList(); + } void WebOfficialMenuItemClick(object sender, EventArgs e) { @@ -691,30 +713,10 @@ namespace AppliStation // webGoogleSearchMenuItem always active. } - private IEnumerable getUpdatedPackages(PackageList installedPkgList, PackageList avaiablePkgList, IComparer verComp) - { - foreach (InstalledPackage pkg in installedPkgList) { - Package avaiablePkg = avaiablePkgList.GetPackageForName(pkg.Name); - - if (avaiablePkg != null) { - if (verComp.Compare(pkg.Version, avaiablePkg.Version) < 0 && - installedPkgList.GetPackageForPackage(pkg.Name, avaiablePkg.Version) == null) { - - yield return avaiablePkg; - } - } - } - } - void UpgradeToolStripButtonClick(object sender, EventArgs e) { - List pkgs; - VersionComparetor verComp = new VersionComparetor(); - PackageList avaiablePackageList = pkgListsMan.AvailablePkgList; - - pkgs = NaGet.Utils.MergeList( - getUpdatedPackages(pkgListsMan.InstalledPkgList, avaiablePackageList, verComp), - getUpdatedPackages(pkgListsMan.SystemInstalledPkgList, avaiablePackageList, verComp) + List pkgs = new List( + UpgradeFinder.GetUpgradePackages(pkgListsMan) ); if (pkgs.Count <= 0) {