Esempio n. 1
0
        private static void Run()
        {
            var seconds = 0;

            while (_active)
            {
                Thread.Sleep(1000);
                if (seconds % Settings.LogTimeIntervalInSeconds == 0)
                {
                    ActionsManager.EnqueuNewAction(IntervalTimeLogger.Run);
                }

                if (seconds % Settings.HardwareUpdateIntervalInSeconds == 0)
                {
                    ActionsManager.EnqueuNewAction(DataUpdateManager.UpdateComputer);
                }

                if (seconds % Settings.DisksUpdateIntervalInSeconds == 0)
                {
                    ActionsManager.EnqueuNewAction(DataUpdateManager.UpdateDisks);
                }

                if (seconds % Settings.UserChangesUpdaterIntervalInSeconds == 0)
                {
                    ActionsManager.EnqueuNewAction(DataUpdateManager.UpdateUsers);
                }

                if (seconds % Settings.AppKillIntervalInSeconds == 0 && !Settings.PortableMode)
                {
                    ActionsManager.EnqueuNewAction(AppsBlocker.StartAppKiller);
                }

                if (seconds % Settings.SiteBlockerUpdaterIntervalInSeconds == 0 && !Settings.PortableMode)
                {
                    ActionsManager.EnqueuNewAction(SitesBlocker.BlockSites);
                }

                if (seconds % Settings.SyncIntervalInSeconds == 0)
                {
                    ActionsManager.EnqueuNewAction(SyncManager.SyncData);
                }

                if (seconds % Settings.TimeLimitCheckIntervalInSeconds == 0)
                {
                    ActionsManager.EnqueuNewAction(TimeLimitsManager.Run);
                }


                if (!HubService.IsRunning() && seconds % Settings.HubStateCheckIntervalInSeconds == 0)
                {
                    ActionsManager.EnqueuNewAction(HubService.Start);
                }
                //LocalLogger.Log();
                seconds++;
                // TEMP
                //if (seconds % 60 == 0)
                //{

                //    LocalLogger.Log($"{nameof(HubService.IsRunning)}: {HubService.IsRunning()}");

                //}
                //ActionsManager.EnqueuNewAction(() => LocalLogger.Log( ComputerUsersHelper.CurrentlyLoggedInUser()));
                //LocalLogger.Log($"Scheduler is running. Seconds: {seconds}. {DateTime.Now-start:ss\\s\\:fff\\m\\s}");
            }
        }
Esempio n. 2
0
 public static void Run()
 {
     LocalLogger.Log("Service has been started!");
     ActionsManager.Start();
     Scheduler.Start();
 }