2017-08-14 6 views
-1

設定ファイルを読み込んでxmlに基づいて辞書を読み込むアプリケーションをビルドしました。 私が望むのは、そのファイルをプログラムに追加する必要がないということです。代わりに、私はpi3にアップロードして、私がアップロードしたファイルをリフレッシュして読み上げるように指示したいと思っています。それは、コードに含まれるファイルを不明瞭なフォルダに読み込みます。
入手しやすいフォルダにコード内のパスをアップロードして指定する方法を教えてください。事前にWindows 10 IoTを実行しているラズベリーパイのファイルをアップロードして読み込む方法

おかげ

+0

我々はラズベリーパイのための専用のスタック交換を持っている - –

+0

ありがとうhttps://raspberrypi.stackexchange.com/があなたの質問を投稿してみてください。私はそれを行うでしょう –

+0

[ファイルアクセス許可](https://docs.microsoft.com/en-us/windows/uwp/files/file-access-permissions)と[ファイルを読む](https:///docs.microsoft.com/en-us/windows/uwp/files/quickstart-reading-and-writing-files#reading-from-a-file)を参照してください。 –

答えて

1

使用、作成アクセスしUWP上のフォルダとファイルでこれらのような他の操作については、以下のコードは、次のWindows.Storage名前空間と。

  //Get Installation Folder for current application 
      StorageFolder rootFolder = ApplicationData.Current.LocalFolder; 

      //Create a folder in the root folder of app if not exist and open if exist. 
      StorageFolder Folder = await rootFolder.CreateFolderAsync(yourFolderName, CreationCollisionOption.OpenIfExists); 

      //Craete a file in your folder if not exist and replace it with new file if exist 
      StorageFile sampleFile = await Folder.CreateFileAsync("samplefile.xml", CreationCollisionOption.ReplaceExisting); 

      //Create your text and write it on your configuaration file 
      string yourText = "Your Sample Text or Configuration"; 
      await Windows.Storage.FileIO.WriteTextAsync(sampleFile, yourText); 

その後、ファイルに再度アクセスできるようになり、そのフォームのReadTextAsyncメソッドから設定値を読み取ることができます。

  //Read data from file 
      await Windows.Storage.FileIO.ReadTextAsync(sampleFile); 
関連する問題