[Enhancement] 不在主界面,或者已显示对话框的情况下,暂时不弹出启动器更新对话框 by Calboot · Pull Request #5768 · HMCL-dev/HMCL

public static void showLater(StackPane container, Runnable showDialogAction) {
FXUtils.checkFxUserThread();
if (container.getProperties().get(PROPERTY_DIALOG_INSTANCE) == null) {
showDialogAction.run();
return;
}
Queue<Runnable> queue = (Queue<Runnable>) container.getProperties().get(PROPERTY_DIALOG_SHOW_LATER);
if (queue == null) {
queue = new LinkedList<>();
container.getProperties().put(PROPERTY_DIALOG_SHOW_LATER, queue);
}
queue.add(showDialogAction);
}
@SuppressWarnings("unchecked")
public static void showLater(StackPane container, Runnable showDialogAction) {
FXUtils.checkFxUserThread();
if (showDialogAction == null) return;
if (container.getProperties().get(PROPERTY_DIALOG_INSTANCE) == null) {
showDialogAction.run();
return;
}
Queue<Runnable> queue = (Queue<Runnable>) container.getProperties().get(PROPERTY_DIALOG_SHOW_LATER);
if (queue == null) {
queue = new LinkedList<>();
container.getProperties().put(PROPERTY_DIALOG_SHOW_LATER, queue);
}
queue.add(showDialogAction);
}