Page 1 of 1

custom Screensaver

Posted: Tue Jul 15, 2014 8:25 am
by alialrikabi
Hello;
i have QTERM-A7 and i want to make a custom screensaver. activated if there is no one touches the screen. let say a timer of 5 min. :geek: Thank you

Re: custom Screensaver

Posted: Mon Apr 02, 2018 4:10 pm
by Chris T.
Hey alialrikabi,

The best way to do this would be to create a custom screen that you launch, after the inactivity timer reaches some number. You could create an inactivity script that opens the page after x time. Here is an inactivity script example:

namespace Neo.ApplicationFramework.Generated
{
using System.Windows.Forms;
using System;
using System.Drawing;
using Neo.ApplicationFramework.Tools;
using Neo.ApplicationFramework.Common.Graphics.Logic;
using Neo.ApplicationFramework.Controls;
using Neo.ApplicationFramework.Interfaces;


public partial class Inactivity_Script
{
private static System.Windows.Forms.Timer _timer;
private int _mouseX = -1;
private int _mouseY = -1;
private int _mouseMoved;

private void TimerTick(Object sender, EventArgs e)
{
var x = System.Windows.Forms.Control.MousePosition.X;
var y = System.Windows.Forms.Control.MousePosition.Y;

if( ( Math.Abs(_mouseX-x) > 5 ) || ( Math.Abs(_mouseY-y) > 5 ) )
{
_mouseMoved=0;
try
{
Globals.NetControl.EnableEthernet(1);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Error!! Could not Resume Communications");
}
}
else
{
_mouseMoved++;

var inactivityTimeout = Globals.Tags.System_InactivityTimeBeforeLogout.Value;

if((inactivityTimeout>0) && (_mouseMoved > inactivityTimeout))
{
try
{
Globals.NetControl.DisableEthernet(1);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Error!! Could not Halt Communications");
}
}
}
_mouseX = x;
_mouseY = y;
}

void Scriptmodule_Created(System.Object sender, System.EventArgs e)
{
// Set up timer that monitors if the mouse has moved
_timer = new System.Windows.Forms.Timer {Interval = 1000};
_timer.Tick += TimerTick;
_timer.Enabled = true;
}
}
}