public void Load() { var protocol = HeartRateSettingsProtocol.Load(_filename); if (protocol == null) { return; } FontName = protocol.FontName; UIFontName = protocol.UIFontName; AlertLevel = protocol.AlertLevel; WarnLevel = protocol.WarnLevel; AlertTimeout = TimeSpan.FromMilliseconds(protocol.AlertTimeout); DisconnectedTimeout = TimeSpan.FromMilliseconds(protocol.DisconnectedTimeout); Color = ColorFromString(protocol.Color); WarnColor = ColorFromString(protocol.WarnColor); UIColor = ColorFromString(protocol.UIColor); UIWarnColor = ColorFromString(protocol.UIWarnColor); UIBackgroundColor = ColorFromString(protocol.UIBackgroundColor); Sizable = protocol.Sizable; LogFormat = protocol.LogFormat; LogDateFormat = protocol.LogDateFormat; LogFile = protocol.LogFile; // In the future: // if (protocol.Version >= 2) ... }
internal static void Save(HeartRateSettings settings, string filename) { Debug.WriteLine($"Saving to {filename}"); var protocol = new HeartRateSettingsProtocol(settings); using (var fs = File.Open(filename, FileMode.Create, FileAccess.Write)) { _serializer.Serialize(fs, protocol); } }
public void Save() { HeartRateSettingsProtocol.Save(this, _filename); }