private void LoadAlignmentPoints() { var dir = Path.GetDirectoryName(_configFile); if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir)) { Directory.CreateDirectory(dir); } if (File.Exists(_configFile)) { AlignmentPoints.Clear(); using (var file = File.OpenText(_configFile)) { var serializer = new JsonSerializer(); var loaded = (AlignmentPointCollection)serializer.Deserialize(file, typeof(AlignmentPointCollection)); if (loaded != null) { foreach (var alignmentPoint in loaded) { AlignmentPoints.Add(alignmentPoint); } } } } ReportAlignmentPoints(); }
public void ClearAlignmentPoints() { try { AlignmentPoints.Clear(); SaveAlignmentPoints(); } catch (Exception ex) { LogException(ex, true); } }