Author Topic: FileTransferClientX  (Read 802 times)

Offline subasuma

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
FileTransferClientX
« on: July 12, 2007, 02:11:53 PM »
Hi

How to receive files using FileTransferClientX ?

Regards

Suma

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2491
  • Karma: 1000
    • Wireless Communication Library
Re: FileTransferClientX
« Reply #1 on: July 12, 2007, 02:38:32 PM »
Good day!

Here is a simple code:

Get files list

Code: [Select]
    Private Sub btDir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btDir.Click
        lvFTP.Items.Clear()

        Dim Files As BluetoothFrameworkX.BFFilesX
        Files = BFFileTransferClientX.Dir()

        If TypeName(Files) <> "Nothing" Then
            Dim I As Integer

            For I = 0 To Files.Count - 1
                Dim File As BluetoothFrameworkX.BFFileX
                File = Files.File(I)

                If TypeName(File) <> "Nothing" Then
                    Dim Item As ListViewItem
                    Item = lvFTP.Items.Add(File.Name)
                    Item.SubItems.Add(File.Size.ToString())
                    If File.Folder Then
                        Item.SubItems.Add("Folder")
                    Else
                        Item.SubItems.Add("File")
                    End If
                    Item.SubItems.Add(File.Modified.ToString())
                    Dim Acc As String
                    Acc = ""

                    If File.Access.faDelete <> 0 Then
                        Acc = Acc + "D"
                    End If
                    If File.Access.faRead <> 0 Then
                        Acc = Acc + "R"
                    End If
                    If File.Access.faWrite <> 0 Then
                        Acc = Acc + "W"
                    End If

                    File = Nothing
                End If
            Next I
        End If
    End Sub

To chage path

Code: [Select]
    Private Sub btSetPath_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btSetPath.Click
        If lvFTP.SelectedItems.Count > 0 Then
            BFFileTransferClientX.SetPath(lvFTP.SelectedItems(0).Text, False)
        End If
    End Sub

To uploadfile on device

Code: [Select]
    Private Sub btFTPUpload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btFTPUpload.Click
        If OpenFileDialog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
            BFFileTransferClientX.Put(OpenFileDialog.FileName)
        End If
    End Sub

To load file from device to PC

Code: [Select]
    Private Sub btFTPDownload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btFTPDownload.Click
        If lvFTP.SelectedItems.Count > 0 Then
            BFFileTransferClientX.LoadTo(lvFTP.SelectedItems(0).Text, ".\" + lvFTP.SelectedItems(0).Text)
        End If
    End Sub

WCL - Wireless Communication Library
TextBlue - Bluetooth Proximity Marketing Software
WCL Phone Explorer - Free Phone Content Manager