OSDN Git Service

AppliStation,チケット #23338 AVGをアンインストールしようとするとエラーが発生してしまう 対策
[applistation/AppliStation.git] / AppliStation / PackageListView.cs
index 5c22ea3..484ceeb 100644 (file)
@@ -5,6 +5,7 @@ using System.Collections.Generic;
 using System.ComponentModel;\r
 using NaGet.Packages;\r
 using NaGet.Packages.Install;\r
+using AppliStation.PackageInfo;\r
 \r
 namespace AppliStation\r
 {\r
@@ -128,10 +129,18 @@ namespace AppliStation
                        string[] labels = new string[this.Columns.Count];\r
                        foreach (ColumnHeader header in this.Columns) {\r
                                string tag = header.Tag as string;\r
+                               \r
                                if (tag == "Name")                              labels[header.Index] = pkg.Name;\r
                                if (tag == "Version")                   labels[header.Index] = pkg.Version;\r
                                if (tag == "Summary")                   labels[header.Index] = pkg.Summary;\r
                                if (tag == "PackageListName")   labels[header.Index] = pkg.PackageListName;\r
+                               if (tag == "License")                   labels[header.Index] = PackageDescripter.GetLicenseValueLabel(pkg);\r
+                               if (tag == "InstallDate") {\r
+                                       InstalledPackage instPkg = pkg as InstalledPackage;\r
+                                       if (instPkg != null && instPkg.UninstallInfo.InstallDate.HasValue) {\r
+                                               labels[header.Index] = instPkg.UninstallInfo.InstallDate.Value.ToShortDateString();\r
+                                       }\r
+                               }\r
                        }\r
                        \r
                        ListViewItem item = new ListViewItem(labels);\r
@@ -156,7 +165,7 @@ namespace AppliStation
                        // ソフトリストの中身のパッケージ\r
                        if ((filteringType & PackageListViewPkgTypeFilter.NotInstalled) != 0) {\r
                                foreach (Package pkg in pkgListMan.AvailablePkgList.Search(keyword)) {\r
-                                       if (Installation.GetPreferInstallerIndex(pkg) >= 0) { // インストール可能\r
+                                       if (Installation.IsInstallablePackage(pkg)) { // インストール可能\r
                                                bool isInstalledAS = (pkgListMan.InstalledPkgList.GetPackageForName(pkg.Name) != null);\r
                                                bool isInstalledSys = (pkgListMan.SystemInstalledPkgList.GetPackageForName(pkg.Name) != null);\r
                                                \r
@@ -220,12 +229,26 @@ namespace AppliStation
                \r
                #region Sort関連\r
                \r
+               /// <summary>\r
+               /// 選択しているコラムを設定あるいは取得を行う。\r
+               /// </summary>\r
+               public ColumnHeader SortColumn {\r
+                       get {\r
+                               return sortComparer.Column;\r
+                       }\r
+                       set {\r
+                               sortColumn(value);\r
+                       }\r
+               }\r
+               \r
                protected void sortColumn(ColumnHeader column)\r
                {\r
-                       int columnIndex = column.Index;\r
+                       int columnIndex = (column != null)? column.Index : -1;\r
                        SortOrder order = SortOrder.None;\r
                        \r
-                       if (sortComparer.ColumnIndex == columnIndex) {\r
+                       if (columnIndex < 0) {\r
+                               sortComparer.Order = order = SortOrder.None;\r
+                       } else if (sortComparer.ColumnIndex == columnIndex) {\r
                                order = (sortComparer.Order == SortOrder.Ascending)? SortOrder.Descending : SortOrder.Ascending;\r
                                        \r
                                sortComparer.Order = order;\r