示例#1
0
        private async void ChangeAdbPath(object obj)
        {
            string inputAdbPath = await(View as MetroWindow).ShowInputAsync("Please locate ADB", "Please enter the full path to or containing folder of the ADB executable. Alternatively, enter the path to the Android SDK. DroidManager uses ADB to communicate with your device.");
            //Verify ADB executable
            Tuple <bool, string> findResult;

            if (!String.IsNullOrWhiteSpace(inputAdbPath) && (findResult = await Task.Run(() => IntroWindowVM.SmartFindAdb(inputAdbPath))).Item1 && await Task.Run(() => AdbChecker.VerifyAdbExecutable(findResult.Item2)))
            {
                //Adb has been verified, save new settings
                Properties.Settings.Default.adbExecutablePath = inputAdbPath;
                Properties.Settings.Default.Save();
                await(View as MetroWindow).ShowMessageAsync("Success", "We're all set! We found a working ADB executable!");
            }
            else
            {
                await(View as MetroWindow).ShowMessageAsync("Error", "Sorry, we couldn't find a valid ADB executable in that path. The ADB path setting remains unchanged.");
                //Validation failure
            }
        }
示例#2
0
 private async Task <bool> VerifyAdbPath()
 {
     if (!CheckAdbAvailability(null))
     {
         //Adb was not available. Ask now.
         string inputAdbPath = await(View as MetroWindow).ShowInputAsync("Please locate ADB", "Please enter the full path to or containing folder of the ADB executable. Alternatively, enter the path to the Android SDK. DroidManager uses ADB to communicate with your device.");
         //Verify ADB executable
         Tuple <bool, string> findResult;
         if (!String.IsNullOrWhiteSpace(inputAdbPath) && (findResult = await Task.Run(() => SmartFindAdb(inputAdbPath))).Item1 && await Task.Run(() => AdbChecker.VerifyAdbExecutable(findResult.Item2)))
         {
             //Adb has been verified, save new settings
             Properties.Settings.Default.adbExecutablePath = findResult.Item2;
             Properties.Settings.Default.Save();
             await(View as MetroWindow).ShowMessageAsync("Success", "We're all set! We found a working ADB executable!");
             return(true); //Success
         }
         else
         {
             //await (View as MetroWindow).ShowMessageAsync("Error", "Sorry, we couldn't find a valid ADB executable in that path.");
             return(false); //Validation failure
         }
     }
     return(true); //Adb is already available
 }