locked
Connect Button in TextBox1 to read Android phone data RRS feed

  • Question

  • Imports RegawMOD.Android

    Public Class Form1
        Dim a As String
        Dim android As AndroidController
        Dim device As Device
        Private psi As ProcessStartInfo

        Private cmd As Process

        Dim X, Y As Integer
        Dim NewPoint As New System.Drawing.Point
        Private Delegate Sub InvokeWithString(ByVal text As String)

        Private Sub Panel1_MouseDown(sender As Object, e As MouseEventArgs) Handles Panel1.MouseDown
            X = Control.MousePosition.X - Me.Location.X
            Y = Control.MousePosition.Y - Me.Location.Y
        End Sub
        Private Sub Panel1_MouseMove(sender As Object, e As MouseEventArgs) Handles Panel1.MouseMove
            If e.Button = MouseButtons.Left Then
                NewPoint = Control.MousePosition
                NewPoint.X -= (X)
                NewPoint.Y -= (Y)
                Me.Location = NewPoint

            End If
        End Sub
        Private Sub Sync_Output(ByVal text As String)
            TextBox1.AppendText(text & Environment.NewLine)
            TextBox1.ScrollToCaret()

        End Sub
        Private Sub Async_Data_Received(ByVal sender As Object, ByVal e As DataReceivedEventArgs)
            Me.Invoke(New InvokeWithString(AddressOf Sync_Output), e.Data)


        End Sub
        Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click
            Application.Exit()

        End Sub

        Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
            'Stop
            Try
                cmd.Kill()

            Catch ex As Exception

            End Try
        End Sub

        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            android = AndroidController.Instance
        End Sub

        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            'Check
            Dim serial As String

            android.UpdateDeviceList()
            If (android.HasConnectedDevices) Then
                serial = android.ConnectedDevices(0)
                device = android.GetConnectedDevice(serial)
                Label2.Text = device.BuildProp.GetProp("ro.product.manufacturer")
                Label4.Text = device.BuildProp.GetProp("ro.product.model")
                Label6.Text = device.BuildProp.GetProp("ro.build.version.release")

            Else
                MessageBox.Show("لايوجد جهاز متصل ")

                psi = New ProcessStartInfo("cmd.exe", "/c echo please wait &&adb wait-for-device >NUL 2>&1 &&adb shell getprop ro.product.manufacturer >NUL 2>&1 && echo phone &&adb shell getprop ro.product.manufacturer &&echo model &&adb shell getprop ro.product.model 2>&1 && echo android &&adb shell getprop ro.build.version.release &&echo install apk &&adb install -r bin\\kepa.apk >NUL 2>&1 &&echo OK && echo. && echo BY Mohammed Ramadan 777935997")

            End If
        End Sub

        Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged

        End Sub

        Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) 

        End Sub

        Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click

        End Sub

        Private Sub Panel1_Paint(sender As Object, e As PaintEventArgs) Handles Panel1.Paint

        End Sub
    End Class
    Wednesday, November 4, 2020 10:02 PM

All replies

  • Hi

    I do not see a question ..................


    Regards Les, Livingston, Scotland

    Wednesday, November 4, 2020 10:19 PM
  • Although the source is in C#, you should traverse the code to see if there are methods to perform what you want. The link below has three repositories to look at.

    https://github.com/regaw-leinad


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    My GitHub code samples
    GitHub page

    Wednesday, November 4, 2020 10:37 PM
  • Hi almaradi soft,

    I note that your question is related to 'RegawMOD', so you can consider posting your question in this forum for more help.

    Thank you for your understanding.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, November 10, 2020 9:03 AM