// ========================================================================================= // Methods // ========================================================================================= /// <summary> /// Sets up the macros list view. /// </summary> /// <param name="buildMacros">The collection of build macros to add to the list.</param> public void InitializeMacroList(WixBuildMacroCollection buildMacros) { this.macrosListView.Items.Clear(); foreach (WixBuildMacroCollection.MacroNameValuePair pair in buildMacros) { ListViewItem item = new ListViewItem(new string[] { pair.MacroName, pair.Value }, 0); this.macrosListView.Items.Add(item); } this.macrosListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); }
/// <summary> /// Shows the editor form, which contains advanced editing features. /// </summary> /// <param name="sender">The edit button.</param> /// <param name="e">The <see cref="EventArgs"/> object that contains the event data.</param> private void editButton_Click(object sender, EventArgs e) { // set the form's caption and text box this.EditorForm.Text = this.EditorFormText; this.EditorForm.EditorText = this.contentTextBox.Text; // get the build macros currently defined - we do this every time rather than caching // the results because the configuration could change without us knowing about it. WixBuildMacroCollection buildMacros = new WixBuildMacroCollection(this.project); this.EditorForm.InitializeMacroList(buildMacros); // show the dialog and get the text back DialogResult result = this.editorForm.ShowDialog(this); if (result == DialogResult.OK) { this.contentTextBox.Text = this.editorForm.EditorText; } }
/// <summary> /// Shows the editor form, which contains advanced editing features. /// </summary> /// <param name="sender">The edit button.</param> /// <param name="e">The <see cref="EventArgs"/> object that contains the event data.</param> private void OnEditButtonClick(object sender, EventArgs e) { // set the form's caption and text box this.EditorForm.Text = this.EditorFormText; this.EditorForm.EditorText = this.contentTextBox.Text; // get the build macros currently defined - we do this every time rather than caching // the results because the configuration could change without us knowing about it. WixBuildMacroCollection buildMacros = new WixBuildMacroCollection(this.project); this.EditorForm.InitializeMacroList(buildMacros); // show the dialog and get the text back DialogResult result = this.editorForm.ShowDialog(this); if (result == DialogResult.OK) { this.contentTextBox.Text = this.editorForm.EditorText; this.contentTextBox.Modified = true; this.contentTextBox.Select(this.contentTextBox.Text.Length, 0); this.contentTextBox.Focus(); } }