/// <summary> /// can throw exception in case of error /// </summary> private void PerformSave(string fileName) { using (var file = File.Create(fileName)) { Config.SaveXml(file); } // succeeded FilePathName.SetValue(fileName); FilePathValid.SetValue(true); HasChanges.SetValue(false); }
private void DoNew() { if (!CanDiscardOldData("Create New Configuration")) { return; } Config.Reset(); FilePathName.SetValue(FileNameNew); FilePathValid.SetValue(false); HasChanges.SetValue(false); }
/// <summary> /// can throw exception in case of error /// </summary> private void PerformOpen(string fileName) { try { using (var file = File.OpenRead(fileName)) { Config.ReadXml(file); } } catch (Exception) { Config.Reset(); throw; } // succeeded FilePathName.SetValue(fileName); FilePathValid.SetValue(true); HasChanges.SetValue(false); }