Exemple #1
0
        public void runSleepLogic()
        {
            //Handle sleeping
            if (sleeping)
            {
                if (sleepStopwatch.DurationInHours() >= sleepAwakeTime)
                {  //Sleep for 30 minutes then play
                    //sleeping = false;
                    nextSleepTime();
                    sleepStopwatch.Reset();
                }
            }
            else
            {
                if (sleepStopwatch.DurationInHours() >= sleepAwakeTime)
                {  //Play for 2 hours then sleep
                    //sleeping = true;
                    nextSleepTime();
                    sleepStopwatch.Reset();
                }
            }


            if (printStatus.DurationInMinutes() >= 1.0)
            {
                printStatus.Reset();
                String output = string.Format("{0:HH:mm:ss tt}", DateTime.Now) + "Auto Queue Status: " + (sleeping ? "Sleeping" : "Awake");
                if (sleeping)
                {
                    output += " with " + (sleepAwakeTime - sleepStopwatch.DurationInHours()) * 60.0 + " minutes left";
                }
                if (!sleeping)
                {
                    output += " with " + (sleepAwakeTime - sleepStopwatch.DurationInHours()) * 60.0 + " minutes left";
                }
                Console.WriteLine(output);
            }
        }