Ant
Ant

Reputation: 129

How handle exception while copying files from phone to pc in C#?

I'm trying to copy files from connected android device to my pc.

    public void CopyFiles(Folder srcFolder, Folder FolderImages, Folder FolderDatabase)
    {
        ImageFileCounter = 0;
        SqlLiteCounter = 0;
        foreach (FolderItem currFolderItem in srcFolder.Items())
        {
            if (currFolderItem.IsFolder) continue;

            if (currFolderItem.Type.Equals("JPG File") || currFolderItem.Type.Equals("PNG File"))
            {
                FolderImages.CopyHere(currFolderItem, 4 | 16);
                ImageFileCounter++;
            }
            else if (currFolderItem.Type.Equals("Data Base File"))
            {
                FolderDatabase.MoveHere(currFolderItem, 4 | 16);
                SqlLiteCounter++;
            }
        }
    }

And I want to handle copy error when device is disconnect while copying files. Can anybody know how I can do that?

Upvotes: 0

Views: 114

Answers (1)

Ant
Ant

Reputation: 129

I found the solution. There is no way to get information about Folder.CopyHere() or Folder.MoveHere() final result. I found the answer here https://msdn.microsoft.com/pl-pl/library/windows/desktop/bb787866(v=vs.85).aspx. Sorry for silly question.

Upvotes: 1

Related Questions