Пример #1
0
 /// <summary>
 /// Show a save file dialog that will offer to export <paramref name="theme" /> to a .json file.
 /// </summary>
 public void ExportTheme(Theme theme)
 {
     var filename = _dialogService.SaveFileDialog(".json", "JSON themes|*.json", theme.Name);
     if (!string.IsNullOrEmpty(filename)) {
         theme.Save(filename);
         SelectItemByModel(theme);
     }
 }
Пример #2
0
        public void TestSave()
        {
            // load test theme
            var theme = new Theme();
            theme.LoadFromPath(_themePath);

            // export to another path
            var themeSavePath = Path.GetTempFileName();
            theme.Save(themeSavePath);

            // load the export
            var exportedTheme = new Theme();
            exportedTheme.LoadFromPath(themeSavePath);

            // Assert the loaded theme has expected values
            foreach (var field in _themeDict) {
                Assert.That(theme.Config[field.Key], Is.EqualTo(field.Value));
            }
        }