Changeset 17436
- Timestamp:
- 02/17/20 09:29:51 (5 years ago)
- Location:
- branches/3026_IntegrationIntoSymSpace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/FileManager.cs
r17404 r17436 14 14 namespace HeuristicLab.JsonInterface.OptimizerIntegration { 15 15 internal static class FileManager { 16 private static SaveFileDialog saveFileDialog;17 16 private static OpenFileDialog openFileDialog; 18 17 private static ExportJsonDialog exportDialog = new ExportJsonDialog(); … … 26 25 public static void ExportJsonTemplate(IContentView view) { 27 26 // TODO: view to select free params, warning if no results are generated 28 29 30 31 27 IStorableContent content = view.Content as IStorableContent; 32 28 if (!view.Locked && content != null) { 33 29 exportDialog.Content = content; 34 30 exportDialog.ShowDialog(); 35 /*36 if (saveFileDialog == null) {37 saveFileDialog = new SaveFileDialog();38 saveFileDialog.Title = "Export .json-Template";39 saveFileDialog.DefaultExt = "json";40 saveFileDialog.Filter = ".json-Template|*.json|All Files|*.*";41 saveFileDialog.FilterIndex = 1;42 }43 44 INamedItem namedItem = content as INamedItem;45 string suggestedFileName = string.Empty;46 if (!string.IsNullOrEmpty(content.Filename)) suggestedFileName = content.Filename;47 else if (namedItem != null) suggestedFileName = namedItem.Name;48 else suggestedFileName = "Item";49 50 saveFileDialog.FileName = suggestedFileName + " " + namedItem.GetType().Name;51 52 if (saveFileDialog.ShowDialog() == DialogResult.OK) {53 IAlgorithm alg = namedItem as IAlgorithm;54 File.WriteAllText(saveFileDialog.FileName, JCGenerator.GenerateTemplate(alg));55 }56 */57 31 } 58 32 } -
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ExportJsonDialog.cs
r17435 r17436 22 22 private IList<JsonItemVMBase> VMs { get; set; } 23 23 private JCGenerator Generator { get; set; } = new JCGenerator(); 24 private IDictionary<string, IJsonItem> ResultItems = new Dictionary<string, IJsonItem>();24 private IDictionary<string, IJsonItem> ResultItems { get; set; } = new Dictionary<string, IJsonItem>(); 25 25 26 26 private IContent content; … … 33 33 treeView.Nodes.Clear(); 34 34 ResultItems.Clear(); 35 35 resultItems.Items.Clear(); 36 36 37 Optimizer = content as IOptimizer; 37 38 Root = JsonItemConverter.Extract(Optimizer); … … 93 94 94 95 if (SaveFileDialog.ShowDialog() == DialogResult.OK) { 95 File.WriteAllText(SaveFileDialog.FileName, Generator.GenerateTemplate(Root, Optimizer));96 Generator.GenerateTemplate(@"C:\Users\p41997\Desktop", "template", Optimizer, Root); 96 97 } 97 98 -
branches/3026_IntegrationIntoSymSpace/Heuristiclab.ConfigStarter/Program.cs
r17417 r17436 46 46 47 47 JCGenerator generator = new JCGenerator(); 48 49 File.WriteAllText(@"C:\Workspace\Template.json", generator.GenerateTemplate(alg)); 48 generator.GenerateTemplate(@"C:\Workspace\Template.json", alg); 50 49 JsonTemplateInstantiator.Instantiate(@"C:\Workspace\Template.json"); 51 50 /*
Note: See TracChangeset
for help on using the changeset viewer.