mirror of
https://github.com/EnderIce2/SDR-RPC.git
synced 2025-05-26 03:14:26 +00:00
Changes in interface and how plugin works
This commit is contained in:
parent
94385a30ec
commit
d303158d1c
@ -114,11 +114,17 @@ namespace EnderIce2.SDRSharpPlugin
|
||||
LogWriter.WriteToFile($"RdsProgramService: {_control.RdsProgramService}");
|
||||
LogWriter.WriteToFile("Setting presence...");
|
||||
presence.Details = $"Frequency: {$"{_control.Frequency:#,0,,0 Hz}"}";
|
||||
presence.State = string.IsNullOrWhiteSpace(_control.RdsRadioText + _control.RdsProgramService)
|
||||
? "RDS: unknown"
|
||||
: _control.FmStereo
|
||||
? $"RDS: ((( {_control.RdsProgramService} ))) - {_control.RdsRadioText}"
|
||||
: $"RDS: {_control.RdsProgramService} - {_control.RdsRadioText}";
|
||||
if (!string.IsNullOrWhiteSpace(_control.RdsRadioText + _control.RdsProgramService))
|
||||
{
|
||||
string radio_text = string.IsNullOrWhiteSpace(_control.RdsRadioText) ? "" : $" - {_control.RdsRadioText}";
|
||||
presence.State = _control.FmStereo
|
||||
? $"RDS: ((( {_control.RdsProgramService} ))){radio_text}"
|
||||
: $"RDS: {_control.RdsProgramService}{radio_text}";
|
||||
}
|
||||
else
|
||||
{
|
||||
presence.State = $"RDS: unknown";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.2")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.2")]
|
||||
[assembly: AssemblyVersion("1.1.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.1.0.0")]
|
||||
|
148
SettingsForm.Designer.cs
generated
148
SettingsForm.Designer.cs
generated
@ -28,33 +28,23 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingsForm));
|
||||
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.checkBox1 = new System.Windows.Forms.CheckBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.checkBox1 = new System.Windows.Forms.CheckBox();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.button3 = new System.Windows.Forms.Button();
|
||||
this.button4 = new System.Windows.Forms.Button();
|
||||
this.button5 = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// richTextBox1
|
||||
//
|
||||
this.richTextBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(15)))), ((int)(((byte)(15)))));
|
||||
this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.richTextBox1.Cursor = System.Windows.Forms.Cursors.Default;
|
||||
this.richTextBox1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
|
||||
this.richTextBox1.Location = new System.Drawing.Point(12, 58);
|
||||
this.richTextBox1.Name = "richTextBox1";
|
||||
this.richTextBox1.ReadOnly = true;
|
||||
this.richTextBox1.Size = new System.Drawing.Size(776, 327);
|
||||
this.richTextBox1.TabIndex = 0;
|
||||
this.richTextBox1.Text = resources.GetString("richTextBox1.Text");
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.button1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(15)))), ((int)(((byte)(15)))));
|
||||
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button1.Location = new System.Drawing.Point(713, 415);
|
||||
this.button1.Location = new System.Drawing.Point(200, 126);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 23);
|
||||
this.button1.TabIndex = 1;
|
||||
@ -62,67 +52,117 @@
|
||||
this.button1.UseVisualStyleBackColor = false;
|
||||
this.button1.Click += new System.EventHandler(this.Button1_Click);
|
||||
//
|
||||
// checkBox1
|
||||
//
|
||||
this.checkBox1.AutoSize = true;
|
||||
this.checkBox1.Location = new System.Drawing.Point(93, 419);
|
||||
this.checkBox1.Name = "checkBox1";
|
||||
this.checkBox1.Size = new System.Drawing.Size(193, 17);
|
||||
this.checkBox1.TabIndex = 2;
|
||||
this.checkBox1.Text = "Don\'t show me this next time";
|
||||
this.checkBox1.UseVisualStyleBackColor = true;
|
||||
this.checkBox1.CheckedChanged += new System.EventHandler(this.CheckBox1_CheckedChanged);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F);
|
||||
this.label1.Location = new System.Drawing.Point(12, 9);
|
||||
this.label1.Location = new System.Drawing.Point(6, 6);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(170, 24);
|
||||
this.label1.Size = new System.Drawing.Size(241, 24);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "DiscordRPC Plugin";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(9, 42);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(60, 13);
|
||||
this.label2.TabIndex = 4;
|
||||
this.label2.Text = "Licenses:";
|
||||
this.label1.Text = "DiscordRPC Plugin Settings";
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.button2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(15)))), ((int)(((byte)(15)))));
|
||||
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button2.Location = new System.Drawing.Point(12, 415);
|
||||
this.button2.Location = new System.Drawing.Point(12, 126);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(75, 23);
|
||||
this.button2.Size = new System.Drawing.Size(93, 23);
|
||||
this.button2.TabIndex = 5;
|
||||
this.button2.Text = "Support Me";
|
||||
this.button2.UseVisualStyleBackColor = false;
|
||||
this.button2.Click += new System.EventHandler(this.Button2_Click);
|
||||
//
|
||||
// checkBox1
|
||||
//
|
||||
this.checkBox1.AutoSize = true;
|
||||
this.checkBox1.Location = new System.Drawing.Point(12, 105);
|
||||
this.checkBox1.Name = "checkBox1";
|
||||
this.checkBox1.Size = new System.Drawing.Size(205, 17);
|
||||
this.checkBox1.TabIndex = 6;
|
||||
this.checkBox1.Text = "Enable Logging (for debugging)";
|
||||
this.checkBox1.UseVisualStyleBackColor = true;
|
||||
this.checkBox1.CheckedChanged += new System.EventHandler(this.CheckBox1_CheckedChanged_1);
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(25)))), ((int)(((byte)(25)))));
|
||||
this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBox1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
|
||||
this.textBox1.Location = new System.Drawing.Point(12, 49);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(263, 21);
|
||||
this.textBox1.TabIndex = 7;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(13, 33);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(63, 13);
|
||||
this.label2.TabIndex = 8;
|
||||
this.label2.Text = "Client ID:";
|
||||
//
|
||||
// button3
|
||||
//
|
||||
this.button3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(15)))), ((int)(((byte)(15)))));
|
||||
this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button3.Location = new System.Drawing.Point(141, 76);
|
||||
this.button3.Name = "button3";
|
||||
this.button3.Size = new System.Drawing.Size(64, 23);
|
||||
this.button3.TabIndex = 9;
|
||||
this.button3.Text = "Reset";
|
||||
this.button3.UseVisualStyleBackColor = false;
|
||||
this.button3.Click += new System.EventHandler(this.Button3_Click);
|
||||
//
|
||||
// button4
|
||||
//
|
||||
this.button4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(15)))), ((int)(((byte)(15)))));
|
||||
this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button4.Location = new System.Drawing.Point(211, 76);
|
||||
this.button4.Name = "button4";
|
||||
this.button4.Size = new System.Drawing.Size(64, 23);
|
||||
this.button4.TabIndex = 10;
|
||||
this.button4.Text = "Apply";
|
||||
this.button4.UseVisualStyleBackColor = false;
|
||||
this.button4.Click += new System.EventHandler(this.Button4_Click);
|
||||
//
|
||||
// button5
|
||||
//
|
||||
this.button5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.button5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(15)))), ((int)(((byte)(15)))));
|
||||
this.button5.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
||||
this.button5.Location = new System.Drawing.Point(111, 126);
|
||||
this.button5.Name = "button5";
|
||||
this.button5.Size = new System.Drawing.Size(83, 23);
|
||||
this.button5.TabIndex = 11;
|
||||
this.button5.Text = "Licenses";
|
||||
this.button5.UseVisualStyleBackColor = false;
|
||||
this.button5.Click += new System.EventHandler(this.Button5_Click);
|
||||
//
|
||||
// SettingsForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(28)))), ((int)(((byte)(28)))), ((int)(((byte)(28)))));
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.button2);
|
||||
this.ClientSize = new System.Drawing.Size(287, 161);
|
||||
this.Controls.Add(this.button5);
|
||||
this.Controls.Add(this.button4);
|
||||
this.Controls.Add(this.button3);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.checkBox1);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.richTextBox1);
|
||||
this.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(816, 489);
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(816, 489);
|
||||
this.Name = "SettingsForm";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
@ -135,12 +175,14 @@
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.RichTextBox richTextBox1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.CheckBox checkBox1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.CheckBox checkBox1;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Button button3;
|
||||
private System.Windows.Forms.Button button4;
|
||||
private System.Windows.Forms.Button button5;
|
||||
}
|
||||
}
|
@ -6,13 +6,43 @@ namespace EnderIce2.SDRSharpPlugin
|
||||
{
|
||||
public partial class SettingsForm : Form
|
||||
{
|
||||
public SettingsForm() => InitializeComponent();
|
||||
public SettingsForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
textBox1.Text = Utils.GetStringSetting("ClientID");
|
||||
checkBox1.Checked = Utils.GetBooleanSetting("LogRPC", false);
|
||||
}
|
||||
|
||||
private void Button2_Click(object sender, EventArgs e) => System.Diagnostics.Process.Start("https://ko-fi.com/enderice2");
|
||||
|
||||
private void Button1_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private void CheckBox1_CheckedChanged(object sender, EventArgs e) => Utils.SaveSetting("ShowWelcomePage", !checkBox1.Checked);
|
||||
|
||||
private void Button5_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("MIT License\n\nCopyright (c) 2018 Lachee\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.", "discord-rpc-csharp");
|
||||
MessageBox.Show("The MIT License (MIT)\n\nCopyright(c) 2007 James Newton-King\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", "Newtonsoft.Json");
|
||||
}
|
||||
|
||||
private void CheckBox1_CheckedChanged_1(object sender, EventArgs e) => Utils.SaveSetting("LogRPC", checkBox1.Checked);
|
||||
|
||||
private void Button4_Click(object sender, EventArgs e)
|
||||
{
|
||||
textBox1.Text.Replace(" ", "").Replace("\n", "").Replace("\r", "");
|
||||
if (!int.TryParse(textBox1.Text, out _) || textBox1.Text.Length != 18)
|
||||
{
|
||||
MessageBox.Show("Invalid Client ID!");
|
||||
}
|
||||
Utils.SaveSetting("ClientID", textBox1.Text);
|
||||
label1.Text = $"Configuration Updated.\nNew ID: {Utils.GetStringSetting("ClientID")}";
|
||||
}
|
||||
|
||||
private void Button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
Utils.SaveSetting("ClientID", "765213507321856078");
|
||||
textBox1.Text = "765213507321856078";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,44 +117,4 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="richTextBox1.Text" xml:space="preserve">
|
||||
<value>-----------------------------------------------------------------------------------
|
||||
URL for discord-rpc-csharp: https://github.com/Lachee/discord-rpc-csharp
|
||||
License for discord-rpc-csharp:
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Lachee
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
-----------------------------------------------------------------------------------
|
||||
URL for Newtonsoft.Json: https://github.com/JamesNK/Newtonsoft.Json
|
||||
License for Newtonsoft.Json:
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2007 James Newton-King
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DE</value>
|
||||
</data>
|
||||
</root>
|
56
SettingsPanel.Designer.cs
generated
56
SettingsPanel.Designer.cs
generated
@ -30,10 +30,7 @@
|
||||
{
|
||||
this.checkBox1 = new System.Windows.Forms.CheckBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.checkBox2 = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// checkBox1
|
||||
@ -46,7 +43,7 @@
|
||||
this.checkBox1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
|
||||
this.checkBox1.Location = new System.Drawing.Point(3, 3);
|
||||
this.checkBox1.Name = "checkBox1";
|
||||
this.checkBox1.Size = new System.Drawing.Size(150, 21);
|
||||
this.checkBox1.Size = new System.Drawing.Size(153, 21);
|
||||
this.checkBox1.TabIndex = 0;
|
||||
this.checkBox1.Text = "Enable Discord RPC";
|
||||
this.checkBox1.UseVisualStyleBackColor = true;
|
||||
@ -60,39 +57,13 @@
|
||||
this.label1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.label1.Font = new System.Drawing.Font("Verdana", 7F);
|
||||
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
|
||||
this.label1.Location = new System.Drawing.Point(1, 46);
|
||||
this.label1.Location = new System.Drawing.Point(0, 28);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(200, 57);
|
||||
this.label1.Size = new System.Drawing.Size(200, 132);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "Loading status...";
|
||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(15)))), ((int)(((byte)(15)))));
|
||||
this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.textBox1.Font = new System.Drawing.Font("Verdana", 7F);
|
||||
this.textBox1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
|
||||
this.textBox1.Location = new System.Drawing.Point(59, 131);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(138, 19);
|
||||
this.textBox1.TabIndex = 2;
|
||||
this.textBox1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBox1_KeyDown);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Font = new System.Drawing.Font("Verdana", 7F);
|
||||
this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
|
||||
this.label2.Location = new System.Drawing.Point(0, 133);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(59, 12);
|
||||
this.label2.TabIndex = 3;
|
||||
this.label2.Text = "Client ID:";
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
@ -109,29 +80,12 @@
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.Button1_Click);
|
||||
//
|
||||
// checkBox2
|
||||
//
|
||||
this.checkBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.checkBox2.Font = new System.Drawing.Font("Verdana", 6.5F);
|
||||
this.checkBox2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(244)))), ((int)(((byte)(244)))), ((int)(((byte)(244)))));
|
||||
this.checkBox2.Location = new System.Drawing.Point(3, 22);
|
||||
this.checkBox2.Name = "checkBox2";
|
||||
this.checkBox2.Size = new System.Drawing.Size(162, 21);
|
||||
this.checkBox2.TabIndex = 5;
|
||||
this.checkBox2.Text = "Log RPC (for debugging)";
|
||||
this.checkBox2.UseVisualStyleBackColor = true;
|
||||
this.checkBox2.CheckedChanged += new System.EventHandler(this.CheckBox2_CheckedChanged);
|
||||
//
|
||||
// SettingsPanel
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(15)))), ((int)(((byte)(15)))));
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.checkBox2);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.checkBox1);
|
||||
this.Font = new System.Drawing.Font("Verdana", 7F);
|
||||
@ -141,7 +95,6 @@
|
||||
this.Size = new System.Drawing.Size(200, 160);
|
||||
this.Load += new System.EventHandler(this.SettingsPanel_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
@ -149,9 +102,6 @@
|
||||
|
||||
private System.Windows.Forms.CheckBox checkBox1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.CheckBox checkBox2;
|
||||
}
|
||||
}
|
||||
|
@ -21,10 +21,8 @@ namespace EnderIce2.SDRSharpPlugin
|
||||
public SettingsPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
textBox1.Text = Utils.GetStringSetting("ClientID");
|
||||
checkBox1.Checked = Utils.GetBooleanSetting("EnableRPC", true);
|
||||
checkBox2.Checked = Utils.GetBooleanSetting("LogRPC", false);
|
||||
LogWriter.WriteToFile("SettingsPanel loaded");
|
||||
LogWriter.WriteToFile("User Control Loaded");
|
||||
}
|
||||
|
||||
private void Button1_Click(object sender, EventArgs e) => new SettingsForm().Show();
|
||||
@ -34,31 +32,6 @@ namespace EnderIce2.SDRSharpPlugin
|
||||
Utils.SaveSetting("EnableRPC", checkBox1.Checked);
|
||||
label1.Text = "Restart required";
|
||||
LogWriter.WriteToFile($"checkbox on SettingsPanel clicked {checkBox1.Checked}");
|
||||
/* Utils.GetBooleanSetting("EnableRPC"); */
|
||||
}
|
||||
|
||||
private void CheckBox2_CheckedChanged(object sender, EventArgs e) => Utils.SaveSetting("LogRPC", checkBox2.Checked);
|
||||
|
||||
private async void TextBox1_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
textBox1.Text.Replace(" ", "");
|
||||
if (!int.TryParse(textBox1.Text, out _))
|
||||
{
|
||||
MessageBox.Show("Invalid ID!");
|
||||
}
|
||||
if (e.KeyCode == Keys.Enter && textBox1.Text.Length == 18)
|
||||
{
|
||||
Utils.SaveSetting("ClientID", textBox1.Text);
|
||||
}
|
||||
else if (e.KeyCode == Keys.Enter && textBox1.Text.Length != 18)
|
||||
{
|
||||
Utils.SaveSetting("ClientID", "765213507321856078"); // TODO: do it better
|
||||
}
|
||||
e.Handled = true;
|
||||
e.SuppressKeyPress = true;
|
||||
await Task.Delay(100).ConfigureAwait(false);
|
||||
textBox1.Text = Utils.GetStringSetting("ClientID"); // write what we stored, should not trigger keydown event
|
||||
label1.Text = $"Configuration Updated.\nNew ID: {Utils.GetStringSetting("ClientID")}";
|
||||
}
|
||||
|
||||
private void SettingsPanel_Load(object sender, EventArgs e)
|
||||
|
Loading…
x
Reference in New Issue
Block a user