feat: add open config button

This commit is contained in:
Anna 2022-02-19 06:56:38 -05:00
parent 20a456381f
commit 4d3b961704

View File

@ -31,18 +31,24 @@ internal sealed class Settings : IUiComponent {
}; };
this.Ui.Plugin.Commands.Register("/chat2", "Perform various actions with Chat 2.").Execute += this.Command; this.Ui.Plugin.Commands.Register("/chat2", "Perform various actions with Chat 2.").Execute += this.Command;
this.Ui.Plugin.Interface.UiBuilder.OpenConfigUi += this.Toggle;
} }
public void Dispose() { public void Dispose() {
this.Ui.Plugin.Interface.UiBuilder.OpenConfigUi -= this.Toggle;
this.Ui.Plugin.Commands.Register("/chat2").Execute -= this.Command; this.Ui.Plugin.Commands.Register("/chat2").Execute -= this.Command;
} }
private void Command(string command, string args) { private void Command(string command, string args) {
if (string.IsNullOrWhiteSpace(args)) { if (string.IsNullOrWhiteSpace(args)) {
this.Ui.SettingsVisible ^= true; this.Toggle();
} }
} }
private void Toggle() {
this.Ui.SettingsVisible ^= true;
}
private void Initialise() { private void Initialise() {
this.Mutable.UpdateFrom(this.Ui.Plugin.Config); this.Mutable.UpdateFrom(this.Ui.Plugin.Config);
} }