Example #1
0
 private void OnElapsedTime(object sender, ElapsedEventArgs e)
 {
     if (serviceStatus == "Running")
     {
         PreventClosing();
         SafeModeBlock();
         IncognitoBlock(incognitoBlock);
         if (InternetBlocker.GetBlockStatus() == true)
         {
             if (InternetBlocker.IsInternetReachable())
             {
                 InternetBlocker.Block(true);
             }
         }
         else
         {
             if (!InternetBlocker.IsInternetReachable())
             {
                 InternetBlocker.Block(false);
             }
         }
     }
     if (serviceStatus == "Pausing")
     {
         InternetBlocker.Block(false);
         IncognitoBlock(false);
         ShowMessage("F4E - Service", "היציאה הושלמה בהצלחה.");
         serviceStatus = "Paused";
     }
 }
Example #2
0
        protected override void OnCustomCommand(int commend)
        {
            CustomCommends customCommend = (CustomCommends)commend;

            switch (customCommend)
            {
            case CustomCommends.startScheduelBlocking:     //Interet Block Start
                InternetBlocker.Block(true);
                break;

            case CustomCommends.releaseScheduelBlocking:     //Interet Block Stop
                InternetBlocker.Block(false);
                break;

            case CustomCommends.kill:     //Kill Service
                incognitoBlock = false;
                shutdownOnStop = false;
                Stop();
                Application.Exit();
                break;

            case CustomCommends.setSafeDns:
                DnsController.SetMode(true);
                break;

            case CustomCommends.setDHCPDns:
                DnsController.SetMode(false);
                break;

            case CustomCommends.startCatchFiles:
                FilesCatcher.CatchSystemFiles();
                break;

            case CustomCommends.stopCatchFiles:
                FilesCatcher.StopCatchingSystemFiles();
                break;

            case CustomCommends.updateHostsFile:
                HostsFileAdapter.WriteCustomBlackListToHostFile();
                break;

            case CustomCommends.addToSafeMode:
                SafemodeAdapter.AddToSafeMode();
                break;

            case CustomCommends.removeFromSafeMode:
                SafemodeAdapter.RemoveFromSafeMode();
                break;

            case CustomCommends.addToStartUp:
                StartupAdapter.AddApplicationToAllUserStartup();
                break;

            case CustomCommends._pause:
                serviceStatus = "Pausing";
                break;

            case CustomCommends._continue:
                serviceStatus          = "Running";
                shutdownOnStop         = true;
                processAlreadyDetected = false;
                break;
            }
        }
Example #3
0
 protected override void OnAfterUninstall(IDictionary savedState)
 {
     base.OnAfterUninstall(savedState);
     InternetBlocker.Block(false);
 }