package com.imyeyu.fx.ui.examples;

import com.imyeyu.config.ConfigLoader;
import com.imyeyu.fx.config.BindingsConfig;
import com.imyeyu.fx.ui.TimiFXUI;
import com.imyeyu.fx.ui.examples.bean.Config;
import com.imyeyu.fx.ui.examples.ctrl.Main;
import com.imyeyu.inject.TimiInject;
import com.imyeyu.inject.annotation.TimiInjectApplication;
import com.imyeyu.java.bean.Language;
import com.imyeyu.lang.multi.ResourcesMultilingual;
import javafx.application.Application;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

/**
 * TimiFX 示例程序
 *
 * @author 夜雨
 * @since 2022-05-03 14:52
 */
@Slf4j
@TimiInjectApplication
public class TimiFXExamples {

	/** 版本号 */
	public static final String VERSION = "1.1.1";

	@Getter
	private static Config config;

	@Getter
	private static ConfigLoader<Config> configLoader;

	@Getter
	public static TimiInject inject;

	public static void main(String[] args) {
		{
			configLoader = new ConfigLoader<>("TimiFXExamples.yaml", Config.class);
			BindingsConfig.addAllFXConverter(configLoader);
			config = configLoader.load();

			ResourcesMultilingual multilingual = TimiFXUI.MULTILINGUAL;
			multilingual.addAll("lang/timi-fx-ui/%s.lang");
			multilingual.addAll("lang/%s.lang");
			multilingual.setActivated(Language.Enum.zh_CN);

			// 禁止系统 DPI 缩放
			System.setProperty("prism.allowhidpi", "false");
			System.setProperty("glass.win.minHiDPI", "1");
		}
		Application.launch(Main.class);
	}
}
