mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-14 22:37:06 -04:00
Automatically select the newly added account
This commit is contained in:
parent
cb6d8a88f1
commit
ae64097edf
@ -146,6 +146,7 @@ public class AddAccountPane extends StackPane {
|
|||||||
|
|
||||||
Task.ofResult("create_account", () -> factory.create(new Selector(), username, password, additionalData))
|
Task.ofResult("create_account", () -> factory.create(new Selector(), username, password, additionalData))
|
||||||
.finalized(Schedulers.javafx(), variables -> {
|
.finalized(Schedulers.javafx(), variables -> {
|
||||||
|
|
||||||
Account account = variables.get("create_account");
|
Account account = variables.get("create_account");
|
||||||
int oldIndex = Accounts.getAccounts().indexOf(account);
|
int oldIndex = Accounts.getAccounts().indexOf(account);
|
||||||
if (oldIndex == -1) {
|
if (oldIndex == -1) {
|
||||||
@ -156,6 +157,10 @@ public class AddAccountPane extends StackPane {
|
|||||||
Accounts.getAccounts().remove(oldIndex);
|
Accounts.getAccounts().remove(oldIndex);
|
||||||
Accounts.getAccounts().add(oldIndex, account);
|
Accounts.getAccounts().add(oldIndex, account);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// select the new account
|
||||||
|
Accounts.setSelectedAccount(account);
|
||||||
|
|
||||||
acceptPane.hideSpinner();
|
acceptPane.hideSpinner();
|
||||||
fireEvent(new DialogCloseEvent());
|
fireEvent(new DialogCloseEvent());
|
||||||
}, exception -> {
|
}, exception -> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user