Archived
1
0

Crashing when there is no notifications.json file fixed

This commit is contained in:
Michael Gordeev
2018-12-12 21:49:54 +03:00
parent 0e6f847e02
commit b415dbd00a
+4 -7
View File
@@ -122,13 +122,10 @@ namespace FoxTube
public async void Initialize() public async void Initialize()
{ {
if (await ApplicationData.Current.RoamingFolder.GetFileAsync("notifications.json") != null) bool[] notificationsSettings = new bool[] { (bool)settings.Values["newVideoNotification"], (bool)settings.Values["devNews"] };
{ await FileIO.WriteTextAsync(
bool[] notificationsSettings = new bool[] { (bool)settings.Values["newVideoNotification"], (bool)settings.Values["devNews"] }; await ApplicationData.Current.RoamingFolder.CreateFileAsync("notifications.json", CreationCollisionOption.ReplaceExisting),
await FileIO.WriteTextAsync( JsonConvert.SerializeObject(notificationsSettings));
await ApplicationData.Current.RoamingFolder.CreateFileAsync("notifications.json", CreationCollisionOption.ReplaceExisting),
JsonConvert.SerializeObject(notificationsSettings));
}
} }
protected override void OnNavigatedTo(NavigationEventArgs e) protected override void OnNavigatedTo(NavigationEventArgs e)