private async void BtnStopService_Clicked(object sender, EventArgs e)
 {
     await FilterUtils.TimeLock.onlyUnlocked(() =>
     {
         AndroidBridge.StopForgroundService();
     });
 }
Exemple #2
0
        private void BtnPeriodic_Clicked(object sender, EventArgs e)
        {
            int id = scheduleRepeated();

            if (id > -1)
            {
                AndroidBridge.ToastIt("Task started");
            }
            else
            {
                AndroidBridge.ToastIt("Task failed");
            }
        }
 private async void BtnSetMasterPass_Clicked(object sender, EventArgs e)
 {
     await FilterUtils.TimeLock.onlyUnlockedAsync(async() =>
     {
         var dialogPass = new InputPages.inputPasswordDialog((pass) =>
         {
             var result = FilterUtils.MasterPassword.SetPassword(pass);
             AndroidBridge.ToastIt(result.eventReason);
         }
                                                             , "Set Password!"
                                                             );
         await Application.Current.MainPage.Navigation.PushAsync(dialogPass);
     });
 }
 private void BtnExportFiles_Clicked(object sender, EventArgs e)
 {
     try
     {
         foreach (var policyPath in Filenames.EXPOSED_POLICIES)
         {
             File.WriteAllText(policyPath.getAppPublic(), File.ReadAllText(policyPath.getAppPrivate()));
         }
     }
     catch (Exception ex)
     {
         AndroidBridge.e(TAG, ex);
         AndroidBridge.ToastIt("Export failed: " + ex.Message);
     }
 }
 private async void BtnUnlockWithPass_Clicked(object sender, EventArgs e)
 {
     var dialogPass = new InputPages.inputPasswordDialog((pass) =>
     {
         var result = FilterUtils.MasterPassword.ComparePass(pass);
         if (result)
         {
             FilterUtils.TimeLock.ForceUnlockNow();
         }
         AndroidBridge.ToastIt(result.eventReason);
     }
                                                         , "Unlock with pass!"
                                                         );
     await Application.Current.MainPage.Navigation.PushAsync(dialogPass);
 }
Exemple #6
0
 public int scheduleRepeated()
 {
     return(AndroidBridge.scheduleJob(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10), null,
                                      (finishFunc) => {
         if (periodic_task_counter < 6)
         {
             periodic_task_counter++;
             AndroidBridge.ToastItFromBack("Counter: " + periodic_task_counter);
             AndroidBridge.d(TAG, "Task counter: " + periodic_task_counter);
             scheduleRepeated();
         }
         finishFunc(true);
     },
                                      () => periodic_task_counter < 6,
                                      null,
                                      () => false
                                      ));
 }
        private void BtnImportPolicies_Clicked(object sender, EventArgs e)
        {
            try
            {
                foreach (var policyPath in Filenames.EXPOSED_POLICIES)
                {
                    File.WriteAllText(policyPath.getAppPrivate(), File.ReadAllText(policyPath.getAppPublic()));
                }

                // Reload policies:
                FilteringObjects.httpPolicy.reloadPolicy(File.ReadAllText(Filenames.HTTP_POLICY.getAppPrivate()));
                FilteringObjects.timePolicy.reloadPolicy(File.ReadAllText(Filenames.TIME_POLICY.getAppPrivate()));
            }
            catch (Exception ex)
            {
                AndroidBridge.e(TAG, ex);
                AndroidBridge.ToastIt("Import failed: " + ex.Message);
            }
        }
Exemple #8
0
        private void BtnInfoPage_Clicked(object sender, EventArgs e)
        {
            try
            {
                this.lblGitStatus.Text = GitInfo.GetInfo();

                lblInfo.Text = string.Format("[{0}] BlockZone? {1}, Filtering? {2}, Service up? {3}, Blocked now? {4}, Locked? {5} ",
                                             DateTime.Now,
                                             FilterUtils.FilteringObjects.isInWifiBlockZone,
                                             FilterUtils.FilteringObjects.isFiltering,
                                             AndroidBridge.isForegroundServiceUp(),
                                             FilterUtils.FilteringObjects.timePolicy.isBlockedNow(),
                                             FilterUtils.TimeLock.isLocked()
                                             );
            }
            catch (Exception ex)
            {
                AndroidBridge.e(TAG, ex);
            }
        }
 private void BtnScanWifi_Clicked(object sender, EventArgs e)
 {
     WifiPeriodicChecker.showReason = true;
     AndroidBridge.StartWifiScanning();
 }
        private void BtnCheckLocked_Clicked(object sender, EventArgs e)
        {
            TaskResult unlockedStatus = TimeLock.isLocked();

            AndroidBridge.ToastIt(string.Format("Locked? {0}, Reason: '{1}'", unlockedStatus.success, unlockedStatus.eventReason));
        }
Exemple #11
0
 private void BtnScanWifiNow_Clicked(object sender, EventArgs e)
 {
     AndroidBridge.GetLatestWifiResults();
 }
Exemple #12
0
 private void BtnScanWifi_Clicked(object sender, EventArgs e)
 {
     AndroidBridge.StartWifiScanning();
 }