Ejemplo n.º 1
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            IStorageFile file = await ApplicationData.Current.LocalFolder.GetFileAsync(CredentialsFileName, true);

            string credentialsJson = await file.ReadTextAsync();

            App.API.Credentials = credentialsJson.IsNullOrWhiteSpace()
                ? null
                : JsonConvert.DeserializeObject <MSACredentials>(credentialsJson);

            this.UpdateButtonStates();
        }
Ejemplo n.º 2
0
        public static async Task <T> GetDataAsync <T>(this IStorageFile storageFile)
        {
            var dataString = await storageFile.ReadTextAsync();

            return(SerializationService.Json.Deserialize <T>(dataString));
        }