Example #1
0
        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) ...
        }
Example #2
0
        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);
            }
        }
Example #3
0
 public void Save()
 {
     HeartRateSettingsProtocol.Save(this, _filename);
 }