iX Talk
http://beijerinc.com/support/ix/forum/

Screen Saver
http://beijerinc.com/support/ix/forum/viewtopic.php?f=4&t=1439
Page 1 of 1

Author:  BKirch [ Mon Aug 05, 2013 8:48 am ]
Post subject:  Screen Saver

Hi,

I was wondering if it's possible to have a screen saver on a iX T10A screen. I know there's a setting that turns the backlight off after a certain number of seconds, but I was hoping there's a way to get a specific screen to show after the certain number of seconds. Thanks for the help.

Author:  mark.monroe [ Mon Aug 05, 2013 9:48 am ]
Post subject:  Re: Screen Saver

You could use C# code in a timer and have the HMI change screens. However, I do not know of a way to track how long it was since a operator used the screen. You would have to do some research and see if there is some C# function you could call that would give you the last time the touchscreen was pressed. Touchscreen input is treated the same way as mouse input is.

Author:  entronic [ Thu Jul 06, 2017 9:09 am ]
Post subject:  Re: Screen Saver

Hi,
Can you find a solution this problem?
thanks for the help.

Author:  AMitchneck [ Thu Jul 06, 2017 4:15 pm ]
Post subject:  Re: Screen Saver

Hi,

I've never tried this, but take a look at: https://stackoverflow.com/questions/1037595/c-sharp-detect-time-of-last-user-interaction-with-the-os
Note on windows CE user32.dll and kernel32.dll are replaced with coredll.dll.

So time since last user interaction would be:
Code:
using System;
using System.Runtime.InteropServices;

public class SystemIdleTime
{
    [DllImport("coredll.dll")]
    private static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);       

    [DllImport("coredll.dll")]
    private static extern uint GetLastError();

    internal struct LASTINPUTINFO
    {
        public uint cbSize;
        public uint dwTime;
    }

    // Time (as Timespan) since the last user input
    public static TimeSpan GetIdleTimespan()
    {
        return TimeSpan.FromMilliseconds(GetIdleTime());
    }

    // Time (in milliseconds) since the last user input
    public static uint GetIdleTime()
    {
        return ((uint)Environment.TickCount - GetLastInputTime());
    }

    // Get the Last input time in milliseconds
    public static uint GetLastInputTime()
    {
        LASTINPUTINFO lastInPut = new LASTINPUTINFO();
        lastInPut.cbSize = (uint)System.Runtime.InteropServices.Marshal.SizeOf(lastInPut);
        if (!GetLastInputInfo(ref lastInPut))
        {
            throw new Exception(GetLastError().ToString());
        }       
        return lastInPut.dwTime;
    }
}


To use this you could setup a threading timer to run in the background.
Code:
public class IdleTimer
{
    private static System.Threading.Timer checkIdle = null;
    private static bool timerActive = false;

    public static void Start()
    {
        if (checkIdle == null)
        {
            checkIdle = new System.Threading.Timer(checkIdle_Tick, null, 1000, 1000); // call timer function every 1000 milliseconds
            timerActive = true;
        }
        else if (!timerActive)
        {
            checkIdle.Change(1000, 1000); // call timer function every 1000 milliseconds
            timerActive = true;
        }
    }
    public static void Stop()
    {
        if ((checkIdle != null) && timerActive)
        {
            checkIdle.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite); // disable timer
            timerActive = false;
        }
    }

    private static void checkIdle_Tick(Object state)
    {
        // change screen if idle for 30 minutes
        if (SystemIdleTime.GetIdleTime() >= 1800000)
        {
            Stop();
            Globals.Screen1.Show();
        }
    }
}

In the Screen1 closing event you would add a call to IdleTimer.Start();
In the Screen1 open event you would add a call to IdleTimer.Stop();
If Screen1 is not your startup screen, then in your startup screen's open event you would also add IdleTimer.Start();

Page 1 of 1 All times are UTC - 7 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/