diff --git a/CSharp/Engines/WindowsForms/Plugins/UniversalEditor.Plugins.Microsoft.SoftwareInstallation.UserInterface.WindowsForms/Dialogs/Setup/Microsoft/ACME/BootstrapScript/BootstrapFilePropertiesDialog.Designer.cs b/CSharp/Engines/WindowsForms/Plugins/UniversalEditor.Plugins.Microsoft.SoftwareInstallation.UserInterface.WindowsForms/Dialogs/Setup/Microsoft/ACME/BootstrapScript/BootstrapFilePropertiesDialog.Designer.cs new file mode 100644 index 00000000..e117218f --- /dev/null +++ b/CSharp/Engines/WindowsForms/Plugins/UniversalEditor.Plugins.Microsoft.SoftwareInstallation.UserInterface.WindowsForms/Dialogs/Setup/Microsoft/ACME/BootstrapScript/BootstrapFilePropertiesDialog.Designer.cs @@ -0,0 +1,140 @@ +namespace UniversalEditor.Dialogs.Setup.Microsoft.ACME.BootstrapScript +{ + partial class BootstrapFilePropertiesDialogImpl + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.cmdBrowseSourceFileName = new System.Windows.Forms.Button(); + this.txtSourceFileName = new System.Windows.Forms.TextBox(); + this.cmdBrowseDestinationFileName = new System.Windows.Forms.Button(); + this.txtDestinationFileName = new System.Windows.Forms.TextBox(); + this.cmdCancel = new System.Windows.Forms.Button(); + this.cmdOK = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // cmdBrowseSourceFileName + // + this.cmdBrowseSourceFileName.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.cmdBrowseSourceFileName.Location = new System.Drawing.Point(12, 12); + this.cmdBrowseSourceFileName.Name = "cmdBrowseSourceFileName"; + this.cmdBrowseSourceFileName.Size = new System.Drawing.Size(125, 23); + this.cmdBrowseSourceFileName.TabIndex = 0; + this.cmdBrowseSourceFileName.Text = "&Source file name:"; + this.cmdBrowseSourceFileName.UseVisualStyleBackColor = true; + this.cmdBrowseSourceFileName.Click += new System.EventHandler(this.cmdBrowseSourceFileName_Click); + // + // txtSourceFileName + // + this.txtSourceFileName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtSourceFileName.HideSelection = false; + this.txtSourceFileName.Location = new System.Drawing.Point(143, 14); + this.txtSourceFileName.Name = "txtSourceFileName"; + this.txtSourceFileName.Size = new System.Drawing.Size(241, 20); + this.txtSourceFileName.TabIndex = 1; + // + // cmdBrowseDestinationFileName + // + this.cmdBrowseDestinationFileName.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.cmdBrowseDestinationFileName.Location = new System.Drawing.Point(12, 41); + this.cmdBrowseDestinationFileName.Name = "cmdBrowseDestinationFileName"; + this.cmdBrowseDestinationFileName.Size = new System.Drawing.Size(125, 23); + this.cmdBrowseDestinationFileName.TabIndex = 2; + this.cmdBrowseDestinationFileName.Text = "&Destination file name:"; + this.cmdBrowseDestinationFileName.UseVisualStyleBackColor = true; + this.cmdBrowseDestinationFileName.Click += new System.EventHandler(this.cmdBrowseDestinationFileName_Click); + // + // txtDestinationFileName + // + this.txtDestinationFileName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtDestinationFileName.HideSelection = false; + this.txtDestinationFileName.Location = new System.Drawing.Point(143, 43); + this.txtDestinationFileName.Name = "txtDestinationFileName"; + this.txtDestinationFileName.Size = new System.Drawing.Size(241, 20); + this.txtDestinationFileName.TabIndex = 3; + // + // cmdCancel + // + this.cmdCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.cmdCancel.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.cmdCancel.Location = new System.Drawing.Point(309, 69); + this.cmdCancel.Name = "cmdCancel"; + this.cmdCancel.Size = new System.Drawing.Size(75, 23); + this.cmdCancel.TabIndex = 5; + this.cmdCancel.Text = "&Cancel"; + this.cmdCancel.UseVisualStyleBackColor = true; + this.cmdCancel.Click += new System.EventHandler(this.cmdCancel_Click); + // + // cmdOK + // + this.cmdOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.cmdOK.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.cmdOK.Location = new System.Drawing.Point(228, 69); + this.cmdOK.Name = "cmdOK"; + this.cmdOK.Size = new System.Drawing.Size(75, 23); + this.cmdOK.TabIndex = 4; + this.cmdOK.Text = "&OK"; + this.cmdOK.UseVisualStyleBackColor = true; + this.cmdOK.Click += new System.EventHandler(this.cmdOK_Click); + // + // BootstrapFilePropertiesDialogImpl + // + this.AcceptButton = this.cmdOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.cmdCancel; + this.ClientSize = new System.Drawing.Size(396, 104); + this.Controls.Add(this.cmdOK); + this.Controls.Add(this.cmdCancel); + this.Controls.Add(this.txtDestinationFileName); + this.Controls.Add(this.txtSourceFileName); + this.Controls.Add(this.cmdBrowseDestinationFileName); + this.Controls.Add(this.cmdBrowseSourceFileName); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(412, 142); + this.Name = "BootstrapFilePropertiesDialogImpl"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Bootstrap File Properties"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button cmdBrowseSourceFileName; + private System.Windows.Forms.Button cmdBrowseDestinationFileName; + private System.Windows.Forms.Button cmdCancel; + private System.Windows.Forms.Button cmdOK; + internal System.Windows.Forms.TextBox txtSourceFileName; + internal System.Windows.Forms.TextBox txtDestinationFileName; + } +} \ No newline at end of file diff --git a/CSharp/Engines/WindowsForms/Plugins/UniversalEditor.Plugins.Microsoft.SoftwareInstallation.UserInterface.WindowsForms/Dialogs/Setup/Microsoft/ACME/BootstrapScript/BootstrapFilePropertiesDialog.cs b/CSharp/Engines/WindowsForms/Plugins/UniversalEditor.Plugins.Microsoft.SoftwareInstallation.UserInterface.WindowsForms/Dialogs/Setup/Microsoft/ACME/BootstrapScript/BootstrapFilePropertiesDialog.cs new file mode 100644 index 00000000..577aacb8 --- /dev/null +++ b/CSharp/Engines/WindowsForms/Plugins/UniversalEditor.Plugins.Microsoft.SoftwareInstallation.UserInterface.WindowsForms/Dialogs/Setup/Microsoft/ACME/BootstrapScript/BootstrapFilePropertiesDialog.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace UniversalEditor.Dialogs.Setup.Microsoft.ACME.BootstrapScript +{ + public partial class BootstrapFilePropertiesDialogImpl : Form + { + public BootstrapFilePropertiesDialogImpl() + { + InitializeComponent(); + } + + private void cmdBrowseSourceFileName_Click(object sender, EventArgs e) + { + OpenFileDialog ofd = new OpenFileDialog(); + if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) + { + txtSourceFileName.Text = ofd.FileName; + } + } + + private void cmdBrowseDestinationFileName_Click(object sender, EventArgs e) + { + SaveFileDialog sfd = new SaveFileDialog(); + if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK) + { + txtDestinationFileName.Text = sfd.FileName; + } + } + + private void cmdOK_Click(object sender, EventArgs e) + { + if (String.IsNullOrEmpty(txtSourceFileName.Text)) + { + MessageBox.Show("Please provide a source file name.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + if (String.IsNullOrEmpty(txtDestinationFileName.Text)) + { + if (MessageBox.Show("You have not specified a destination file name. Would you like to use the same file name ('" + System.IO.Path.GetFileName(txtSourceFileName.Text) + "') as the source file?", "Destination File Name", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No) + { + return; + } + txtDestinationFileName.Text = System.IO.Path.GetFileName(txtSourceFileName.Text); + } + + this.DialogResult = System.Windows.Forms.DialogResult.OK; + this.Close(); + } + + private void cmdCancel_Click(object sender, EventArgs e) + { + this.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.Close(); + } + } + public class BootstrapFilePropertiesDialog + { + private string mvarSourceFileName = String.Empty; + public string SourceFileName { get { return mvarSourceFileName; } set { mvarSourceFileName = value; } } + + private string mvarDestinationFileName = String.Empty; + public string DestinationFileName { get { return mvarDestinationFileName; } set { mvarDestinationFileName = value; } } + + public DialogResult ShowDialog() + { + BootstrapFilePropertiesDialogImpl dlg = new BootstrapFilePropertiesDialogImpl(); + dlg.txtSourceFileName.Text = mvarSourceFileName; + dlg.txtDestinationFileName.Text = mvarDestinationFileName; + if (dlg.ShowDialog() == DialogResult.OK) + { + mvarSourceFileName = dlg.txtSourceFileName.Text; + mvarDestinationFileName = dlg.txtDestinationFileName.Text; + return DialogResult.OK; + } + return DialogResult.Cancel; + } + } +} diff --git a/CSharp/Engines/WindowsForms/Plugins/UniversalEditor.Plugins.Microsoft.SoftwareInstallation.UserInterface.WindowsForms/Dialogs/Setup/Microsoft/ACME/BootstrapScript/BootstrapFilePropertiesDialog.resx b/CSharp/Engines/WindowsForms/Plugins/UniversalEditor.Plugins.Microsoft.SoftwareInstallation.UserInterface.WindowsForms/Dialogs/Setup/Microsoft/ACME/BootstrapScript/BootstrapFilePropertiesDialog.resx new file mode 100644 index 00000000..7080a7d1 --- /dev/null +++ b/CSharp/Engines/WindowsForms/Plugins/UniversalEditor.Plugins.Microsoft.SoftwareInstallation.UserInterface.WindowsForms/Dialogs/Setup/Microsoft/ACME/BootstrapScript/BootstrapFilePropertiesDialog.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CSharp/Engines/WindowsForms/Plugins/UniversalEditor.Plugins.Microsoft.SoftwareInstallation.UserInterface.WindowsForms/Editors/Setup/Microsoft/ACME/BootstrapScript/BootstrapScriptEditor.Designer.cs b/CSharp/Engines/WindowsForms/Plugins/UniversalEditor.Plugins.Microsoft.SoftwareInstallation.UserInterface.WindowsForms/Editors/Setup/Microsoft/ACME/BootstrapScript/BootstrapScriptEditor.Designer.cs index 589f11ed..1e989dfc 100644 --- a/CSharp/Engines/WindowsForms/Plugins/UniversalEditor.Plugins.Microsoft.SoftwareInstallation.UserInterface.WindowsForms/Editors/Setup/Microsoft/ACME/BootstrapScript/BootstrapScriptEditor.Designer.cs +++ b/CSharp/Engines/WindowsForms/Plugins/UniversalEditor.Plugins.Microsoft.SoftwareInstallation.UserInterface.WindowsForms/Editors/Setup/Microsoft/ACME/BootstrapScript/BootstrapScriptEditor.Designer.cs @@ -287,6 +287,7 @@ // cmdFilesClear // this.cmdFilesClear.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.cmdFilesClear.Enabled = false; this.cmdFilesClear.FlatStyle = System.Windows.Forms.FlatStyle.System; this.cmdFilesClear.Location = new System.Drawing.Point(392, 19); this.cmdFilesClear.Name = "cmdFilesClear"; @@ -294,9 +295,11 @@ this.cmdFilesClear.TabIndex = 1; this.cmdFilesClear.Text = "Cl&ear"; this.cmdFilesClear.UseVisualStyleBackColor = true; + this.cmdFilesClear.Click += new System.EventHandler(this.cmdFilesClear_Click); // // cmdFilesRemove // + this.cmdFilesRemove.Enabled = false; this.cmdFilesRemove.FlatStyle = System.Windows.Forms.FlatStyle.System; this.cmdFilesRemove.Location = new System.Drawing.Point(168, 19); this.cmdFilesRemove.Name = "cmdFilesRemove"; @@ -304,9 +307,11 @@ this.cmdFilesRemove.TabIndex = 1; this.cmdFilesRemove.Text = "&Remove"; this.cmdFilesRemove.UseVisualStyleBackColor = true; + this.cmdFilesRemove.Click += new System.EventHandler(this.cmdFilesRemove_Click); // // cmdFilesModify // + this.cmdFilesModify.Enabled = false; this.cmdFilesModify.FlatStyle = System.Windows.Forms.FlatStyle.System; this.cmdFilesModify.Location = new System.Drawing.Point(87, 19); this.cmdFilesModify.Name = "cmdFilesModify"; @@ -314,6 +319,7 @@ this.cmdFilesModify.TabIndex = 1; this.cmdFilesModify.Text = "&Modify..."; this.cmdFilesModify.UseVisualStyleBackColor = true; + this.cmdFilesModify.Click += new System.EventHandler(this.cmdFilesModify_Click); // // cmdFilesAdd // @@ -324,6 +330,7 @@ this.cmdFilesAdd.TabIndex = 1; this.cmdFilesAdd.Text = "&Add..."; this.cmdFilesAdd.UseVisualStyleBackColor = true; + this.cmdFilesAdd.Click += new System.EventHandler(this.cmdFilesAdd_Click); // // lvFiles // @@ -340,6 +347,8 @@ this.lvFiles.TabIndex = 0; this.lvFiles.UseCompatibleStateImageBehavior = false; this.lvFiles.View = System.Windows.Forms.View.Details; + this.lvFiles.ItemActivate += new System.EventHandler(this.lvFiles_ItemActivate); + this.lvFiles.SelectedIndexChanged += new System.EventHandler(this.lvFiles_SelectedIndexChanged); // // chSource // diff --git a/CSharp/Engines/WindowsForms/Plugins/UniversalEditor.Plugins.Microsoft.SoftwareInstallation.UserInterface.WindowsForms/Editors/Setup/Microsoft/ACME/BootstrapScript/BootstrapScriptEditor.cs b/CSharp/Engines/WindowsForms/Plugins/UniversalEditor.Plugins.Microsoft.SoftwareInstallation.UserInterface.WindowsForms/Editors/Setup/Microsoft/ACME/BootstrapScript/BootstrapScriptEditor.cs index 2a49c38a..cd5e692f 100644 --- a/CSharp/Engines/WindowsForms/Plugins/UniversalEditor.Plugins.Microsoft.SoftwareInstallation.UserInterface.WindowsForms/Editors/Setup/Microsoft/ACME/BootstrapScript/BootstrapScriptEditor.cs +++ b/CSharp/Engines/WindowsForms/Plugins/UniversalEditor.Plugins.Microsoft.SoftwareInstallation.UserInterface.WindowsForms/Editors/Setup/Microsoft/ACME/BootstrapScript/BootstrapScriptEditor.cs @@ -9,6 +9,7 @@ using UniversalEditor.UserInterface; using UniversalEditor.UserInterface.WindowsForms; using UniversalEditor.ObjectModels.Setup.Microsoft.ACME.BootstrapScript; +using UniversalEditor.Dialogs.Setup.Microsoft.ACME.BootstrapScript; namespace UniversalEditor.Editors.Setup.Microsoft.ACME.BootstrapScript { @@ -143,5 +144,102 @@ namespace UniversalEditor.Editors.Setup.Microsoft.ACME.BootstrapScript script.Require31Message = txtRequire31.Text; EndEdit(); } + + private void cmdFilesAdd_Click(object sender, EventArgs e) + { + BootstrapFilePropertiesDialog dlg = new BootstrapFilePropertiesDialog(); + if (dlg.ShowDialog() == DialogResult.OK) + { + ListViewItem lvi = new ListViewItem(); + BootstrapFile file = new BootstrapFile(); + file.SourceFileName = dlg.SourceFileName; + file.DestinationFileName = dlg.DestinationFileName; + + BootstrapScriptObjectModel script = (ObjectModel as BootstrapScriptObjectModel); + BeginEdit(); + script.Files.Add(file); + EndEdit(); + + lvi.Tag = file; + lvi.Text = file.SourceFileName; + lvi.SubItems.Add(file.DestinationFileName); + lvFiles.Items.Add(lvi); + + RefreshButtons(); + } + } + + private void cmdFilesModify_Click(object sender, EventArgs e) + { + if (lvFiles.SelectedItems.Count == 1) + { + BootstrapFile file = (lvFiles.SelectedItems[0].Tag as BootstrapFile); + + BootstrapFilePropertiesDialog dlg = new BootstrapFilePropertiesDialog(); + dlg.SourceFileName = file.SourceFileName; + dlg.DestinationFileName = file.DestinationFileName; + + if (dlg.ShowDialog() == DialogResult.OK) + { + file.SourceFileName = dlg.SourceFileName; + file.DestinationFileName = dlg.DestinationFileName; + + lvFiles.SelectedItems[0].Text = file.SourceFileName; + lvFiles.SelectedItems[0].SubItems[1].Text = file.DestinationFileName; + } + } + } + + private void cmdFilesRemove_Click(object sender, EventArgs e) + { + if (lvFiles.SelectedItems.Count > 0) + { + if (MessageBox.Show("Are you sure you want to remove the selected files from the list?", "Remove Files", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + + BootstrapScriptObjectModel script = (ObjectModel as BootstrapScriptObjectModel); + BeginEdit(); + foreach (ListViewItem lvi in lvFiles.SelectedItems) + { + script.Files.Remove(lvi.Tag as BootstrapFile); + } + EndEdit(); + + while (lvFiles.SelectedItems.Count > 0) + { + lvFiles.SelectedItems[0].Remove(); + } + RefreshButtons(); + } + } + + private void RefreshButtons() + { + cmdFilesModify.Enabled = (lvFiles.SelectedItems.Count == 1); + cmdFilesRemove.Enabled = (lvFiles.SelectedItems.Count > 0); + cmdFilesClear.Enabled = (lvFiles.Items.Count > 0); + } + + private void cmdFilesClear_Click(object sender, EventArgs e) + { + lvFiles.Items.Clear(); + + BootstrapScriptObjectModel script = (ObjectModel as BootstrapScriptObjectModel); + BeginEdit(); + script.Files.Clear(); + EndEdit(); + } + + private void lvFiles_ItemActivate(object sender, EventArgs e) + { + cmdFilesModify_Click(sender, e); + } + + private void lvFiles_SelectedIndexChanged(object sender, EventArgs e) + { + RefreshButtons(); + } } } diff --git a/CSharp/Engines/WindowsForms/Plugins/UniversalEditor.Plugins.Microsoft.SoftwareInstallation.UserInterface.WindowsForms/UniversalEditor.Plugins.Microsoft.Setup.UserInterface.WindowsForms.csproj b/CSharp/Engines/WindowsForms/Plugins/UniversalEditor.Plugins.Microsoft.SoftwareInstallation.UserInterface.WindowsForms/UniversalEditor.Plugins.Microsoft.Setup.UserInterface.WindowsForms.csproj index e8151aca..68721cdf 100644 --- a/CSharp/Engines/WindowsForms/Plugins/UniversalEditor.Plugins.Microsoft.SoftwareInstallation.UserInterface.WindowsForms/UniversalEditor.Plugins.Microsoft.Setup.UserInterface.WindowsForms.csproj +++ b/CSharp/Engines/WindowsForms/Plugins/UniversalEditor.Plugins.Microsoft.SoftwareInstallation.UserInterface.WindowsForms/UniversalEditor.Plugins.Microsoft.Setup.UserInterface.WindowsForms.csproj @@ -37,6 +37,12 @@ + + Form + + + BootstrapFilePropertiesDialog.cs + UserControl @@ -73,6 +79,9 @@ + + BootstrapFilePropertiesDialog.cs + BootstrapScriptEditor.cs