OSDN Git Service

AppliStation-GUI,無人インストールのGUIの可変。アイコン表示の試作。
[applistation/AppliStation.git] / AppliStation / InstallationConfirmForm.cs
index 13f812f..f8a6356 100644 (file)
@@ -1,4 +1,4 @@
-using System;\r
+using System;\r
 using System.Drawing;\r
 using System.Windows.Forms;\r
 using NaGet.Packages;\r
@@ -16,7 +16,7 @@ namespace AppliStation
                private PackageListsManager pkgListMan;\r
                \r
                /// <summary>\r
-               /// \83p\83b\83P\81[\83W\83C\83\93\83X\83g\81[\83\8b\8f\88\97\9d\82Ì\8fW\8d\87\r
+               /// パッケージインストール処理の集合\r
                /// </summary>\r
                public Installation[] Installations {\r
                        get { return installations; }\r
@@ -43,7 +43,7 @@ namespace AppliStation
                        //\r
                        InitializeComponent();\r
                        \r
-                       // \8aÇ\97\9d\8eÒ\8c \8cÀ\82Å\93®\82¢\82Ä\82¢\82é\82È\82ç\82Îrunas\82ª\95K\97v\82É\82Í\82È\82ç\82È\82¢\82Ì\82Å\95\\8e¦\82µ\82È\82¢\r
+                       // 管理者権限で動いているならばrunasが必要にはならないので表示しない\r
                        if (NaGet.Utils.IsAdministrators()) {\r
                                runasCheckBox.Checked = false;\r
                                runasCheckBox.Visible = false;\r
@@ -69,7 +69,11 @@ namespace AppliStation
                                        itemData[versionColumnHeader.Index]        = pkg.Version;\r
                                        itemData[currentVersionColumnHeader.Index] = (curPkg != null)? curPkg.Version : "-";\r
                                        \r
-                                       itemData[instOptsColumnHeader.Index] = inst.Silent? "\83T\83C\83\8c\83\93\83g" : string.Empty;\r
+                                       itemData[silentInstColumnHeader.Index]     = \r
+                                               (inst.SupportsSilentOnly)? "無人インストールのみサポート" :\r
+                                               (inst.Silent)? "無人インストール" :\r
+                                               (inst.IsSupportsSilent)? "マニュアルでインストール" :\r
+                                               "マニュアルでしかインストールできません";\r
                                        \r
                                        ListViewItem item = new ListViewItem(itemData);\r
                                        item.Tag = inst;\r
@@ -84,6 +88,49 @@ namespace AppliStation
                        instsListView.Refresh();\r
                }\r
                \r
+               #region instsListViewのオーナードドロー関連\r
+               \r
+               void InstsListViewDrawSubItem(object sender, DrawListViewSubItemEventArgs e)\r
+               {\r
+                       if (e.Header == silentInstColumnHeader) {\r
+                               Installation inst = ((Installation) e.Item.Tag);\r
+                               \r
+                               //e.DrawBackground();\r
+                               e.Graphics.Clip.Intersect(e.Bounds);\r
+                               \r
+                               if (inst.Silent) {\r
+                                       AppliStation.Util.GUIUtils.Graphics_DrawCenterImage(\r
+                                               e.Graphics,\r
+                                               instListViewSilentInstallImageList.Images[0],\r
+                                               e.Bounds, null);\r
+                               } else if (inst.IsSupportsSilent) {\r
+                                       AppliStation.Util.GUIUtils.Graphics_DrawCenterImage(\r
+                                               e.Graphics,\r
+                                               instListViewSilentInstallImageList.Images[0],\r
+                                               e.Bounds,\r
+                                               AppliStation.Util.GUIUtils.GetImageAttributeToGrayOut(0.5f));\r
+                               }\r
+                       } else {\r
+                               e.DrawDefault = true;\r
+                       }\r
+               }\r
+               \r
+               void InstsListViewDrawColumnHeader(object sender, DrawListViewColumnHeaderEventArgs e)\r
+               {\r
+                       if (e.Header == silentInstColumnHeader) {\r
+                               e.DrawBackground();\r
+                               e.Graphics.Clip.Intersect(e.Bounds);\r
+                               AppliStation.Util.GUIUtils.Graphics_DrawCenterImage(\r
+                                       e.Graphics,\r
+                                       instListViewSilentInstallImageList.Images[0],\r
+                                       e.Bounds, null);\r
+                       } else {\r
+                               e.DrawDefault = true;\r
+                       }\r
+               }\r
+               \r
+               #endregion\r
+               \r
                void InstsListViewItemChecked(object sender, ItemCheckedEventArgs e)\r
                {\r
                        System.Windows.Forms.ListView.CheckedListViewItemCollection checkeds = instsListView.CheckedItems;\r
@@ -115,7 +162,7 @@ namespace AppliStation
                        }\r
                        AppliStation.Util.NativeMethods.ColumnHeader_SetSortState(instsListView, e.Column, order);\r
                        \r
-                       // \83\\81[\83g\91Î\8fÛ\97ñ\82Ì\90F\95t\82¯\r
+                       // ソート対象列の色付け\r
                        try {\r
                                // SendMessage(hWnd, LVM_SETSELECTEDCOLUMN, column, NULL);\r
                                AppliStation.Util.NativeMethods.SendMessage(instsListView.Handle, 0x1000+140, (uint) e.Column, 0);\r
@@ -181,7 +228,7 @@ namespace AppliStation
                }\r
                \r
                /// <summary>\r
-               /// \83C\83\93\83X\83g\81[\83\8b\82·\82é\82æ\82¤\91I\91ð\82³\82ê\82½\83p\83b\83P\81[\83W\82Ì\94z\97ñ\r
+               /// インストールするよう選択されたパッケージの配列\r
                /// </summary>\r
                public Installation[] CheckedInstallations {\r
                        get {\r
@@ -193,10 +240,10 @@ namespace AppliStation
                        }\r
                }\r
                \r
-               #region runas\8aÖ\98A\r
+               #region runas関連\r
                \r
                /// <summary>\r
-               /// runas\82Å\8eÀ\8ds\82·\82é\82©\94Û\82©\r
+               /// runasで実行するか否か\r
                /// </summary>\r
                public bool UseRunas {\r
                        set {\r
@@ -210,23 +257,23 @@ namespace AppliStation
                }\r
                \r
                /// <summary>\r
-               /// \91I\91ð\82³\82ê\82½\83p\83b\83P\81[\83W\82ð\92²\8d¸\82µ\82Ä\81ARunas\82ð\8eg\82¤\82×\82«\82©\82¢\82È\82©\82ð\95Ô\82·\r
+               /// 選択されたパッケージを調査して、Runasを使うべきかいなかを返す\r
                /// </summary>\r
                public bool GetShouldUseRunas()\r
                {\r
                        if (NaGet.Utils.IsAdministrators()) {\r
-                               // \8aÇ\97\9d\8eÒ\8c \8cÀ\82Å\93®\82¢\82Ä\82¢\82é\8fê\8d\87\82Í\95s\97v\r
+                               // 管理者権限で動いている場合は不要\r
                                return false;   \r
                        } else if (NaGet.Utils.IsUACEnabled()) {\r
-                               // UAC\82ª\93K\97p\82³\82ê\82Ä\82¢\82é\8fê\8d\87\82Í\95W\8f\80\82Å\82Í\95s\97v\82Æ\82·\82é\r
+                               // UACが適用されている場合は標準では不要とする\r
                                return false;   \r
                        }\r
                        \r
-                       // \82Ð\82Æ\82Â\82Å\82àPC\83^\81[\83Q\83b\83g\82È\83C\83\93\83X\83g\81[\83\89\82ª\82 \82ê\82Î\95K\97v\82Æ\82·\82é\r
+                       // ひとつでもPCターゲットなインストーラがあれば必要とする\r
                        foreach (Installation inst in CheckedInstallations) {\r
                                if (inst.TargetPC) return true;\r
                        }\r
-                       // \82»\82ê\88È\8aO\82Í\95s\97v\r
+                       // それ以外は不要\r
                        return false;\r
                }\r
                \r
@@ -246,5 +293,6 @@ namespace AppliStation
                }\r
                \r
                #endregion\r
+               \r
        }\r
 }\r