Example #1
0
        // Specify what you want to happen when the Elapsed event is raised.
        private static void OnTimedEvent(object source, ElapsedEventArgs e)
        {
            DateTime curTime             = DateTime.Now;
            double   totalSecondsBetween = ((curTime - startEngagement).TotalSeconds);

            if (totalSecondsBetween < allowableDownTime)
            {
                Console.WriteLine("Is Engaged " + totalSecondsBetween);
                if (myDevice.GetControlValueByID(0) == 0)
                {
                    myDevice.SetControlByID(0, 1);
                }
            }
            else
            {
                Console.WriteLine("Not Engaged " + totalSecondsBetween);
                if (myDevice.GetControlValueByID(0) == 1)
                {
                    myDevice.SetControlByID(0, 0);
                }
            }
        }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey("escape"))
        {
            Application.Quit();
        }

        if (myDevice.GetControlValueByID(0) == 0)
        {
            theImage.GetComponent <Image> ().color = Color.red;
        }
        else
        {
            theImage.GetComponent <Image> ().color = Color.blue;
        }
    }