|
|
|
@ -24,6 +24,7 @@ import xyz.wbsite.jmacro.tool.PickLegend;
|
|
|
|
|
import xyz.wbsite.jmacro.tool.PickPoint;
|
|
|
|
|
import xyz.wbsite.jmacro.tool.PickRect;
|
|
|
|
|
import xyz.wbsite.jmacro.util.DialogUtil;
|
|
|
|
|
import xyz.wbsite.jmacro.util.Logger;
|
|
|
|
|
|
|
|
|
|
import java.awt.*;
|
|
|
|
|
import java.net.URL;
|
|
|
|
@ -54,8 +55,6 @@ public class JMainController implements Initializable {
|
|
|
|
|
@FXML
|
|
|
|
|
private TextField times;
|
|
|
|
|
@FXML
|
|
|
|
|
private Button capture;
|
|
|
|
|
@FXML
|
|
|
|
|
private ImageView preview;
|
|
|
|
|
@FXML
|
|
|
|
|
private TextArea console;
|
|
|
|
@ -65,14 +64,13 @@ public class JMainController implements Initializable {
|
|
|
|
|
|
|
|
|
|
private Semaphore semaphore = new Semaphore(1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static synchronized JMainController getInstance() {
|
|
|
|
|
return instance;
|
|
|
|
|
return JMainController.instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void initialize(URL location, ResourceBundle resources) {
|
|
|
|
|
this.instance = this;
|
|
|
|
|
JMainController.instance = this;
|
|
|
|
|
// 控件初始化
|
|
|
|
|
int intervalValue = JProp.getInstance().getInt("interval", 60);
|
|
|
|
|
this.interval.setText(String.valueOf(intervalValue));
|
|
|
|
@ -169,9 +167,19 @@ public class JMainController implements Initializable {
|
|
|
|
|
*/
|
|
|
|
|
@FXML
|
|
|
|
|
public void onStart() {
|
|
|
|
|
boolean start = JMainService.start();
|
|
|
|
|
this.start.setDisable(start);
|
|
|
|
|
this.stop.setDisable(!start);
|
|
|
|
|
synchronized (JMainController.class) {
|
|
|
|
|
this.start.setDisable(true);
|
|
|
|
|
this.stop.setDisable(false);
|
|
|
|
|
Logger.info("启动服务");
|
|
|
|
|
if (!JMainService.getInstance().run) {
|
|
|
|
|
boolean start = JMainService.start();
|
|
|
|
|
if (!start) {
|
|
|
|
|
Logger.error("服务启动失败");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Logger.info("服务启动成功");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -179,10 +187,20 @@ public class JMainController implements Initializable {
|
|
|
|
|
*/
|
|
|
|
|
@FXML
|
|
|
|
|
public void onStop() {
|
|
|
|
|
boolean stop = JMainService.stop();
|
|
|
|
|
this.start.setDisable(!stop);
|
|
|
|
|
this.stop.setDisable(stop);
|
|
|
|
|
this.preview.setImage(null);
|
|
|
|
|
synchronized (JMainController.class) {
|
|
|
|
|
this.start.setDisable(false);
|
|
|
|
|
this.stop.setDisable(true);
|
|
|
|
|
Logger.info("停止服务");
|
|
|
|
|
if (JMainService.getInstance().run) {
|
|
|
|
|
boolean stop = JMainService.stop();
|
|
|
|
|
if (!stop) {
|
|
|
|
|
Logger.error("服务停止失败");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Logger.info("服务停止成功");
|
|
|
|
|
this.preview.setImage(null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|