我正在使用Visual Studio 2017並嘗試爲Windows Phone編程C#UWP應用程序。當我嘗試在主機和模擬器(Mobile emulator 10.0.15063.0)之間測試漫遊應用程序數據時,數據不會同步。即使等了幾個小時。模擬器看起來像我的電子郵件和跨設備的日曆同步一樣工作。當我搜索主機上的文件,這似乎是正確創建:在仿真器C中測試漫遊應用程序數據#
C:\Users\Owner\AppData\Local\Packages\23840StartPoint.StartPointRunning_x6wjmepvaasdr\RoamingState
我檢查了包清單和包名和版本匹配。我嘗試了幾種不同的選擇,但沒有任何作用。我錯過了什麼。
來自GitHub的應用程序數據示例是我用來教導自己寫/讀文件的模型。它也不適用於我的設置。
var applicationData = ApplicationData.Current;
ulong storage = applicationData.RoamingStorageQuota;
//Create file client.txt => store data => Roaming folder
ApplicationDataContainer roamingSettings = ApplicationData.Current.RoamingSettings;
StorageFolder roamingFolder1 = ApplicationData.Current.RoamingFolder;
StorageFile file1 = await roamingFolder1.CreateFileAsync(Filename1, CreationCollisionOption.ReplaceExisting);
SetUpFlag = "true";
String string6 = Views.Colors101.m_BackGroundColor + ";" + Views.Colors101.m_CalendarColor + ";" + Views.Colors101.m_HeaderColor;
String toWrite = SetUpFlag + ";" + string6;
StorageFile xfile1 = await roamingFolder1.GetFileAsync(Filename1);
await FileIO.WriteTextAsync(xfile1, toWrite);
ApplicationData.Current.SignalDataChanged();
你如何共享數據,PC和UWP之間? – ArchAngel
我正在通過漫遊文件夾共享一個小文本文件(約150字節)。我是新的和不確定如何添加代碼到我的評論。你能提出一種方法嗎?我試圖添加back-ticks,但沒有奏效。 – VaBRC
您可以編輯您的原始問題以添加相關的代碼段和其他更新。 –