public void Load(string path) { if (!File.Exists(path)) { if (path == null) { path = "Config/UserConfig.xml"; } path = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, path); if (!File.Exists(path)) { return; } } DataFilePath = path; try { using (var fs = new FileStream(path, FileMode.Open)) { var xmldes = new XmlSerializer(typeof(UserConfig)); var config = (UserConfig)xmldes.Deserialize(fs); WindowState = config.WindowState; QuerySetting = config.QuerySetting; } } catch (Exception ex) { App.Log.Error(ex.ToString()); } }
public UserConfig() { WindowState = new WindowState(); QuerySetting = new QuerySetting(); }