package com.jtyjy.pdf2pptx.application;

import com.jtyjy.pdf2pptx.service.ConverterService;
import com.jtyjy.pdf2pptx.support.Constant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationListener;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

import javax.swing.*;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.Calendar;
import java.util.Date;

@Component
public class AppListener implements ApplicationListener<ContextRefreshedEvent> {

    @Value("${file.path}")
    private String filepath;
    private final  static Logger logger = LoggerFactory.getLogger(AppListener.class);
    @Autowired
    private ConverterService converterService;


    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
        /*System.err.println("正在处理 " + filepath);
        System.err.println("处理开始 " + LocalDateTime.now());
        converterService.converterPdf2Pptx(filepath);
        System.err.println("处理完成 " + LocalDateTime.now());
        JOptionPane.showMessageDialog(new JFrame().getContentPane(),
                "文件转换完成!", "提示", JOptionPane.INFORMATION_MESSAGE);*/
    }
}
