使用UWP应用程序将文件复制到连接的Windows Phone中

使用UWP应用程序将文件复制到连接的Windows Phone中

问题描述:

 我正在开发在PC上运行的Windows UWP应用程序。我要求从PC上将文件复制到USB连接的windows10手机中。

 I am developing windows UWP app which runs on PC. I have a requirement to copy files into USB connected windows10 phone from PC.

请建议我识别连接设备的解决方案是Windows Phone,然后将文件复制到该手机。

Please suggest me solution for identifying connected device is Windows Phone and then Copying files to that phone.

先谢谢。

嗯,有不同的方法可以做到这一点。 

Well, there are different ways to do that. 

首先你可以尝试使用
FolderPicker类
 选择手机的文件夹。然后将文件复制到其中。这是最简单的方法。

First you could try to use FolderPicker Class to select the phone's folder. Then copy the files into it. This is the simplest way.

您也可以尝试使用  KnownFolders Class  获取所有可移动设备。然后找出手机的文件夹。像这样:

You could also try to use KnownFolders Class to get all the RemovableDevices. And then find out the phone's folder. Like this:

 private async void Button_Click(object sender, RoutedEventArgs e)
        {
            StorageFolder folders = KnownFolders.RemovableDevices;

            var folderList = await folders.GetFoldersAsync();

            foreach (StorageFolder folder in folderList)
            {
                Debug.WriteLine(folder.Name);
            }
        }

祝你好运,

Roy