private void uninstallEvent(CustomSetting setting) { if (setting != null) { setting.DataChanged -= Setting_DataChanged; } }
private void loadData() { uninstallEvent(_setting); _setting = new CustomSetting(); try { FileInfo fi = new FileInfo(ConfigFile); if (fi.Exists) { using (StreamReader sr = fi.OpenText()) { string jStr = sr.ReadToEnd(); _setting = JsonConvert.DeserializeObject <CustomSetting>(jStr); } } } catch { } installEvent(_setting); }