private void dgrProperties_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 1 && e.RowIndex == 2) { FeaturesForm featuresForm = new FeaturesForm(); Point pointToScreen = PointToScreen(dgrProperties.Location); int x = pointToScreen.X + dgrProperties.Columns[0].Width; int y = pointToScreen.Y + dgrProperties.ColumnHeadersHeight + dgrProperties.Rows[e.RowIndex].Height * (e.RowIndex + 1); featuresForm.Location = new Point(x, y); if (featuresForm.ShowDialog() == DialogResult.OK) { FeatureProperty feature = featuresForm.SelectedProperty; if (feature != null && selectedEnvVariable != null) { dgrProperties[e.ColumnIndex, e.RowIndex].Value = feature.Name; selectedEnvVariable.Feature = feature; } } } else if (e.ColumnIndex == 1 && e.RowIndex >= 0) { dgrProperties.BeginEdit(true); Type type = dgrProperties[e.ColumnIndex, e.RowIndex].GetType(); if (type == typeof(DataGridViewComboBoxCell)) { DataGridViewComboBoxEditingControl comboboxEdit = (DataGridViewComboBoxEditingControl)dgrProperties.EditingControl; comboboxEdit.DroppedDown = true; } } }
private void CheckDefaultFeature(TreeNode featureNode) { FeatureProperty featureProperty = (FeatureProperty)featureNode.Tag; if (featureProperty.IsDefault) { Common.DefaultFeature = featureProperty; } }
private void tvFeatures_AfterLabelEdit(object sender, NodeLabelEditEventArgs e) { if (String.IsNullOrEmpty(e.Label) == false) { FeatureProperty property = (FeatureProperty)e.Node.Tag; property.Name = e.Label; pgFeatureProperty.SelectedObject = e.Node.Tag; } }
public static bool FeatureExists(string featureId) { foreach (TreeNode featureNode in Features.Nodes) { FeatureProperty feature = (FeatureProperty)featureNode.Tag; if (FeatureExists(featureId, featureNode)) { return(true); } } return(false); }
private void ApplyFeature(TreeNode node, FeatureProperty selectedFeature) { ComponentNode componentNode = (ComponentNode)node.Tag; if (componentNode.Type == ComponentType.Folder || componentNode.Type == ComponentType.RootFolder) { foreach (TreeNode childNodes in node.Nodes) { ApplyFeature(childNodes, selectedFeature); } } else { componentNode.Property.Feature = selectedFeature; } }
private static bool FeatureExists(string featureId, TreeNode featureNode) { FeatureProperty feature = (FeatureProperty)featureNode.Tag; if (feature.Id == featureId) { return(true); } foreach (TreeNode childFeatureNode in featureNode.Nodes) { if (FeatureExists(featureId, childFeatureNode)) { return(true); } } return(false); }
private void mnuDefaultFeature_Click(object sender, EventArgs e) { if (tvFeatures.SelectedNode != null) { FeatureProperty property = (FeatureProperty)tvFeatures.SelectedNode.Tag; property.IsDefault = true; if (Common.DefaultFeature.Id != property.Id) { Common.DefaultFeature.IsDefault = false; if (tvFeatures.Nodes.Count > 0) { ChangeTreeForeColor(tvFeatures.Nodes[0], Color.Black); } Common.DefaultFeature = property; currentFeatureNode.ForeColor = Color.Blue; } pgFeatureProperty.SelectedObject = property; } }
private void pgFeatureProperty_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { FeatureProperty property = (FeatureProperty)pgFeatureProperty.SelectedObject; if (property.IsDefault) { if (Common.DefaultFeature.Id != property.Id) { Common.DefaultFeature.IsDefault = false; if (tvFeatures.Nodes.Count > 0) { ChangeTreeForeColor(tvFeatures.Nodes[0], Color.Black); } Common.DefaultFeature = property; currentFeatureNode.ForeColor = Color.Blue; } } currentFeatureNode.Text = property.Name; }
private void CreateFeature(TreeNode featureNode, Wix.Feature parentFeature) { FeatureProperty childFeatureProperty = (FeatureProperty)featureNode.Tag; Wix.Feature feature = new Wix.Feature(); feature.Id = childFeatureProperty.Id; feature.Level = "1"; feature.Title = childFeatureProperty.Name; feature.Description = childFeatureProperty.Description; parentFeature.Items = Common.AddItemToArray(parentFeature.Items, feature); MsiBuilder.FeatureTable.Add(childFeatureProperty.Id, feature); if (featureNode.Nodes.Count > 0) { foreach (TreeNode childFeature in featureNode.Nodes) { CreateFeature(childFeature, feature); } } }
private void Delete_FeatureNode() { pgFeatureProperty.SelectedObject = null; if (tvFeatures.SelectedNode != null) { FeatureProperty selectedProp = (FeatureProperty)tvFeatures.SelectedNode.Tag; if (selectedProp.IsDefault) { // check for siblings.. if not make parent as default node TreeNode parentNode = tvFeatures.SelectedNode.Parent; if (parentNode != null) { TreeNode newDefaultNode = null; if (parentNode.Nodes.Count > 1) { newDefaultNode = tvFeatures.SelectedNode.NextNode; if (newDefaultNode == null) { newDefaultNode = tvFeatures.SelectedNode.PrevNode; } } else { newDefaultNode = parentNode; } // change properties of new default node if (newDefaultNode != null) { FeatureProperty property = (FeatureProperty)newDefaultNode.Tag; property.IsDefault = true; Common.DefaultFeature = property; newDefaultNode.ForeColor = Color.Blue; } } } tvFeatures.SelectedNode.Remove(); } UpdateFeaturesList(); }
private void ShowFeatures(TreeNode selectedNode) { FeaturesForm featureForm = new FeaturesForm(); if (featureForm.ShowDialog() == DialogResult.OK) { FeatureProperty selectedFeature = featureForm.SelectedProperty; ComponentNode componentNode = (ComponentNode)selectedNode.Tag; if (componentNode.Type == ComponentType.Folder || componentNode.Type == ComponentType.RootFolder) { // recursively apply selected feature to all nodes under the selected node foreach (TreeNode node in selectedNode.Nodes) { ApplyFeature(node, selectedFeature); } } else { componentNode.Property.Feature = selectedFeature; } } }
public static void SetComponentRef(Wix.Component component, FeatureProperty componentFeature) { // Define component Ref Wix.ComponentRef componentRef = new Wix.ComponentRef(); componentRef.Id = component.Id; // get the proper property... i,e defualt if feature is not assigned or assifned feature WixClasses.Feature applicableFeature = null; if (componentFeature == null) { // use default feature applicableFeature = MsiBuilder.FeatureTable[Common.DefaultFeature.Id]; } else { applicableFeature = MsiBuilder.FeatureTable[componentFeature.Id]; } // create ComponentRef node if (applicableFeature != null) { // Add new component Ref to feature node applicableFeature.Items = Common.AddItemToArray(applicableFeature.Items, componentRef); } }
private void addNew_Feature_Click(object sender, EventArgs e) { TreeNode node = null; if (tvFeatures.Nodes.Count == 0) { if (ProductName.Text == string.Empty) { node = tvFeatures.Nodes.Add("Default Feature"); } else { node = tvFeatures.Nodes.Add(ProductName.Text); } } else if (tvFeatures.SelectedNode != null) { node = tvFeatures.SelectedNode.Nodes.Add("New Feature" + newFeatureCount++); } if (node != null) { FeatureProperty property = new FeatureProperty(); property.Id = Common.GetId(); property.Name = node.Text; property.Description = "[Description not available]"; if (tvFeatures.Nodes.Count == 1 && tvFeatures.Nodes[0].Nodes.Count == 0)/*make node default if it is first node*/ { property.IsDefault = true; node.ForeColor = Color.Blue; Common.DefaultFeature = property; } node.Tag = property; UpdateFeaturesList(); } }
void INvnControl.Build() { //Copy license text File.Copy(LicenseFile.Text, Common.localWixFolder + Path.DirectorySeparatorChar + "License.rtf", true); // Copy images to wix folder ResourceManager res = new ResourceManager(typeof(Resources)); if (Globals.registered) { if (txtBanner.Text != "[Default]") { File.Copy(txtBanner.Text, Globals.localFolder + @"Wix\Bitmaps\bannrbmp.bmp", true); } else { Bitmap bannerImg = (Bitmap)res.GetObject("bannrbmp"); bannerImg.Save(Common.localWixFolder + Path.DirectorySeparatorChar + "Bitmaps" + Path.DirectorySeparatorChar + "bannrbmp.bmp"); } if (txtDialog.Text != "[Default]") { File.Copy(txtDialog.Text, Globals.localFolder + @"Wix\Bitmaps\dlgbmp.bmp", true); } else { Bitmap dlgImg = (Bitmap)res.GetObject("dlgbmp"); dlgImg.Save(Common.localWixFolder + Path.DirectorySeparatorChar + "Bitmaps" + Path.DirectorySeparatorChar + "dlgbmp.bmp"); } } else { Bitmap bannerImg = (Bitmap)res.GetObject("bannrbmp"); bannerImg.Save(Common.localWixFolder + Path.DirectorySeparatorChar + "Bitmaps" + Path.DirectorySeparatorChar + "bannrbmp.bmp"); Bitmap dlgImg = (Bitmap)res.GetObject("dlgbmp"); dlgImg.Save(Common.localWixFolder + Path.DirectorySeparatorChar + "Bitmaps" + Path.DirectorySeparatorChar + "dlgbmp.bmp"); } //<Product> string[] selectedLanguage = ((string)cmbLanguage.SelectedValue).Split("|".ToCharArray()); MsiBuilder.Product = new Wix.Product(); MsiBuilder.Product.Name = ProductName.Text; MsiBuilder.Product.Version = Version.Text; MsiBuilder.Product.Id = ProductCode.Text; MsiBuilder.Product.UpgradeCode = UpgradeCode.Text; MsiBuilder.Product.Language = selectedLanguage[0]; MsiBuilder.Product.Codepage = selectedLanguage[1]; MsiBuilder.UILocalizedFile = selectedLanguage[2]; MsiBuilder.Product.Manufacturer = Manufacturer.Text; //<Product>/<Package> MsiBuilder.Product.Package = new Wix.Package(); MsiBuilder.Product.Package.Id = PackageId.Text; MsiBuilder.Product.Package.Keywords = "Installer"; if (Description.Text != string.Empty) { MsiBuilder.Product.Package.Description = Description.Text; } if (Comments.Text != string.Empty) { MsiBuilder.Product.Package.Comments = Comments.Text; } MsiBuilder.Product.Package.Manufacturer = Manufacturer.Text; int majorInstallerVersion = Int32.Parse(txtMajorVersion.Text); int minorInstallerVersion = String.IsNullOrEmpty(txtMinorVersion.Text) ? 0 : Int32.Parse(txtMinorVersion.Text); MsiBuilder.Product.Package.InstallerVersion = (majorInstallerVersion * 100 + minorInstallerVersion).ToString(); MsiBuilder.Product.Package.Languages = selectedLanguage[0]; MsiBuilder.Product.Package.CompressedSpecified = true; MsiBuilder.Product.Package.Compressed = Wix.YesNoType.yes; MsiBuilder.Product.Package.SummaryCodepage = selectedLanguage[1]; if (chk64Bit.Checked) { MsiBuilder.Product.Package.Platforms = "x64"; } //Build User Interface Wix.UIRef uiRef1 = new Wix.UIRef(); if (rbMondo.Checked) { uiRef1.Id = "WixUI_Mondo"; } else if (rbFeatureTree.Checked) { uiRef1.Id = "WixUI_FeatureTree"; } else if (rbInstall.Checked) { uiRef1.Id = "WixUI_InstallDir"; Wix.Property installDirProperty = new Wix.Property(); installDirProperty.Id = "WIXUI_INSTALLDIR"; installDirProperty.Value = "INSTALLDIR"; MsiBuilder.PropertyElements.Add(installDirProperty.Id, installDirProperty); } else if (rbMinimal.Checked) { uiRef1.Id = "WixUI_Minimal"; } Wix.UIRef uiRef2 = new Wix.UIRef(); uiRef2.Id = "WixUI_ErrorProgressText"; MsiBuilder.UIRef.Add(uiRef1); MsiBuilder.UIRef.Add(uiRef2); // application is installed for all users ... Wix.Property allUsersProp = new Wix.Property(); allUsersProp.Id = "ALLUSERS"; allUsersProp.Value = "1"; MsiBuilder.PropertyElements.Add(allUsersProp.Id, allUsersProp); // Set properties for Icon if (String.IsNullOrEmpty(IconFile.Text) == false) { Wix.Icon icon = new Wix.Icon(); icon.Id = "iconfile.exe"; // STRANGE : The Id for the Icon element must end in '.exe' (i.e. LinkedCells.exe) icon.SourceFile = IconFile.Text; MsiBuilder.ProductMiscElements.Add(icon); Wix.Property productIconProp = new Wix.Property(); productIconProp.Id = "ARPPRODUCTICON"; productIconProp.Value = icon.Id; MsiBuilder.PropertyElements.Add(productIconProp.Id, productIconProp); } #region Features if (tvFeatures.Nodes.Count > 0) { TreeNode rootFeatureNode = tvFeatures.Nodes[0]; FeatureProperty property = (FeatureProperty)rootFeatureNode.Tag; if (property != null) { MsiBuilder.Feature.Id = property.Id; MsiBuilder.Feature.Title = property.Name; MsiBuilder.Feature.Description = property.Description; MsiBuilder.Feature.Display = "expand"; MsiBuilder.Feature.Level = "1"; MsiBuilder.Feature.ConfigurableDirectory = "INSTALLDIR"; MsiBuilder.FeatureTable.Add(MsiBuilder.Feature.Id, MsiBuilder.Feature); foreach (TreeNode featureNode in rootFeatureNode.Nodes) { CreateFeature(featureNode, MsiBuilder.Feature); } } } #endregion // Prerequisites if (cmbPrerequisite.SelectedIndex != 0) /* If selected item is not NONE */ { MsiCompiler.BootstrapperName = (string)cmbPrerequisite.SelectedValue; } }