Added 'Show Rich Presence' to settings

This commit is contained in:
miku-666
2023-06-03 17:44:38 +02:00
parent e3860782b8
commit ba4aff2e13
5 changed files with 43 additions and 2 deletions

View File

@@ -27,8 +27,11 @@ namespace PckStudio.Classes.Misc
public static void Initialize()
{
Client = new DiscordRpcClient(Settings.Default.RichPresenceId);
Client.Initialize();
if (Settings.Default.ShowRichPresence)
{
Client ??= new DiscordRpcClient(Settings.Default.RichPresenceId);
Client.Initialize();
}
}
public static void SetPresence(string details)

View File

@@ -33,6 +33,7 @@
this.endianCheckBox = new MetroFramework.Controls.MetroCheckBox();
this.autoUpdateCheckBox = new MetroFramework.Controls.MetroCheckBox();
this.autoLoadPckCheckBox = new MetroFramework.Controls.MetroCheckBox();
this.showPresenceCheckBox = new MetroFramework.Controls.MetroCheckBox();
this.SuspendLayout();
//
// autoSaveCheckBox
@@ -98,11 +99,26 @@
this.autoLoadPckCheckBox.UseSelectable = true;
this.autoLoadPckCheckBox.CheckedChanged += new System.EventHandler(this.autoLoadPckCheckBox_CheckedChanged);
//
// showPresenceCheckBox
//
this.showPresenceCheckBox.AutoSize = true;
this.showPresenceCheckBox.Location = new System.Drawing.Point(23, 147);
this.showPresenceCheckBox.Name = "showPresenceCheckBox";
this.showPresenceCheckBox.Size = new System.Drawing.Size(171, 15);
this.showPresenceCheckBox.Style = MetroFramework.MetroColorStyle.White;
this.showPresenceCheckBox.TabIndex = 4;
this.showPresenceCheckBox.Text = "Show Discord Rich Presence";
this.showPresenceCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
this.SettingToolTip.SetToolTip(this.showPresenceCheckBox, "Whether to show a rich presence on discord");
this.showPresenceCheckBox.UseSelectable = true;
this.showPresenceCheckBox.CheckedChanged += new System.EventHandler(this.showPresenceCheckBox_CheckedChanged);
//
// AppBehaviorSettingsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(527, 270);
this.Controls.Add(this.showPresenceCheckBox);
this.Controls.Add(this.autoLoadPckCheckBox);
this.Controls.Add(this.autoUpdateCheckBox);
this.Controls.Add(this.endianCheckBox);
@@ -128,5 +144,6 @@
private MetroFramework.Controls.MetroCheckBox endianCheckBox;
private MetroFramework.Controls.MetroCheckBox autoUpdateCheckBox;
private MetroFramework.Controls.MetroCheckBox autoLoadPckCheckBox;
private MetroFramework.Controls.MetroCheckBox showPresenceCheckBox;
}
}

View File

@@ -35,11 +35,17 @@ namespace PckStudio.Forms.Utilities
Settings.Default.LoadSubPcks = autoLoadPckCheckBox.Checked;
}
private void showPresenceCheckBox_CheckedChanged(object sender, EventArgs e)
{
Settings.Default.ShowRichPresence = showPresenceCheckBox.Checked;
}
private void LoadSettings()
{
autoSaveCheckBox.Checked = Settings.Default.AutoSaveChanges;
endianCheckBox.Checked = Settings.Default.UseLittleEndianAsDefault;
autoLoadPckCheckBox.Checked = Settings.Default.LoadSubPcks;
showPresenceCheckBox.Checked = Settings.Default.ShowRichPresence;
}
private void AppBehaviorSettingsForm_FormClosing(object sender, FormClosingEventArgs e)

View File

@@ -67,5 +67,17 @@ namespace PckStudio.Properties {
this["LoadSubPcks"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool ShowRichPresence {
get {
return ((bool)(this["ShowRichPresence"]));
}
set {
this["ShowRichPresence"] = value;
}
}
}
}

View File

@@ -14,5 +14,8 @@
<Setting Name="LoadSubPcks" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="ShowRichPresence" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
</Settings>
</SettingsFile>