WPF uses the ARCGIS App file to configure the Cs background file, wpfarcgis
Using System; using System. collections. generic; using System. configuration; using System. data; using System. linq; using System. windows; using ESRI. arcGIS. esriSystem; using System. xml. serialization; using System. IO; using SWGW. properties; using System. diagnostics; namespace SWGW {// <summary> // App. interaction logic of xaml // </summary> public partial class App: Application {# region License protected override void OnS Tartup (StartupEventArgs e) {SettingsManager. OnStartup (); base. OnStartup (e); if (! LicenseManager. InitializeLicense. InitializeEngineLicense () {MessageBox. Show ("unable to initialize ArcGIS Engine authorization or earth extension. As... ") ;}# endregion # region private class static Class SettingsManager {# region class Members static Settings settings = new Settings (); const string applicationDirectory =" SWGW "; // configuration file name const string settingsFileName = "XXXX. xml "; # endregion Class Members # region Constructor static SettingsManager () {EnsureDirectoryExists () ;}# endregion Constructor # region Properties public static Settings Applicat IonSettings {get {return settings ;}# endregion Properties # region Startup, Exit public static void OnStartup () {LoadSettings ();} public static void OnExit () {SaveSettings () ;}# endregion Overrides # region Other Functions static string SettingsFileName {get {return Path. combine (Path. combine (Environment. getFolderPath (Environment. specialFolder. localApplicationData), applicationDirectory ), SettingsFileName) ;}} static void LoadSettings () {Settings tmp; try {XmlSerializer xml = new XmlSerializer (typeof (Settings); using (Stream stream = new System. IO. fileStream (SettingsFileName, FileMode. open, FileAccess. read, FileShare. read) {tmp = (Settings) xml. deserialize (stream) ;}} catch (Exception e) {Trace. writeLine (e. message); return;} settings = tmp;} static void SaveSettings () {t Ry {XmlSerializer xml = new XmlSerializer (typeof (Settings); using (Stream stream = new System. IO. fileStream (SettingsFileName, FileMode. create, FileAccess. write, FileShare. none) {xml. serialize (stream, settings) ;}} catch (Exception e) {Trace. writeLine (e. message) ;}} [System. diagnostics. codeAnalysis. suppressMessage ("Microsoft. design "," CA1031: DoNotCatchGeneralExceptionTypes ")] static void Ens UreDirectoryExists () {try {DirectoryInfo info = new DirectoryInfo (Path. Combine (Environment. GetFolderPath (Environment. SpecialFolder. LocalApplicationData), applicationDirectory); if (! Info. Exists) {info. Create () ;}} catch (Exception ex) {Trace. WriteLine (ex. Message) ;}# endregion Other Functions }# endregion }}