refactor: reduce indent level
This commit is contained in:
parent
04ef5e84cc
commit
b811c762e6
|
@ -224,26 +224,28 @@ namespace NoSoliciting {
|
|||
this.DrawBasicMachineLearningConfig();
|
||||
}
|
||||
|
||||
if (ImGui.BeginTabItem("Model")) {
|
||||
ImGui.TextUnformatted($"Version: {this.Plugin.MlFilter?.Version}");
|
||||
ImGui.TextUnformatted($"Model status: {this.Plugin.MlStatus.Description()}");
|
||||
var lastError = MlFilter.LastError;
|
||||
if (lastError != null) {
|
||||
ImGui.TextUnformatted($"Last error: {lastError}");
|
||||
}
|
||||
|
||||
if (ImGui.Button("Update model")) {
|
||||
// prevent issues when people spam the button
|
||||
if (ImGui.GetIO().KeyCtrl || this.Plugin.MlStatus == MlFilterStatus.Uninitialised || this.Plugin.MlStatus == MlFilterStatus.Initialised) {
|
||||
this.Plugin.MlFilter?.Dispose();
|
||||
this.Plugin.MlFilter = null;
|
||||
this.Plugin.MlStatus = MlFilterStatus.Uninitialised;
|
||||
this.Plugin.InitialiseMachineLearning();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.EndTabItem();
|
||||
if (!ImGui.BeginTabItem("Model")) {
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui.TextUnformatted($"Version: {this.Plugin.MlFilter?.Version}");
|
||||
ImGui.TextUnformatted($"Model status: {this.Plugin.MlStatus.Description()}");
|
||||
var lastError = MlFilter.LastError;
|
||||
if (lastError != null) {
|
||||
ImGui.TextUnformatted($"Last error: {lastError}");
|
||||
}
|
||||
|
||||
if (ImGui.Button("Update model")) {
|
||||
// prevent issues when people spam the button
|
||||
if (ImGui.GetIO().KeyCtrl || this.Plugin.MlStatus == MlFilterStatus.Uninitialised || this.Plugin.MlStatus == MlFilterStatus.Initialised) {
|
||||
this.Plugin.MlFilter?.Dispose();
|
||||
this.Plugin.MlFilter = null;
|
||||
this.Plugin.MlStatus = MlFilterStatus.Uninitialised;
|
||||
this.Plugin.InitialiseMachineLearning();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.EndTabItem();
|
||||
}
|
||||
|
||||
private void DrawBasicMachineLearningConfig() {
|
||||
|
|
Loading…
Reference in New Issue