OSDN Git Service

AppliStation-GUI,依存用のインストールリストの表示部分は作った。(まだ空なので何も表示されない)
authorttp <ttp@users.sourceforge.jp>
Sat, 13 Sep 2008 03:59:16 +0000 (03:59 +0000)
committerttp <ttp@users.sourceforge.jp>
Sat, 13 Sep 2008 03:59:16 +0000 (03:59 +0000)
git-svn-id: http://localhost/svn/AppliStation/trunk@975 34ed2c89-c49f-4a4b-abdb-c318350108cf

AppliStation/InstallationConfirmForm.cs

index 6cac28b..63aa10a 100644 (file)
@@ -63,33 +63,9 @@ namespace AppliStation
                private void updateInstsListView()\r
                {\r
                        instsListView.Items.Clear();\r
-                       \r
-                       updateInstsListViewPerGroup(selectedInstallations, instsListView.Groups["install"]);\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
 \r
+                       updateInstsListViewPerGroup(requiredInstallations, instsListView.Groups["requires"], true);\r
+                       updateInstsListViewPerGroup(selectedInstallations, instsListView.Groups["install"], false);\r
                        \r
                        InstsListViewItemChecked(instsListView, null);\r
                        instsListView.Refresh();\r
@@ -100,13 +76,15 @@ namespace AppliStation
                /// </summary>\r
                /// <param name="insts">インストールリスト</param>\r
                /// <param name="group">対象のグループ</param>\r
-               private void updateInstsListViewPerGroup(IEnumerable<Installation> insts, ListViewGroup group)\r
+               /// <param name="firstAppend">先頭に追加するか</param>\r
+               private void updateInstsListViewPerGroup(IEnumerable<Installation> insts, ListViewGroup group, bool firstAppend)\r
                {\r
                        // まず所属グループのアイテムをすべて削除する\r
                        group.Items.Clear();\r
                        \r
                        if (insts == null) return;\r
                        \r
+                       List<ListViewItem> itemsToAdd = new List<ListViewItem>();\r
                        foreach (Installation inst in insts) {\r
                                Package pkg = inst.InstalledPackage;\r
                                \r
@@ -129,7 +107,15 @@ namespace AppliStation
                                item.Group = group;\r
                                instViewUpdateSilentInstallView(item);\r
                                \r
-                               instsListView.Items.Add(item);\r
+                               itemsToAdd.Add(item);\r
+                       }\r
+                       \r
+                       if (firstAppend) {\r
+                               for (int i = 0; i < itemsToAdd.Count; i++) {\r
+                                       instsListView.Items.Insert(i, itemsToAdd[i]);\r
+                               }\r
+                       } else {\r
+                               instsListView.Items.AddRange(itemsToAdd.ToArray());\r
                        }\r
                }\r
                \r