[Android General] Beatsleigher:
Ok, now let's get on with Restore.

Open up the file, and again, design it as you want.

If you're using the same design as me, it is advisory, that you use the same code.

Here is the code I used:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim OpenFile As New OpenFileDialog
OpenFile.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.Desktop
OpenFile.Multiselect = False
OpenFile.Filter = "AB (Android Backups)|*.ab"
OpenFile.SupportMultiDottedExtensions = False
OpenFile.Title = "Select the Android Backup (*.ab) file to restore your device from..."
Dim DialogRes As DialogResult = OpenFile.ShowDialog()
If DialogRes = Windows.Forms.DialogResult.OK Then
TextBox1.Text = OpenFile.FileName
End If
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Shell("""ADB\adb.exe"" restore " & TextBox1.Text, AppWinStyle.NormalFocus, True, 30000)
End Sub

Private Sub Restore_FormClosing(sender As Object, e As EventArgs) Handles MyBase.FormClosing
Form1.Show()
End Sub

And now we're ready to move to the third form. As usual; if you're using the same design as me, you'll want to use the same code as me.

I'd like to note: I'll explain all the code in post #3.

The third form (Install an App) will be a bit different than the others. Here, we'll give the user the opportunity to select an entire folder which contains .apk files and then with a mouse-click, the app will install the desired APK.

Note the ListBox, That is where all the APKs will be listed. (Hence the name 'ListBox'.)

I have pulled some APKs from my phone and have put them in a folder (C:\APKs). We will use this folder to list all the available APKs in the listbox.

But before we do that, here is the code for the form. Again, nothing is imported here.

Private Sub Install_FormClosing(sender As Object, e As EventArgs) Handles MyBase.FormClosing
Form1.Show()
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim FolderBrowse As New FolderBrowserDialog
FolderBrowse.Description = "Select the folder containing your APK files."
FolderBrowse.RootFolder = Environment.SpecialFolder.DesktopDirectory
FolderBrowse.ShowNewFolderButton = False
Dim DialogRes As DialogResult = FolderBrowse.ShowDialog()
If DialogRes = Windows.Forms.DialogResult.OK Then
For Each Item As String In My.Computer.FileSystem.GetFiles(FolderBrowse.SelectedPath)
ListBox1.Items.Add(Item)
Next
End If
End Sub

Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
Shell("""ADB\adb.exe"" install " & ListBox1.SelectedItem.ToString, AppWinStyle.NormalFocus, True, 30000)
End Sub

And here are some pictures of the code in action:

FolderBrowserDialog (FolderBrowse):

The list of apps (ListBox):

Ok. We're almost done with our One-Click utility!

We've only got one more form and we'll do that in a dash! Then I'll get to explaining what everything means. Though most of it is pretty much self-explanatory, I'd rather go over it.

Move on to the last form, and the same rules apply.

This form will be using the same method as the Install form - Using a ListBox to display files.

Here is the code:

Private Sub Push_FormClosing(sender As Object, e As EventArgs) Handles MyBase.FormClosing
Form1.Show()
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim FolderBrowse As New FolderBrowserDialog
FolderBrowse.Description = "Select the folder containing the file/s you want to push to the device..."
FolderBrowse.ShowNewFolderButton = False
FolderBrowse.RootFolder = Environment.SpecialFolder.DesktopDirectory
Dim DialogRes As DialogResult = FolderBrowse.ShowDialog()
If DialogRes = Windows.Forms.DialogResult.OK Then
For Each Item As String In My.Computer.FileSystem.GetFiles(FolderBrowse.SelectedPath)
ListBox1.Items.Add(Item)
Next
End If
End Sub

Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
Shell("""ADB\adb.exe"" push " & ListBox1.SelectedItem & " " & TextBox1.Text, AppWinStyle.NormalFocus, True, 30000)
End Sub

Cool! We've got our first One-Click-Utility done in Visual Basic.Net! This is pretty awesome, don't you think? I may have to re-do this thread, but for the moment it'll do, I guess.

Move down to the third post, to read all about what what piece of code does.