mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 15:31:42 +00:00
Update the Screen Matching feature
This commit is contained in:
parent
b687cf7727
commit
3b09a47fb8
|
@ -114,7 +114,7 @@ namespace WelsonJS.Service
|
|||
|
||||
Timer screenTimer = new Timer
|
||||
{
|
||||
Interval = 1000 // 1 second
|
||||
Interval = 10000 // 10 seconds
|
||||
};
|
||||
screenTimer.Elapsed += OnScreenTime;
|
||||
timers.Add(screenTimer);
|
||||
|
@ -224,10 +224,9 @@ namespace WelsonJS.Service
|
|||
Log(result.ScreenNumber.ToString());
|
||||
Log(result.Location.ToString());
|
||||
|
||||
Log(DispatchServiceEvent("screenTime", new object[]
|
||||
Log(DispatchServiceEvent("screenTime", new string[]
|
||||
{
|
||||
result.FileName,
|
||||
result.ScreenNumber.ToString(),
|
||||
result.Location.X.ToString(),
|
||||
result.Location.Y.ToString(),
|
||||
result.MaxCorrelation.ToString()
|
||||
|
@ -240,9 +239,17 @@ namespace WelsonJS.Service
|
|||
}
|
||||
}
|
||||
|
||||
private string DispatchServiceEvent(string eventType, object[] args = null)
|
||||
private string DispatchServiceEvent(string eventType, string[] args = null)
|
||||
{
|
||||
return InvokeScriptMethod("dispatchServiceEvent", scriptName, eventType, args);
|
||||
if (args == null)
|
||||
{
|
||||
return InvokeScriptMethod("dispatchServiceEvent", scriptName, eventType, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
return InvokeScriptMethod("dispatchServiceEvent", scriptName, eventType, String.Join("; ", args));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private string InvokeScriptMethod(string methodName, params object[] parameters)
|
||||
|
|
3
app.js
3
app.js
|
@ -589,8 +589,9 @@ function initializeWindow(name, args, w, h) {
|
|||
}
|
||||
}
|
||||
|
||||
function dispatchServiceEvent(name, eventType, args) {
|
||||
function dispatchServiceEvent(name, eventType, _args) {
|
||||
var app = require(name);
|
||||
var args = _args.split('; ');
|
||||
|
||||
// load the service
|
||||
if (app) {
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -14,8 +14,8 @@ function onServiceElapsedTime() {
|
|||
return "onServiceElapsedTime recevied";
|
||||
}
|
||||
|
||||
function onServiceScreenTime(filename, handle, title, x, y, maxCorrelation) {
|
||||
return "onServiceScreenTime recevied. " + filename;
|
||||
function onServiceScreenTime(args) {
|
||||
return "onServiceScreenTime recevied. " + args.join(', ');
|
||||
}
|
||||
|
||||
exports.main = main;
|
||||
|
|
Loading…
Reference in New Issue
Block a user