예제 #1
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        public StrategyController()
        {
            IPersistRepository <object> persistRepository = ContextRegistry.GetContext()["PersistRepository"] as IPersistRepository <object>;

            // Save UI thread reference
            _currentDispatcher = Dispatcher.CurrentDispatcher;

            PersistencePublisher.InitializeDisruptor(persistRepository);
        }
        /// <summary>
        /// Starts Communicator to open communication medium with clients
        /// </summary>
        public void StartCommunicator()
        {
            // Check for Null Reference
            if (_communicator != null)
            {
                // Connect Communication Server
                _communicator.Connect();

                IPersistRepository <object> persistRepository = ContextRegistry.GetContext()["PersistRepository"] as IPersistRepository <object>;
                PersistencePublisher.InitializeDisruptor(true, persistRepository);
            }
        }
예제 #3
0
        /// <summary>
        /// Execute selected strategy
        /// </summary>
        private void RunSelectedStrategy(string key)
        {
            try
            {
                IPersistRepository <object> persistRepository = ContextRegistry.GetContext()["PersistRepository"] as IPersistRepository <object>;
                PersistencePublisher.InitializeDisruptor(EnablePersistence, persistRepository);
                if (Logger.IsInfoEnabled)
                {
                    Logger.Info("Going to execute the selected strategy: ", _type.FullName, "RunSelectedStrategy");
                }

                // Create new instance to pass to event aggregator
                RunStrategy runStrategy = new RunStrategy(key);

                // Publish event to notify listeners
                EventSystem.Publish <RunStrategy>(runStrategy);
            }
            catch (Exception exception)
            {
                Logger.Error(exception, _type.FullName, "RunSelectedStrategy");
            }
        }