private void Initialize(IAlgorithm algorithm) { parameters = new ObservableDictionary <string, IItem>(); results = new ObservableDictionary <string, IItem>(); if (algorithm.StoreAlgorithmInEachRun) { var clone = (IAlgorithm)algorithm.Clone(); clone.CollectParameterValues(parameters); clone.CollectResultValues(results); clone.Runs.Clear(); this.algorithm = clone; } else { var par = new Dictionary <string, IItem>(); var res = new Dictionary <string, IItem>(); algorithm.CollectParameterValues(par); algorithm.CollectResultValues(res); var cloner = new Cloner(); foreach (var k in par) { parameters.Add(k.Key, cloner.Clone(k.Value)); } foreach (var k in res) { results.Add(k.Key, cloner.Clone(k.Value)); } } }
private void Initialize(IAlgorithm algorithm) { parameters = new ObservableDictionary<string, IItem>(); results = new ObservableDictionary<string, IItem>(); if (algorithm.StoreAlgorithmInEachRun) { var clone = (IAlgorithm)algorithm.Clone(); clone.CollectParameterValues(parameters); clone.CollectResultValues(results); clone.Runs.Clear(); this.algorithm = clone; } else { var par = new Dictionary<string, IItem>(); var res = new Dictionary<string, IItem>(); algorithm.CollectParameterValues(par); algorithm.CollectResultValues(res); var cloner = new Cloner(); foreach (var k in par) parameters.Add(k.Key, cloner.Clone(k.Value)); foreach (var k in res) results.Add(k.Key, cloner.Clone(k.Value)); } }