|
WPF lees/schrijf configuratie bestandsblad. 1. Voeg in je project het app.config-bestand toe. De inhoud van het standaard bestand is:
2. Als je enkele parameters voor het programma wilt configureren, <configuration>voeg ze dan toe aan de tag<appSettings>. Bijvoorbeeld, het volgende: 3. Dan kun je het lezen en schrijven waar je het nodig hebt in het achtergrondprogramma. Vergeet niet om bronvermeldingen toe te voegen
gebruikmakend van System.Configuration; 4. Lees de operatie:
string strPath = ConfigurationManager.AppSettings["Path"]; 5. Schrijf operaties:
Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); CFA. AppSettings.Settings["NAME"]. Waarde = "WANGLICHAO"; CFA. Save();
|