diff --git a/ShareX.UploadersLib/Forms/CustomUploaderSettingsForm.Designer.cs b/ShareX.UploadersLib/Forms/CustomUploaderSettingsForm.Designer.cs index 49a1d8685..89c551175 100644 --- a/ShareX.UploadersLib/Forms/CustomUploaderSettingsForm.Designer.cs +++ b/ShareX.UploadersLib/Forms/CustomUploaderSettingsForm.Designer.cs @@ -85,6 +85,9 @@ private void InitializeComponent() this.lblCustomUploaderRequestMethod = new System.Windows.Forms.Label(); this.lblCustomUploaderBody = new System.Windows.Forms.Label(); this.pCustomUploaderBodyArguments = new System.Windows.Forms.Panel(); + this.dgvArguments = new System.Windows.Forms.DataGridView(); + this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.lblCustomUploaderFileFormName = new System.Windows.Forms.Label(); this.txtCustomUploaderFileFormName = new System.Windows.Forms.TextBox(); this.pCustomUploaderBodyData = new System.Windows.Forms.Panel(); @@ -140,9 +143,6 @@ private void InitializeComponent() this.cbCustomUploaderURLSharingService = new System.Windows.Forms.ComboBox(); this.btnCustomUploaderURLSharingServiceTest = new System.Windows.Forms.Button(); this.ttHelpTip = new System.Windows.Forms.ToolTip(this.components); - this.dgvArguments = new System.Windows.Forms.DataGridView(); - this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.tscCustomUploaderResponseText.ContentPanel.SuspendLayout(); this.tscCustomUploaderResponseText.TopToolStripPanel.SuspendLayout(); this.tscCustomUploaderResponseText.SuspendLayout(); @@ -156,6 +156,7 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.dgvParameters)).BeginInit(); this.pCustomUploaderRequestURL.SuspendLayout(); this.pCustomUploaderBodyArguments.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dgvArguments)).BeginInit(); this.pCustomUploaderBodyData.SuspendLayout(); this.pCustomUploaderData.SuspendLayout(); this.tpCustomUploaderResponse.SuspendLayout(); @@ -171,7 +172,6 @@ private void InitializeComponent() this.tpCustomUploaderResult.SuspendLayout(); this.pCustomUploaderResult.SuspendLayout(); this.tpCustomUploaderResponseText.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.dgvArguments)).BeginInit(); this.SuspendLayout(); // // tscCustomUploaderResponseText @@ -474,7 +474,8 @@ private void InitializeComponent() this.dgvHeaders.MultiSelect = false; this.dgvHeaders.Name = "dgvHeaders"; this.dgvHeaders.RowHeadersVisible = false; - this.dgvHeaders.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvHeaders_CellEndEdit); + this.dgvHeaders.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvHeaders_CellValueChanged); + this.dgvHeaders.EditingControlShowing += new System.Windows.Forms.DataGridViewEditingControlShowingEventHandler(this.dgv_EditingControlShowing); // // dataGridViewTextBoxColumn1 // @@ -522,7 +523,8 @@ private void InitializeComponent() this.dgvParameters.MultiSelect = false; this.dgvParameters.Name = "dgvParameters"; this.dgvParameters.RowHeadersVisible = false; - this.dgvParameters.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvParameters_CellEndEdit); + this.dgvParameters.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvParameters_CellValueChanged); + this.dgvParameters.EditingControlShowing += new System.Windows.Forms.DataGridViewEditingControlShowingEventHandler(this.dgv_EditingControlShowing); // // chParametersName // @@ -602,6 +604,55 @@ private void InitializeComponent() resources.ApplyResources(this.pCustomUploaderBodyArguments, "pCustomUploaderBodyArguments"); this.pCustomUploaderBodyArguments.Name = "pCustomUploaderBodyArguments"; // + // dgvArguments + // + this.dgvArguments.AllowUserToResizeRows = false; + this.dgvArguments.BackgroundColor = System.Drawing.SystemColors.Window; + this.dgvArguments.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; + dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle5.Padding = new System.Windows.Forms.Padding(0, 2, 0, 2); + dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dgvArguments.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5; + this.dgvArguments.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dgvArguments.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.dataGridViewTextBoxColumn3, + this.dataGridViewTextBoxColumn4}); + dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle6.Padding = new System.Windows.Forms.Padding(1, 0, 0, 0); + dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Window; + dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.ControlText; + dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgvArguments.DefaultCellStyle = dataGridViewCellStyle6; + this.dgvArguments.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter; + this.dgvArguments.GridColor = System.Drawing.SystemColors.ControlLight; + resources.ApplyResources(this.dgvArguments, "dgvArguments"); + this.dgvArguments.MultiSelect = false; + this.dgvArguments.Name = "dgvArguments"; + this.dgvArguments.RowHeadersVisible = false; + this.dgvArguments.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvArguments_CellValueChanged); + this.dgvArguments.EditingControlShowing += new System.Windows.Forms.DataGridViewEditingControlShowingEventHandler(this.dgv_EditingControlShowing); + // + // dataGridViewTextBoxColumn3 + // + resources.ApplyResources(this.dataGridViewTextBoxColumn3, "dataGridViewTextBoxColumn3"); + this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3"; + this.dataGridViewTextBoxColumn3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + // + // dataGridViewTextBoxColumn4 + // + this.dataGridViewTextBoxColumn4.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + resources.ApplyResources(this.dataGridViewTextBoxColumn4, "dataGridViewTextBoxColumn4"); + this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4"; + this.dataGridViewTextBoxColumn4.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + // // lblCustomUploaderFileFormName // resources.ApplyResources(this.lblCustomUploaderFileFormName, "lblCustomUploaderFileFormName"); @@ -1003,54 +1054,6 @@ private void InitializeComponent() this.ttHelpTip.UseAnimation = false; this.ttHelpTip.UseFading = false; // - // dgvArguments - // - this.dgvArguments.AllowUserToResizeRows = false; - this.dgvArguments.BackgroundColor = System.Drawing.SystemColors.Window; - this.dgvArguments.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single; - dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle5.Padding = new System.Windows.Forms.Padding(0, 2, 0, 2); - dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dgvArguments.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle5; - this.dgvArguments.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dgvArguments.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.dataGridViewTextBoxColumn3, - this.dataGridViewTextBoxColumn4}); - dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle6.Padding = new System.Windows.Forms.Padding(1, 0, 0, 0); - dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Window; - dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.ControlText; - dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgvArguments.DefaultCellStyle = dataGridViewCellStyle6; - this.dgvArguments.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter; - this.dgvArguments.GridColor = System.Drawing.SystemColors.ControlLight; - resources.ApplyResources(this.dgvArguments, "dgvArguments"); - this.dgvArguments.MultiSelect = false; - this.dgvArguments.Name = "dgvArguments"; - this.dgvArguments.RowHeadersVisible = false; - this.dgvArguments.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvArguments_CellEndEdit); - // - // dataGridViewTextBoxColumn3 - // - resources.ApplyResources(this.dataGridViewTextBoxColumn3, "dataGridViewTextBoxColumn3"); - this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3"; - this.dataGridViewTextBoxColumn3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; - // - // dataGridViewTextBoxColumn4 - // - this.dataGridViewTextBoxColumn4.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - resources.ApplyResources(this.dataGridViewTextBoxColumn4, "dataGridViewTextBoxColumn4"); - this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4"; - this.dataGridViewTextBoxColumn4.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; - // // CustomUploaderSettingsForm // this.AllowDrop = true; @@ -1099,6 +1102,7 @@ private void InitializeComponent() this.pCustomUploaderRequestURL.ResumeLayout(false); this.pCustomUploaderBodyArguments.ResumeLayout(false); this.pCustomUploaderBodyArguments.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dgvArguments)).EndInit(); this.pCustomUploaderBodyData.ResumeLayout(false); this.pCustomUploaderData.ResumeLayout(false); this.tpCustomUploaderResponse.ResumeLayout(false); @@ -1118,7 +1122,6 @@ private void InitializeComponent() this.tpCustomUploaderResult.ResumeLayout(false); this.pCustomUploaderResult.ResumeLayout(false); this.tpCustomUploaderResponseText.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.dgvArguments)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); diff --git a/ShareX.UploadersLib/Forms/CustomUploaderSettingsForm.cs b/ShareX.UploadersLib/Forms/CustomUploaderSettingsForm.cs index 7aa1271ca..85e02b0ec 100644 --- a/ShareX.UploadersLib/Forms/CustomUploaderSettingsForm.cs +++ b/ShareX.UploadersLib/Forms/CustomUploaderSettingsForm.cs @@ -61,6 +61,7 @@ public CustomUploaderSettingsForm(UploadersConfig config) InitializeComponent(); Icon = ShareXResources.Icon; + /* CodeMenuItem[] inputCodeMenuItems = new CodeMenuItem[] { new CodeMenuItem("$input$", "Text/URL input"), @@ -70,6 +71,7 @@ public CustomUploaderSettingsForm(UploadersConfig config) new CodeMenuItem("$prompt:title|default_value$", "Lets user to input text"), new CodeMenuItem("$base64:input$", "Base64 encode input") }; + */ CodeMenuItem[] outputCodeMenuItems = new CodeMenuItem[] { @@ -969,7 +971,39 @@ private void cbCustomUploaderRequestFormat_SelectedIndexChanged(object sender, E CustomUploaderUpdateRequestFormatState(); } - private void dgvParameters_CellEndEdit(object sender, DataGridViewCellEventArgs e) + private void dgv_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) + { + if (((DataGridView)sender).CurrentCell.ColumnIndex == 1) + { + if (e.Control is TextBox tb) + { + if (tb.AutoCompleteCustomSource == null || tb.AutoCompleteCustomSource.Count == 0) + { + AutoCompleteStringCollection col = new AutoCompleteStringCollection(); + col.Add("$input$"); + col.Add("$filename$"); + col.Add("$random:"); + col.Add("$select:"); + col.Add("$prompt:"); + col.Add("$base64:"); + + tb.AutoCompleteCustomSource = col; + tb.AutoCompleteSource = AutoCompleteSource.CustomSource; + } + + tb.AutoCompleteMode = AutoCompleteMode.Suggest; + } + } + else + { + if (e.Control is TextBox tb) + { + tb.AutoCompleteMode = AutoCompleteMode.None; + } + } + } + + private void dgvParameters_CellValueChanged(object sender, DataGridViewCellEventArgs e) { CheckDataGridView(dgvParameters); @@ -977,7 +1011,7 @@ private void dgvParameters_CellEndEdit(object sender, DataGridViewCellEventArgs if (uploader != null) uploader.Parameters = DataGridViewToDictionary(dgvParameters); } - private void dgvHeaders_CellEndEdit(object sender, DataGridViewCellEventArgs e) + private void dgvHeaders_CellValueChanged(object sender, DataGridViewCellEventArgs e) { CheckDataGridView(dgvHeaders); @@ -985,7 +1019,7 @@ private void dgvHeaders_CellEndEdit(object sender, DataGridViewCellEventArgs e) if (uploader != null) uploader.Headers = DataGridViewToDictionary(dgvHeaders); } - private void dgvArguments_CellEndEdit(object sender, DataGridViewCellEventArgs e) + private void dgvArguments_CellValueChanged(object sender, DataGridViewCellEventArgs e) { CheckDataGridView(dgvArguments); diff --git a/ShareX.UploadersLib/Forms/CustomUploaderSettingsForm.resx b/ShareX.UploadersLib/Forms/CustomUploaderSettingsForm.resx index b7d7c9a33..78b275ca5 100644 --- a/ShareX.UploadersLib/Forms/CustomUploaderSettingsForm.resx +++ b/ShareX.UploadersLib/Forms/CustomUploaderSettingsForm.resx @@ -2766,18 +2766,6 @@ store.book[0].title System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - lvRegexpsColumn - - - System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ttHelpTip - - - System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - dataGridViewTextBoxColumn3 @@ -2790,6 +2778,18 @@ store.book[0].title System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + lvRegexpsColumn + + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ttHelpTip + + + System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + CustomUploaderSettingsForm