package com.mortals.xhx.daemon.applicationservice;

import com.mortals.framework.springcloud.service.IApplicationStartedService;
import com.mortals.xhx.swing.MyTray;
import com.mortals.xhx.tts.UI.MainWindow;
import com.mortals.xhx.tts.UI.SettingWindow;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;


@Component
@Slf4j
public class DemoStartedService implements IApplicationStartedService {

    @Value("${siteconfig.configpath:F:\\\\config.prop}")
    String configPath;

    @Value("${siteconfig.url:http://192.168.0.98:11091}")
    String host;

    @Value("${version:4.0.0}")
    String version;

    @Override
    public void start() {
        log.info("开始服务..");

        String path = System.getProperty("user.dir");

        log.info("当前路径:{}", path);

        String display = System.getenv("DISPLAY");

        log.info("display:{}",display);

        String osName = System.getProperty("os.name");

        log.info("osName:{}",osName);

        log.info("configPath:{}",configPath);
        log.info("host:{}",host);
        log.info("version:{}",version);
        SettingWindow.getInstance().initWindow(configPath,host);
        MainWindow.getInstance().initWindow(configPath,host,version);


        log.info("初始化托盘完成！");

    }

    @Override
    public void stop() {
        log.info("停止服务..");
    }

    @Override
    public int getOrder() {
        return 10;
    }

}
