Ejemplo n.º 1
0
        /// <summary>
        /// Checks if the user is idle based on the provided idleTimeout param.
        /// </summary>
        /// <param name="idleTimeout">The timeout, in seconds, to determine if the user should be defined as idle.</param>
        /// <returns>True if the user has been idle for longer than the defined idleTimeout and false if the user is not idle.</returns>
        protected bool IsUserIdle(int idleTimeout)
        {
            double userIdleTime = WindowsLibrary.UserIdleTime().TotalSeconds;

            if (userIdleTime > idleTimeout)
            {
                Console.WriteLine("User has been idle for {0} minutes.", userIdleTime / 60);
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns the active process - only supports Windows at the moment.
        /// </summary>
        /// <returns>A <see cref="Process"/> identifying the active process by the user.</returns>
        protected Process GetActiveProcess()
        {
            if (this.UserEnvironment.Equals(AppEnvironment.Windows))
            {
                return(WindowsLibrary.GetActiveProcess());
            }
            else if (this.UserEnvironment.Equals(AppEnvironment.Mac))
            {
                // TODO: Add Mac environment here.
            }
            else if (this.UserEnvironment.Equals(AppEnvironment.Linux))
            {
                // TODO: Add Linux environment here.
            }

            return(null);
        }