Ticket ID: 26483
|
Date de création: 27/04/2023 22:29
|
Produit: SiteKiosk Classic Windows
|
Annexe: -
|
TicketType d´article: Support Request
|
Version: 9.9.10978
|
Langue: Anglais
|
Adressages: 5038
|
Dernière modification: 26/05/2023 15:30
|
Plateforme:
|
|
Niveau: Fermé
|
|
|
Support Request: Periodic Event not Firing
We are using a Watchdog script to automatically launch our WinForms application on SiteKiosk start and to restart the application if it closes/crashes. Lastly, we are also using it to ensure it stays maximized and this is where we are having an issue (CheckAppIsMinimized). If the window is minimized, it never gets maximized. This used to work although I can't say when it stopped working. Is there anything obvious in this script that could cause the issue? One thing I suspected was perhaps when the OnRemove function gets called, perhaps the handle for the window is invalidated?
SiteKiosk.WindowList.OnRemove = OnRemove; //fires if a window has been closed
SiteKiosk.WindowList.OnInsert = OnInsert; //fires if a windows is inserted
var gk_skwin; //global variable for the window object to monitor the application
SiteKiosk.Scheduler.AddDelayedEvent(500, StartMyApp); //starts the desired application the first time after 500 ms
SiteKiosk.Scheduler.AddPeriodicEvent(1000, CheckAppIsMinimized); //monitors whether application is minimzed every 1000 ms
SiteKiosk.Scheduler.AddDelayedEvent(1000, StartScreenCaptures); //starts screen capture which runs in its own loop
function StartMyApp(){
SiteKiosk.ExternalApps.Run("C:\\Program Files\\FrontEdge\\Kiosk\\CheckinKiosk.exe", true);
}
function StartScreenCaptures(){
SiteKiosk.ExternalApps.Run("C:\\Program Files\\FrontEdge\\ScreenCapture\\FrontEdgeKioskScreenCapture.exe", false);
}
function OnInsert(skwin){
//check if our application has been started
if(skwin.ItemText === "FrontEdge Check-In"){
gk_skwin = skwin; //application has been started, assign returned window object to global variable
}
}
function OnRemove(skwin){
//checks if the application that should run has been closed
if(skwin.ItemText === "FrontEdge Check-In"){
//the application has been closed, restart it again
SiteKiosk.Scheduler.AddDelayedEvent(30000, StartMyApp); //starts the desired application the next time after 30000 ms
}
}
function CheckAppIsMinimized(){
//use try/catch in case our application is not started and can therefore not be monitored
try{
//check if application is minimized
if(SiteKiosk.WindowList.IsMinimized(gk_skwin.Handle)){
//maximize the minimzed application
SiteKiosk.WindowList.Maximize(gk_skwin.Handle);
}
}catch(e){}
}