コード例 #1
0
ファイル: ThemesWindowViewModel.cs プロジェクト: jameshy/else
 /// <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
ファイル: ThemeObjectTest.cs プロジェクト: vortec/else
        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));
            }
        }