Пример #1
0
        /// <summary>
        /// 리스트뷰 아이템추가
        /// </summary>
        protected void AddItem(string p_strName, string p_strPath, InstallState p_state)
        {
            ListViewItem item = new ListViewItem();

            item.Text = p_strName;
            item.SubItems.Add(p_strPath);
            item.SubItems.Add(p_state.ToString());
            item.SubItems.Add("");

            this.AddItem(item);
        }
Пример #2
0
        protected void UpdateItem(int p_nIndex, string p_strName, string p_strPath, InstallState p_state, string p_strMsg)
        {
            if (this.InvokeRequired)
            {
                UpdateItemDelegate d = new UpdateItemDelegate(UpdateItem);
                this.Invoke(d, new object[] { p_nIndex, p_strName, p_strPath, p_state, p_strMsg });
                return;
            }
            else
            {
                ListViewItem item = this.listView1.Items[p_nIndex];
                item.Text             = p_strName;
                item.SubItems[1].Text = p_strPath;
                item.SubItems[2].Text = p_state.ToString();
                item.SubItems[3].Text = p_strMsg;

                this.listView1.EnsureVisible(p_nIndex);
            }
        }
Пример #3
0
        public DataView GetProductFeaturesData(string productCode)
        {
            DataTable table = new DataTable("ProductFeatures");

            table.Locale = CultureInfo.InvariantCulture;
            table.Columns.Add("ProductFeaturesFeatureTitle", typeof(string));
            table.Columns.Add("ProductFeaturesFeatureName", typeof(string));
            table.Columns.Add("ProductFeaturesInstallState", typeof(string));

            try
            {
                IntPtr hWnd = IntPtr.Zero;
                Installer.SetInternalUI(InstallUIOptions.Silent, ref hWnd);
                lock (syncRoot)                 // Only one Installer session can be active at a time
                {
                    using (Session session = Installer.OpenProduct(productCode))
                    {
                        session.DoAction("CostInitialize");
                        session.DoAction("FileCost");
                        session.DoAction("CostFinalize");

                        IList <string> featuresAndTitles = session.Database.ExecuteStringQuery(
                            "SELECT `Title`, `Feature` FROM `Feature`");

                        for (int i = 0; i < featuresAndTitles.Count; i += 2)
                        {
                            InstallState featureState = session.Features[featuresAndTitles[i + 1]].CurrentState;
                            table.Rows.Add(new object[] { featuresAndTitles[i], featuresAndTitles[i + 1],
                                                          (featureState == InstallState.Advertised ? "Advertised" : featureState.ToString()) });
                        }
                    }
                }
                return(new DataView(table, "", "ProductFeaturesFeatureTitle ASC", DataViewRowState.CurrentRows));
            }
            catch (InstallerException) { }
            catch (IOException) { }
            return(null);
        }
Пример #4
0
        public DataView GetProductComponentsData(string productCode)
        {
            DataTable table = new DataTable("ProductComponents");

            table.Locale = CultureInfo.InvariantCulture;
            table.Columns.Add("ProductComponentsComponentName", typeof(string));
            table.Columns.Add("ProductComponentsComponentID", typeof(string));
            table.Columns.Add("ProductComponentsInstallState", typeof(string));

            try
            {
                IntPtr hWnd = IntPtr.Zero;
                Installer.SetInternalUI(InstallUIOptions.Silent, ref hWnd);
                lock (syncRoot)                 // Only one Installer session can be active at a time
                {
                    using (Session session = Installer.OpenProduct(productCode))
                    {
                        session.DoAction("CostInitialize");
                        session.DoAction("FileCost");
                        session.DoAction("CostFinalize");

                        IList <string> componentsAndIds = session.Database.ExecuteStringQuery(
                            "SELECT `Component`, `ComponentId` FROM `Component`");

                        for (int i = 0; i < componentsAndIds.Count; i += 2)
                        {
                            if (componentsAndIds[i + 1] == "Temporary Id")
                            {
                                continue;
                            }
                            InstallState compState = session.Components[componentsAndIds[i]].CurrentState;
                            table.Rows.Add(new object[] { componentsAndIds[i], componentsAndIds[i + 1],
                                                          (compState == InstallState.Advertised ? "Advertised" : compState.ToString()) });
                        }
                    }
                }
                return(new DataView(table, "", "ProductComponentsComponentName ASC", DataViewRowState.CurrentRows));
            }
            catch (InstallerException) { }
            return(null);
        }