Ejemplo n.º 1
0
        private bool handleDay(float totalTimeForDay, float maxTimeForSession, float minTimeBetweenSessions, DateTime startOfTheDay, DateTime endOfTheDay)
        {
            if (!beforeEndAfterStart(startOfTheDay, endOfTheDay))
            {
                NotificationHandler.NotifyWindows("You should be sleeping.");
                return(false);
            }
            if (getDayTotal() >= totalTimeForDay)
            {
                return(false);
            }

            bool liveSession = exeHandler.ExesRunning().Length > 0;

            if (liveSession)
            {
                float totalOfCurrentSession = getCurrentTotal();
                float timeLeft = maxTimeForSession - totalOfCurrentSession;
                if (totalOfCurrentSession >= maxTimeForSession)
                {
                    return(false);
                }
                else if (!warningHour && Math.Abs(timeLeft - 60.0) <= 1.5)
                {
                    NotificationHandler.NotifyWindows("Hour warning.");
                    warningHour = true;
                }
                else if (!warning30 && Math.Abs(timeLeft - 30.0) <= 1.5)
                {
                    NotificationHandler.NotifyWindows("Half-hour warning.");
                    warning30 = true;
                }
                else if (!warning10 && Math.Abs(timeLeft - 10.0) <= 1.5)
                {
                    NotificationHandler.NotifyWindows("Ten-minute warning.\nFind a save point.");
                    warning10 = true;
                }
                else if (!warning5 && Math.Abs(timeLeft - 5.0) <= 1.5)
                {
                    NotificationHandler.NotifyWindows("Five-minute warning.\nFind a save point.");
                    warning5 = true;
                }
                else if (!warning1 && Math.Abs(timeLeft - 1.0) <= 1.5)
                {
                    NotificationHandler.NotifyWindows("One-minute warning.");
                    warning1 = true;
                }
            }
            else
            {
                float breakTime = timeSinceLastSession();
                float timeLeft  = minTimeBetweenSessions - breakTime;
                if (breakTime < minTimeBetweenSessions)
                {
                    NotificationHandler.NotifyWindows("Not yet. Try again in " + (int)(timeLeft) + " minutes.");
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 2
0
        private static void handleCheck()
        {
            ExeHandler exeHandler = new ExeHandler();

            if (exeHandler.IsThisAppRunning())
            {
                return;
            }

            exeHandler.AddExecutables();
            exeHandler.DisableAll();
            if (exeHandler.ExesRunning().Length > 0)
            {
                handleRunning(exeHandler: exeHandler);
            }
        }
Ejemplo n.º 3
0
        private static void handleCheck()
        {
            ExeHandler exeHandler = new ExeHandler();

            if(exeHandler.IsThisAppRunning())
                return;

            exeHandler.AddExecutables();
            exeHandler.DisableAll();
            if(exeHandler.ExesRunning().Length > 0) {
                handleRunning(exeHandler:exeHandler);
            }
        }