public void Start(Action<HistoryConfiguration> configurator) { historyKeys = assemblySource.SelectMany(assembly => FindKeys(assembly)).ToList(); assemblySource.AssemblyAdded += assembly => FindKeys(assembly).Apply(x => historyKeys.Add(x)); config = new HistoryConfiguration { DetermineItem = value =>{ var key = historyKeys.FirstOrDefault(x => x.Value == value); return key != null ? key.GetInstance() : null; } }; configurator(config); config.Conductor.PropertyChanged += Host_PropertyChanged; config.Conductor.ActivationProcessed += Host_ActivationProcessed; stateManager.AfterStateLoad += OnAfterStateLoad; stateManager.Initialize(config.StateName); Log.Info("History coordinator started for conductor {0} with state {1}.", config.Conductor, config.StateName); }
/// <summary> /// Starts the coordinator with the specified configuration callback. /// </summary> /// <param name="configurator">The configuration callback.</param> public void Start(Action <HistoryConfiguration> configurator) { historyKeys = assemblySource.SelectMany(assembly => FindKeys(assembly)).ToList(); assemblySource.AssemblyAdded += assembly => FindKeys(assembly).Apply(x => historyKeys.Add(x)); config = new HistoryConfiguration { DetermineItem = value => { var key = historyKeys.FirstOrDefault(x => x.Value == value); return(key != null ? key.GetInstance() : null); } }; configurator(config); config.Conductor.PropertyChanged += Host_PropertyChanged; config.Conductor.ActivationProcessed += Host_ActivationProcessed; stateManager.AfterStateLoad += OnAfterStateLoad; stateManager.Initialize(config.StateName); Log.Info("History coordinator started for conductor {0} with state {1}.", config.Conductor, config.StateName); }