using System; using System.Windows.Forms; namespace BandagedBD.Controls { public partial class DiscordLocator : UserControl { public bool stable => discordStable.Checked; public bool canary => discordCanary.Checked; public bool ptb => discordPTB.Checked; public EventHandler OnCheckedChange; public DiscordLocator() { InitializeComponent(); if (Utilities.CurrentStablePath != null) tbStable.Text = Utilities.CurrentStablePath; if (Utilities.CurrentCanaryPath != null) tbCanary.Text = Utilities.CurrentCanaryPath; if (Utilities.CurrentPtbPath != null) tbPTB.Text = Utilities.CurrentPtbPath; Utilities.EnsureDiscord(tbStable, discordStable, Discord.Stable); Utilities.EnsureDiscord(tbCanary, discordCanary, Discord.Canary); Utilities.EnsureDiscord(tbPTB, discordPTB, Discord.PTB); } public void setLabel(string label) { titleLabel.Text = label; } public void setCheckboxLabel(Discord which, string label) { if (which == Discord.Stable) discordStable.Text = label; if (which == Discord.Canary) discordCanary.Text = label; if (which == Discord.PTB) discordPTB.Text = label; } private void browseStable_Click(object sender, EventArgs e) { var fbd = new FolderBrowserDialog { SelectedPath = tbStable.Text }; fbd.ShowDialog(); tbStable.Text = fbd.SelectedPath; Utilities.EnsureDiscord(tbStable, discordStable, Discord.Stable); } private void browseCanary_Click(object sender, EventArgs e) { var fbd = new FolderBrowserDialog { SelectedPath = tbCanary.Text }; fbd.ShowDialog(); tbCanary.Text = fbd.SelectedPath; Utilities.EnsureDiscord(tbCanary, discordCanary, Discord.Canary); } private void browsePTB_Click(object sender, EventArgs e) { var fbd = new FolderBrowserDialog { SelectedPath = tbPTB.Text }; fbd.ShowDialog(); tbPTB.Text = fbd.SelectedPath; Utilities.EnsureDiscord(tbPTB, discordPTB, Discord.PTB); } private void discordStable_CheckedChanged(object sender, EventArgs e) { if (discordStable.Checked) Utilities.EnsureDiscord(tbStable, discordStable, Discord.Stable); OnCheckedChange?.Invoke(sender, e); } private void discordCanary_CheckedChanged(object sender, EventArgs e) { if (discordCanary.Checked) Utilities.EnsureDiscord(tbCanary, discordCanary, Discord.Canary); OnCheckedChange?.Invoke(sender, e); } private void discordPTB_CheckedChanged(object sender, EventArgs e) { if (discordPTB.Checked) Utilities.EnsureDiscord(tbPTB, discordPTB, Discord.PTB); OnCheckedChange?.Invoke(sender, e); } } }