protected virtual void InitializeComponentGraph(TraceLab.Core.Settings.Settings settings) { if (CompositeComponentMetadata.HasDeserializationError == false) { CompositeComponentMetadata.InitializeComponentGraph(this, settings); //subscribe to subworkflow errors INotifyCollectionChanged subexperimentErrorCollection = CompositeComponentMetadata.ComponentGraph.Errors; subexperimentErrorCollection.CollectionChanged += SubExperimentErrorCollectionChanged; } }
public void ListenToGlobalLogLevelSettingChange(TraceLab.Core.Settings.Settings settings) { if (m_settings != settings) { if (m_settings != null && m_settings.ExperimentSettings != null) { //detach listener m_settings.ExperimentSettings.GlobalLogLevelSettingChanged -= GlobalLogLevelSettingChangedEventHandler; } m_settings = settings; if (m_settings != null && m_settings.ExperimentSettings != null) { //listen to the changes of log settings m_settings.ExperimentSettings.GlobalLogLevelSettingChanged += GlobalLogLevelSettingChangedEventHandler; } } }
public SettingsViewModel(Settings settings, ComponentsLibraryViewModelWrapper componentLibrary) { if (settings == null) throw new ArgumentNullException("settings"); if (componentLibrary == null) throw new ArgumentNullException("componentLibrary"); m_componentsLibrary = componentLibrary; m_settings = settings; m_settings.PropertyChanged += new PropertyChangedEventHandler(m_settings_PropertyChanged); m_settings.TypePaths.CollectionChanged += TypePaths_CollectionChanged; m_settings.ComponentPaths.CollectionChanged += ComponentPaths_CollectionChanged; m_settings.PackagePaths.CollectionChanged += PackagePaths_CollectionChanged; BuildPathViewModels(m_settings.ComponentPaths, m_componentPaths, SettingsPathType.Components); BuildPathViewModels(m_settings.TypePaths, m_typePaths, SettingsPathType.Type); BuildPathViewModels(m_settings.PackagePaths, m_packagePaths, SettingsPathType.Package); SetGlobalLogLevelSettingCommand = new DelegateCommand(SetGlobalLogLevelSettingFunc, CanSetGlobalLogLevelSettingFunc); }
/// <summary> /// Initializes the component graph from ComponentMetadataDefinition graph /// </summary> /// <param name="node">The node.</param> /// <param name="settings">The settings.</param> public override void InitializeComponentGraph(CompositeComponentNode node, TraceLab.Core.Settings.Settings settings) { //each composite node gets its own copy of ComponentMetadataDefinition.ComponentGraph m_compositeComponentGraph = new CompositeComponentGraph(node, ComponentMetadataDefinition.ComponentGraph); m_compositeComponentGraph.Settings = settings; }
public CompositeComponentNode(string id, SerializedVertexData data, TraceLab.Core.Settings.Settings settings) : base(id, data) { InitializeComponentGraph(settings); }
public Settings Clone() { Settings clone = new Settings(); if(m_experimentSettings != null) clone.m_experimentSettings = m_experimentSettings.Clone(); return clone; }
public static void SaveSettings(Settings settings) { XmlWriter writer = null; try { System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(SettingsPath)); XmlWriterSettings xmlSettings = new XmlWriterSettings(); xmlSettings.Indent = true; writer = XmlWriter.Create(SettingsPath, xmlSettings); settings.WriteXml(writer); } catch (Exception ex) { NLog.LogManager.GetCurrentClassLogger().Error("Settings failed to be saved", ex); } finally { if (writer != null) writer.Close(); } }
public static Settings GetSettings() { if (s_appSettings == null) { s_appSettings = new ApplicationSettings(); try { if (System.IO.File.Exists(TraceLab.Core.Settings.Settings.SettingsPath)) { //deserilize the settings using (var reader = XmlReader.Create(TraceLab.Core.Settings.Settings.SettingsPath)) { Deserialize(reader); } } } catch (Exception) { NLog.LogManager.GetCurrentClassLogger().Warn("Settings failed to be restored from previously saved settings.xml (in %APPDATA%/TraceLab). File was corrupted. Application restored default settings."); } } Settings settings = new Settings(); return settings; }
public abstract void InitializeComponentGraph(CompositeComponentNode node, TraceLab.Core.Settings.Settings settings);
private static TraceLab.Core.ViewModels.ComponentLibraryViewModel CreateComponentLibraryViewModel(PackageManager pkgManager, TraceLab.Core.Settings.Settings settings, string decisionDirectory, string dataRoot) { ComponentsLibrary.Init(settings.ComponentPaths); //Load stuff to components library TraceLab.Core.Decisions.DecisionCompilationRunner.DecisionDirectoryPath = decisionDirectory; ComponentsLibrary.Instance.DataRoot = dataRoot; var workspaceTypeDirectories = new List <string>(settings.TypePaths.Select(path => path.Path)); ComponentsLibrary.Instance.Rescan(pkgManager, workspaceTypeDirectories, false); foreach (SettingsPath path in settings.ComponentPaths) { var logger = NLog.LogManager.GetCurrentClassLogger(); logger.Info("Reading components from: {0}", path.Path); } var compvm = new ComponentLibraryViewModel(ComponentsLibrary.Instance, workspaceTypeDirectories); return(compvm); }