How to get StorageFile file contain data ? if not then
AreaTextBlock.Text = "1.8;"
my current code is:
private async void Button_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
StorageFile file = await ApplicationData.Current.LocalFolder.CreateFileAsync("text.txt", CreationCollisionOption.OpenIfExists);
await FileIO.WriteTextAsync(file, "1.9");
}
private async void SettingsPage_Loaded(object sender, RoutedEventArgs e)
{
StorageFile file = await ApplicationData.Current.LocalFolder.CreateFileAsync("text.txt", CreationCollisionOption.OpenIfExists);
AreaTextBlock.Text = await FileIO.ReadTextAsync(file);
}
on button tap AreaTextBlock.Text is 1.9 but i need when button is never tapped then AreaTextBlock.Text should be 1.8
i didn't want to write AreaTextBlock.Text = "1.8" in xaml or in c# initialize because when exit and relaunch AreaTextBlock.Text is 1.8 even if its text is 1.9. so how to do that
Basically all you need is to check at the end of the
Loadedmethod if theAreaTextBox.Textis empty and if yes, set the default value.