Schreiben und Lesen von Windows App Settings
https://youtu.be/ac3IDaQVVIc
WinApp Windows App
using Microsoft.UI.Xaml;
using System;
namespace winapp_settings_file
{
public sealed partial class MainWindow : Window
{
private
Windows.Storage.ApplicationDataContainer localSettings =
Windows.Storage.ApplicationData.Current.LocalSettings;
private
Windows.Storage.StorageFolder localFolder =
Windows.Storage.ApplicationData.Current.LocalFolder;
public MainWindow()
{
this.InitializeComponent();
//save setting
localSettings.Values["appSetting_1"] = "localSettings.Values[\"appSetting_1\"]=" +
DateTime.Now.ToString();
//read setting
var sSetting = localSettings.Values["appSetting_1"];
myButton.Content = sSetting;
}
private void myButton_Click(object sender, RoutedEventArgs
e)
{
}
}
}
|