package home;
|
|
import javax.swing.SwingUtilities;
|
|
public class Mains {
|
// ¼Ç¼Æô¶¯Ê±¼ä
|
private static long startTime;
|
|
public static void main(String[] args) {
|
// ¼Ç¼Æô¶¯Ê±¼ä
|
startTime = System.currentTimeMillis();
|
// ¼Ç¼´ò¿ªÈÕÖ¾
|
LogUtil.logOpen();
|
|
if (SingleInstanceLock.lock()) {
|
try {
|
// ÔÚʼþµ÷¶ÈÏß³ÌÖд´½¨ºÍÏÔʾGUI
|
SwingUtilities.invokeLater(() -> {
|
try {
|
// ´´½¨²¢ÏÔʾÖ÷½çÃæ
|
AOAFollowSystem system = new AOAFollowSystem();
|
system.setVisible(true);
|
} catch (Exception e) {
|
e.printStackTrace();
|
LogUtil.log("Æô¶¯¿ÉÊÓ»¯½çÃæÊ±·¢Éú´íÎó: " + e.getMessage());
|
}
|
});
|
} finally {
|
// Ìí¼Ó¹Ø±Õ¹³×Ó
|
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
// ¼Ç¼¹Ø±ÕÈÕÖ¾
|
LogUtil.logClose(startTime);
|
// Êͷŵ¥ÊµÀýËø
|
SingleInstanceLock.release();
|
}));
|
}
|
} else {
|
// ÏÔʾ³ÌÐòÒÑÔÚÔËÐеľ¯¸æ
|
SingleInstanceLock.showAlreadyRunningWarning();
|
// Í˳ö³ÌÐò
|
System.exit(0);
|
}
|
}
|
}
|