diff --git a/PCK-Studio/Forms/Additional-Popups/AddPropertyPrompt.Designer.cs b/PCK-Studio/Forms/Additional-Popups/AddPropertyPrompt.Designer.cs index 90a9d0cd..116ae091 100644 --- a/PCK-Studio/Forms/Additional-Popups/AddPropertyPrompt.Designer.cs +++ b/PCK-Studio/Forms/Additional-Popups/AddPropertyPrompt.Designer.cs @@ -29,61 +29,63 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddPropertyPrompt)); - this.textBox1 = new System.Windows.Forms.TextBox(); - this.textBox2 = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.button1 = new System.Windows.Forms.Button(); + System.Windows.Forms.Label label1; + System.Windows.Forms.Label label2; + this.keyTextBox = new System.Windows.Forms.TextBox(); + this.valueTextBox = new System.Windows.Forms.TextBox(); + this.saveButton = new System.Windows.Forms.Button(); + label1 = new System.Windows.Forms.Label(); + label2 = new System.Windows.Forms.Label(); this.SuspendLayout(); // - // textBox1 + // keyTextBox // - this.textBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(13)))), ((int)(((byte)(13)))), ((int)(((byte)(13))))); - this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.textBox1.ForeColor = System.Drawing.SystemColors.Window; - resources.ApplyResources(this.textBox1, "textBox1"); - this.textBox1.Name = "textBox1"; + this.keyTextBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(13)))), ((int)(((byte)(13)))), ((int)(((byte)(13))))); + this.keyTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.keyTextBox.ForeColor = System.Drawing.SystemColors.Window; + resources.ApplyResources(this.keyTextBox, "keyTextBox"); + this.keyTextBox.Name = "keyTextBox"; // - // textBox2 + // valueTextBox // - this.textBox2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(13)))), ((int)(((byte)(13)))), ((int)(((byte)(13))))); - this.textBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.textBox2.ForeColor = System.Drawing.SystemColors.Window; - resources.ApplyResources(this.textBox2, "textBox2"); - this.textBox2.Name = "textBox2"; + this.valueTextBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(13)))), ((int)(((byte)(13)))), ((int)(((byte)(13))))); + this.valueTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.valueTextBox.ForeColor = System.Drawing.SystemColors.Window; + resources.ApplyResources(this.valueTextBox, "valueTextBox"); + this.valueTextBox.Name = "valueTextBox"; // // label1 // - resources.ApplyResources(this.label1, "label1"); - this.label1.ForeColor = System.Drawing.Color.White; - this.label1.Name = "label1"; + resources.ApplyResources(label1, "label1"); + label1.ForeColor = System.Drawing.Color.White; + label1.Name = "label1"; // // label2 // - resources.ApplyResources(this.label2, "label2"); - this.label2.ForeColor = System.Drawing.Color.White; - this.label2.Name = "label2"; + resources.ApplyResources(label2, "label2"); + label2.ForeColor = System.Drawing.Color.White; + label2.Name = "label2"; // - // button1 + // saveButton // - resources.ApplyResources(this.button1, "button1"); - this.button1.ForeColor = System.Drawing.Color.White; - this.button1.Name = "button1"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); + resources.ApplyResources(this.saveButton, "saveButton"); + this.saveButton.ForeColor = System.Drawing.Color.White; + this.saveButton.Name = "saveButton"; + this.saveButton.UseVisualStyleBackColor = true; + this.saveButton.Click += new System.EventHandler(this.saveButton_Click); // - // addMeta + // AddPropertyPrompt // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.button1); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.textBox2); - this.Controls.Add(this.textBox1); + this.Controls.Add(this.saveButton); + this.Controls.Add(label2); + this.Controls.Add(label1); + this.Controls.Add(this.valueTextBox); + this.Controls.Add(this.keyTextBox); this.MaximizeBox = false; this.MinimizeBox = false; - this.Name = "addMeta"; + this.Name = "AddPropertyPrompt"; this.Resizable = false; this.ShadowType = MetroFramework.Forms.MetroFormShadowType.DropShadow; this.Style = MetroFramework.MetroColorStyle.Black; @@ -95,10 +97,8 @@ #endregion - private System.Windows.Forms.TextBox textBox1; - private System.Windows.Forms.TextBox textBox2; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Button button1; + private System.Windows.Forms.TextBox keyTextBox; + private System.Windows.Forms.TextBox valueTextBox; + private System.Windows.Forms.Button saveButton; } } \ No newline at end of file diff --git a/PCK-Studio/Forms/Additional-Popups/AddPropertyPrompt.cs b/PCK-Studio/Forms/Additional-Popups/AddPropertyPrompt.cs index 8c83f314..5b082b2e 100644 --- a/PCK-Studio/Forms/Additional-Popups/AddPropertyPrompt.cs +++ b/PCK-Studio/Forms/Additional-Popups/AddPropertyPrompt.cs @@ -1,18 +1,24 @@ using System; +using System.Collections.Generic; using System.Windows.Forms; namespace PckStudio.Forms.Additional_Popups { public partial class AddPropertyPrompt : MetroFramework.Forms.MetroForm { - public string PropertyName => textBox1.Text; - public string PropertyValue => textBox2.Text; + public KeyValuePair Property => new KeyValuePair(keyTextBox.Text, valueTextBox.Text); + + public AddPropertyPrompt(KeyValuePair property) + : this(property.Key, property.Value) + { + + } public AddPropertyPrompt(string name, string value) { InitializeComponent(); - textBox1.Text = name; - textBox2.Text = value; + keyTextBox.Text = name; + valueTextBox.Text = value; } public AddPropertyPrompt() @@ -20,10 +26,9 @@ namespace PckStudio.Forms.Additional_Popups InitializeComponent(); } - private void button1_Click(object sender, EventArgs e) + private void saveButton_Click(object sender, EventArgs e) { DialogResult = DialogResult.OK; - Close(); } } } \ No newline at end of file diff --git a/PCK-Studio/Forms/Additional-Popups/AddPropertyPrompt.resx b/PCK-Studio/Forms/Additional-Popups/AddPropertyPrompt.resx index 23d787dd..2f91780e 100644 --- a/PCK-Studio/Forms/Additional-Popups/AddPropertyPrompt.resx +++ b/PCK-Studio/Forms/Additional-Popups/AddPropertyPrompt.resx @@ -118,49 +118,52 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + 60, 25 - + 193, 20 - + 0 - - textBox1 + + keyTextBox - + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 4 - + 60, 52 - + 193, 20 - + 1 - - textBox2 + + valueTextBox - + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 3 + + False + True @@ -188,6 +191,9 @@ 2 + + False + True @@ -216,31 +222,31 @@ 1 - + Flat - + 96, 78 - + 75, 23 - + 4 - + Save - - button1 + + saveButton - + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 0 @@ -2472,9 +2478,6 @@ vbLH9tge22N7bI/tsT22x/bYHttjC+3/B71iqRn22EDpAAAAAElFTkSuQmCC - - NoControl - 264, 105 @@ -2482,7 +2485,7 @@ CenterParent - addMeta + AddPropertyPrompt MetroFramework.Forms.MetroForm, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a diff --git a/PCK-Studio/MainForm.cs b/PCK-Studio/MainForm.cs index 158cdb6a..48f5af5d 100644 --- a/PCK-Studio/MainForm.cs +++ b/PCK-Studio/MainForm.cs @@ -1037,11 +1037,11 @@ namespace PckStudio } - using (AddPropertyPrompt addDialog = new AddPropertyPrompt(property.Key, property.Value)) + using (AddPropertyPrompt addProperty = new AddPropertyPrompt(property)) { - if (addDialog.ShowDialog() == DialogResult.OK) + if (addProperty.ShowDialog() == DialogResult.OK) { - file.Properties[i] = new KeyValuePair(addDialog.PropertyName, addDialog.PropertyValue); + file.Properties[i] = addProperty.Property; if (IsSubPCKNode(treeViewMain.SelectedNode.FullPath)) RebuildSubPCK(treeViewMain.SelectedNode); ReloadMetaTreeView(); @@ -1124,10 +1124,10 @@ namespace PckStudio if (treeViewMain.SelectedNode is TreeNode t && t.Tag is PckFile.FileData file) { - using AddPropertyPrompt add = new AddPropertyPrompt(); - if (add.ShowDialog() == DialogResult.OK) + using AddPropertyPrompt addProperty = new AddPropertyPrompt(); + if (addProperty.ShowDialog() == DialogResult.OK) { - file.Properties.Add((add.PropertyName, add.PropertyValue)); + file.Properties.Add(addProperty.Property); if (IsSubPCKNode(treeViewMain.SelectedNode.FullPath)) RebuildSubPCK(treeViewMain.SelectedNode); ReloadMetaTreeView(); wasModified = true;