public void SaveAndLoadApplicationSettings()
        {
            var settings = new ApplicationSettingsDataMixin(
                size: DiagramSize.Huge,
                direction: DiagramDirection.LefToRight);

            var serializer = new JsonApplicationSettingSerializer();
            var json = serializer.Save(settings);
            var newSettings = serializer.Load(json);

            Assert.AreEqual(settings.DiagramSize, newSettings.DiagramSize);
            Assert.AreEqual(settings.DiagramDirection, newSettings.DiagramDirection);
        }
Exemplo n.º 2
0
 public void Save()
 {
     var serializer = new JsonApplicationSettingSerializer();
     var content = serializer.Save(_data);
     try
     {
         System.IO.File.WriteAllText(_settingFilePath.Value, content.Value);
     }
     catch (Exception)
     {
         // if settings cannot be saved, we cannot do anything but reset the settings
         _data = new ApplicationSettingsDataMixin();
     }
 }