public void Initialize(XmlElement config, IEventManager eventManager, IProfile profile)
        {
            eventManager.Subscribe(typeof(LogMessage), HandleLogMessage);
            eventManager.Subscribe(typeof(ServiceHostState), HandleServiceHostStateMessage);

            ConfigureAppenders(config);
        }
        public void Initialize(XmlElement config, IEventManager eventManager, IProfile profile) {
            this.eventManager = eventManager;
            this.profile = profile;
            this.eventManager.Subscribe(typeof(IntervalSync), OnInterval);

            logger = new Logger(eventManager);
        }
Beispiel #3
0
        public TimeController(IEventManager eventManager)
        {
            TimeSpeed = 1.0F;
            _eventManager = eventManager;

            _eventManager.Subscribe<TimeManipulationChangedEvent>(HandleTimeManipulationEvent);
        }
 public virtual void Initialize(XmlElement config, IEventManager eventManager, IProfile profile) {
     folderFilterPattern = config["Filter"].InnerText;
     suiteName = config["SuiteName"].InnerText;
     monitor = new RecyclingFileMonitor(profile, config["Watch"].InnerText, folderFilterPattern, Process);
     this.eventManager = eventManager;
     this.eventManager.Subscribe(EventSinkType, monitor.ProcessFolder);
 }
Beispiel #5
0
        private void InjectionInitialize(
            IEventManager eventManager)
        {
            this.eventManager = eventManager;

            this.eventManager.GetEvent<LoadingEvent>().AddListener(this.OnLoading);
        }
Beispiel #6
0
 //public AbstractEvent(IEventManager parentManager, InamStream stream)
 //{
 //}
 public AbstractEvent(byte TargetID, IEventManager parentManager, InamStream stream)
     : this(TargetID)
 {
     this.parentManager = parentManager;
     this.LoadStream(stream);
     this._targetID = TargetID;
 }
Beispiel #7
0
        protected BaseService(ILogger logger, IHttpClient httpClient)
        {
            Logger = logger;
            HttpClient = httpClient;  

            EventManager = new EventManager(Logger, HttpClient);
        }
 public virtual void Initialize(XmlElement config, IEventManager eventManager, IProfile profile) {
     Config = config;
     EventManager = eventManager;
     Logger = new Logger(eventManager);
     
     Logger.LogVersionOneConfiguration(LogMessage.SeverityType.Info, Config["Settings"]);
 }
 public EventAppService(
     IEventManager eventManager, 
     IRepository<Event, Guid> eventRepository)
 {
     _eventManager = eventManager;
     _eventRepository = eventRepository;
 }
Beispiel #10
0
        private void InjectionInitialize(
            IEventManager eventManager)
        {
            this.eventManager = eventManager;

            this.eventManager.GetEvent<ShowMessageDialogEvent>().AddListener(this.OnShowMessageDialog);
        }
        public void Initialize(XmlElement config, IEventManager eventManager, IProfile profile)
        {
            string reposServer = config["RepositoryServer"].InnerText;
            _profile = profile;
            _respostoryPath =reposServer + config["RepositoryPath"].InnerText;

            if (!_usernames.ContainsKey(reposServer))
            {
                Console.Write(String.Format("Please enter {0} Username : "******"Please enter {0} Password : ", reposServer));
                _passwords[reposServer] = Console.ReadLine();
            }

            _connector.SetAuthentication(_usernames[reposServer],  _passwords[reposServer]);

            _eventManager = eventManager;
            _eventManager.Subscribe(PubType, PokeRepository);

            _connector.Revision += _connector_Revision;
            _connector.Error += _connector_Error;

            InernalInitialize(config, eventManager, profile);
        }
Beispiel #12
0
 private void InjectionInitialize(
     IScreenManager screenManager,
     IEventManager eventManager)
 {
     this.screenManager = screenManager;
     this.eventManager = eventManager;
 }
        protected override void InternalInitialize(XmlElement config, IEventManager eventmanager, IProfile profile) 
        {
            ReferenceExpression = config[ReferenceExpressionField].InnerText;
            repositoryFriendlyNameSpec = config[RepositoryFriendlyNameSpecField].InnerText;
            LoadLinkInfo(config[LinkNode]);

            svnInfo = connector.GetSvnInformation(RepositoryPath);
        }
        private void InjectionInitialize(
            IEventManager eventManager)
        {
            this.eventManager = eventManager;

            this.eventManager.GetEvent<CameraFocusedOnEvent>().AddListener(this.OnCameraFocusedOnEvent);
            this.eventManager.GetEvent<CameraLostFocusEvent>().AddListener(this.OnCameraLostFocus);
        }
Beispiel #15
0
        public EventManager(IEventManager Parent, SortedList<int, IEventManaging> EventObjectList)
        {
            //parent = Parent;

            eventObjectList = EventObjectList;

            eventQueue = new Queue<IEvent>();
        }
        public void Initialize(XmlElement config, IEventManager eventManager, IProfile profile) {
            this.eventManager = eventManager;
            this.eventManager.Subscribe(typeof(V1TestReady), CreateQCTest);
            this.eventManager.Subscribe(typeof(WorkitemCreationResult), OnDefectCreated);
            this.eventManager.Subscribe(typeof(WorkitemStateChangeCollection), OnDefectStateChange);
            this.eventManager.Subscribe(typeof(ServiceHostState), HostStateChanged);

            logger = new Logger(eventManager);
        }
 public DevelopmentManager(IEventManager eventManager, IPluginManager pluginManager)
 {
     // Create the logged in user's specific instance of the user manager proxy.
     // The actual implementation class could be changed in configuration
     // or using dependency injection (if we want to implement that)...
     _eventManager = eventManager;
     _pluginManager = pluginManager;
     _commonManagerProxy = new CommonManagerProxy(this);
 }
        /// <summary>
        ///     Initialisiert eine neue Instanz der <see cref="EventMemberInjector" /> Klasse.
        /// </summary>
        /// <param name="metadata">
        ///     The metadata.
        /// </param>
        /// <param name="manager">
        ///     The manager.
        /// </param>
        /// <param name="member">
        ///     The member.
        /// </param>
        public EventMemberInjector(ImportMetadata metadata, IEventManager manager, MemberInfo member)
        {
            Contract.Requires<ArgumentNullException>(metadata != null, "metadata");
            Contract.Requires<ArgumentNullException>(manager != null, "manager");
            Contract.Requires<ArgumentNullException>(member != null, "member");

            _metadata = metadata;
            _manager = manager;
            _member = member;
        }
        public void Initialize(XmlElement configElement, IEventManager manager, IProfile profile) {
            eventManager = manager;
            this.profile = profile;
            logger = new Logger(eventManager);
            this.configElement = configElement;

            ConfigurationReader.ReadConfigurationValues(configuration, configElement);

            InitializeComponents();
        }
        public void Initialize(XmlElement config, IEventManager eventManager, IProfile profile) {
            if(!double.TryParse(config["Interval"].InnerText, out interval)) {
                interval = -1;
            }

            publishtype = Type.GetType(config["PublishClass"].InnerText);
            eventmanager = eventManager;
            eventmanager.Subscribe(typeof(ServiceHostState), HostStateChanged);
            logger = new Logger(eventManager);
        }
        public void Initialize(XmlElement config, IEventManager eventManager, IProfile profile) {
            EventManager = eventManager;
            Logger = new Logger(eventManager);
            var c = new V1Central(config["Settings"]);
            c.Validate();
            v1Server = c;

            LoadProjectMap(config["TestPublishProjectMap"], config["BaseQueryFilter"]);

            EventManager.Subscribe(typeof(IntervalSync), OnInterval);
        }
        public OrderFulfillmentSagaManager(IEventManager eventManager, ISagaFactory sagaFactory)
        {
            _eventManager = eventManager;
            _sagaFactory = sagaFactory;
            _sagas = new Dictionary<string, IOrderFulfillmentSaga>();
            _handleSagaLock = new object();
            
            SagasChanged = delegate { };

            SubscribeToEvents();
        }
 public RolePermissionsService(IRoleService roleService,
     IAuthorizer authorizer,
     IPermissionManager permissionManager,
     IEventManager eventManager)
 {
     _roleService = roleService;
     _authorizer = authorizer;
     _permissionManager = permissionManager;
     _eventManager = eventManager;
     _allPermissionsCache = _permissionManager.GetAllPermissions();
 }
 public AccountPermissionsManager(IEnumerable<IUserPermissionPattern> userPermissionsPattern,
     ICacheManager cacheManager,
     IEventManager eventManager,
     IAccountService accountService
     )
 {
     _userPermissionsPattern = userPermissionsPattern;
     _userPermissionsCache = cacheManager.Get<int, IEnumerable<string>>("USER_PERMISSIONS_CACHE");
     _eventManager = eventManager;
     _accountService = accountService;
 }
        public Client(string serverAddress)
        {
            Uri eventManagerAddress = new Uri("http://" + serverAddress + ":80/EventManager");

            ChannelFactory<IEventManager> eventManagerFactory =
                new ChannelFactory<IEventManager>(
                    new WebHttpBinding(WebHttpSecurityMode.None),
                    new EndpointAddress(eventManagerAddress));
            eventManagerFactory.Endpoint.EndpointBehaviors.Add(new Microsoft.Samples.XmlRpc.XmlRpcEndpointBehavior());

            eManager = eventManagerFactory.CreateChannel();
        }
        public override void SetUp()
        {
            base.SetUp();

            workitemWriterMock = Repository.StrictMock<WorkitemWriter>();
            eventManagerMock = Repository.StrictMock<IEventManager>();

            eventManager = new EventManager();
            service = new WorkitemWriterHostedService();

            service.Initialize(null, eventManager, null);
        }
        public void Initialize(XmlElement config, IEventManager eventManager, IProfile profile)
        {
            if (!double.TryParse(config["Interval"].InnerText, out _interval))
                _interval = -1;
            _publishtype = Type.GetType(config["PublishClass"].InnerText);

            _eventmanager = eventManager;
            _eventmanager.Subscribe(typeof(ServiceHostState),HostStateChanged);

            _timer = new Timer(_interval);
            _timer.Enabled = false;
            _timer.Elapsed += Timer_Elapsed;
        }
 public ShipmentManager(
     ILogger <ShipmentManager> logger,
     IShipmentService service,
     IMapper mapper,
     ICustomerService customerService,
     IEventManager eventManager,
     IIsotopeOrderingAuthorizationService authorizationService)
 {
     _logger               = logger;
     _service              = service;
     _mapper               = mapper;
     _customerService      = customerService;
     _eventManager         = eventManager;
     _authorizationService = authorizationService;
 }
Beispiel #29
0
        public Tile(Point position, Point size, List<IEntity> entityList)
        {
            this.id = Guid.NewGuid();

            this.position = position;
            this.rectangle = new Rectangle(position.X, position.Y, size.X, size.Y);
            //this.entityList = entityList ?? new List<IEntity>();

            this.entityManager = new EntityManager(this, entityList);

            //this.eventObjectList = new SortedList<int, IEventManaging>();
            this.eventManager = new TileEventManager(new SortedList<int, IEventManaging>());

            this.adjacentTiles = new Tile[8];
        }
        /// <summary>
        ///  This is the vehicle control view model.
        /// This is responsable for the opening new tabs.
        /// </summary>
        /// <param name="configurationService">Configuration service. It give us the global configuration</param>
        /// <param name="eventManager">EventManager. This is the eventManager</param>
        /// <param name="services">DataServices. This are the dataservices for this stuff.</param>
        /// <param name="container"></param>
        /// <param name="regionManager"></param>
        public VehiclesControlViewModel(IConfigurationService configurationService,
                                        IEventManager eventManager,
                                        IDataServices services,
                                        UnityContainer container,
                                        IRegionManager regionManager) : base(configurationService, eventManager, services, regionManager)
        {
            base.GridIdentifier  = KarveCommon.Generic.GridIdentifiers.VehicleGrid;
            _container           = container;
            _regionManager       = regionManager;
            _vehicleDataServices = DataServices.GetVehicleDataServices();
            OpenItemCommand      = new DelegateCommand <object>(OpenCurrentItem);
            AllowedGridColumns   = GenerateAllowedColumns();

            InitViewModel();
        }
 /// <summary>
 /// This is the commission agent view model.
 /// </summary>
 /// <param name="configurationService">Configuration service for the commission agent</param>
 /// <param name="eventManager">Event manager used for communicating between view models</param>
 /// <param name="services">Data Access layer services</param>
 /// <param name="regionManager">Region manager for navigation</param>
 public CommissionAgentControlViewModel(IConfigurationService configurationService,
                                        IEventManager eventManager,
                                        UnityContainer container,
                                        IDataServices services, IRegionManager regionManager, IDialogService dialogService) : base(configurationService, eventManager, services, regionManager)
 {
     _regionManager = regionManager;
     _container     = container;
     _dataServices  = services;
     _commissionAgentDataServices = _dataServices.GetCommissionAgentDataServices();
     _dialogService  = dialogService;
     DefaultPageSize = 500;
     ItemName        = KarveLocale.Properties.Resources.lrbtnComisionistas;
     OpenItemCommand = new DelegateCommand <object>(OpenCurrentItem);
     InitViewModel();
 }
Beispiel #32
0
        public void UpdatePrice(decimal newPrice, IEventManager eventManager)
        {
            if (newPrice <= 0)
            {
                throw new ArgumentException($"`{nameof(newPrice)}' must be positive. Was `{newPrice}`.", nameof(newPrice));
            }

            if (eventManager == null)
            {
                throw new ArgumentNullException(nameof(eventManager));
            }

            CurrentPrice = newPrice;
            eventManager.Raise(new InstrumentPriceChangedDomainEvent(Symbol));
        }
Beispiel #33
0
        public InnerPlayerControl(ILogger <InnerPlayerControl> logger, IServiceProvider serviceProvider, IEventManager eventManager, Game game)
        {
            _logger       = logger;
            _eventManager = eventManager;
            _game         = game;

            Physics          = ActivatorUtilities.CreateInstance <InnerPlayerPhysics>(serviceProvider, this, _eventManager, _game);
            NetworkTransform = ActivatorUtilities.CreateInstance <InnerCustomNetworkTransform>(serviceProvider, this, _game);

            Components.Add(this);
            Components.Add(Physics);
            Components.Add(NetworkTransform);

            PlayerId = byte.MaxValue;
        }
Beispiel #34
0
        public override void Initialise(IEngine engine, IEventManager eventManager, IWorldManager worldManager, GraphicsDeviceManager graphicsDeviceManager)
        {
            base.Initialise(engine, eventManager, worldManager, graphicsDeviceManager);

            // Initialise sprite batch if graphics device is not null.
            // Otherwise hook up graphics device create event.
            if (graphicsDeviceManager.GraphicsDevice != null)
            {
                spriteBatch = new SpriteBatch(graphicsDeviceManager.GraphicsDevice);
            }
            else
            {
                graphicsDeviceManager.DeviceCreated += GraphicsDeviceManager_DeviceCreated;
            }
        }
Beispiel #35
0
 public void LogEvents(IEventManager eventManager)
 {
     if (this.HasFailures)
     {
         eventManager.LogEvents(this.m_check.CheckId, ReplicationCheckResultEnum.Failed, this.m_FailedMessages);
     }
     if (this.HasWarnings)
     {
         eventManager.LogEvents(this.m_check.CheckId, ReplicationCheckResultEnum.Warning, this.m_WarningMessages);
     }
     if (this.HasPasses)
     {
         eventManager.LogEvents(this.m_check.CheckId, ReplicationCheckResultEnum.Passed, this.m_PassedMessages);
     }
 }
        public ManyToManyPlugin(IEventManager eventManager, DbContext dbContext)
        {
            _eventManager = eventManager;

            string annotationKey = typeof(ManyToManyMetadata).FullName;

            foreach (IEntityType entityType in dbContext.Model.GetEntityTypes())
            {
                var annotation = entityType.FindAnnotation(annotationKey);
                if (annotation != null)
                {
                    _metadataCache[entityType.ClrType] = (List <ManyToManyMetadata>)annotation.Value;
                }
            }
        }
Beispiel #37
0
        public override void Initialise(IEngine engine, IEventManager eventManager, IWorldManager worldManager, GraphicsDeviceManager graphicsDeviceManager)
        {
            base.Initialise(engine, eventManager, worldManager, graphicsDeviceManager);

            // If the graphics device has been created, initialise sprite batch.
            if (graphicsDeviceManager.GraphicsDevice != null)
            {
                spriteBatch = new SpriteBatch(graphicsDeviceManager.GraphicsDevice);
            }
            // Else, hook up on create event for graphics device manager.
            else
            {
                graphicsDeviceManager.DeviceCreated += GraphicsDeviceManager_DeviceCreated;
            }
        }
Beispiel #38
0
        private void PublishInternal <TEvent>(TEvent evt)
        {
            IEventManager eventManager;

            Type eventType = typeof(TEvent);

            if (!Managers.TryGetValue(eventType, out eventManager))
            {
                // No listeners anyways
                return;
            }
            IEventManager <TEvent> eventManagerTyped = (IEventManager <TEvent>)eventManager;

            eventManagerTyped.Publish(evt);
        }
        public InnerPlayerControl(ICustomMessageManager <ICustomRpc> customMessageManager, Game game, ILogger <InnerPlayerControl> logger, IServiceProvider serviceProvider, IEventManager eventManager, IDateTimeProvider dateTimeProvider) : base(customMessageManager, game)
        {
            _logger           = logger;
            _eventManager     = eventManager;
            _dateTimeProvider = dateTimeProvider;

            Physics          = ActivatorUtilities.CreateInstance <InnerPlayerPhysics>(serviceProvider, this, _eventManager, game);
            NetworkTransform = ActivatorUtilities.CreateInstance <InnerCustomNetworkTransform>(serviceProvider, this, game);

            Components.Add(this);
            Components.Add(Physics);
            Components.Add(NetworkTransform);

            PlayerId = byte.MaxValue;
        }
        /// <summary>
        /// API Tracker constructor
        /// </summary>
        public IronSourceAtomTracker()
        {
            api_       = new IronSourceAtom();
            eventPool_ = new EventTaskPool(taskWorkersCount_, taskPoolSize_);

            eventManager_ = new QueueEventManager();
            streamData_   = new ConcurrentDictionary <string, string>();

            random_ = new Random();

            ThreadStart threadMethodHolder = new ThreadStart(this.EventWorker);

            eventWorkerThread_ = new Thread(threadMethodHolder);
            eventWorkerThread_.Start();
        }
Beispiel #41
0
        public OrionItemService(IEventManager events, ILogger log)
        {
            Debug.Assert(events != null);
            Debug.Assert(log != null);

            _events = events;
            _log    = log;

            // Note that the last item should be ignored, as it is not a real item.
            _items = new WrappedReadOnlyList <OrionItem, Terraria.Item>(
                Terraria.Main.item.AsMemory(..^ 1), (itemIndex, terrariaItem) => new OrionItem(itemIndex, terrariaItem));

            OTAPI.Hooks.Item.PreSetDefaultsById = PreSetDefaultsByIdHandler;
            OTAPI.Hooks.Item.PreUpdate          = PreUpdateHandler;
        }
Beispiel #42
0
 public IDisposable Subscribe(IEventManager events, UnmanagedDispose disposable, MethodInfo mi, string name)
 {
     if (Types.Length > 0)
     {
         var action        = typeof(Action <>);
         var genericAction = action.MakeGenericType(Types);
         var dg            = mi.CreateDelegate(genericAction, disposable);
         return(_wireUp(events, name, dg));
     }
     else
     {
         var dg = mi.CreateDelegate(typeof(Action), disposable);
         return(_wireUp(events, name, dg));
     }
 }
        public ReservationRequestControlViewModel(IConfigurationService configurationService, IDataServices services,
                                                  IInteractionRequestController requestController,
                                                  IDialogService dialogService,
                                                  IRegionManager manager,
                                                  IEventManager eventManager) : base(configurationService,
                                                                                     services, requestController, dialogService, eventManager)
        {
            _reservationRequestDataService = services.GetReservationRequestDataService();
            _regionManager  = manager;
            ItemName        = "Peticiones de Reserva";
            DefaultPageSize = 50;

            DirectSubsystem = BookingModule.RequestGroup;
            ViewModelUri    = new Uri("karve://booking/request/viewmodel?id=" + UniqueId);
            InitViewModel();
        }
 public CustomerManager(ILogger <CustomerManager> logger,
                        IMapper mapper,
                        ICustomerService service,
                        IUserService userService,
                        IIsotopeOrderingAuthorizationService authorization,
                        IEventManager eventService,
                        INotificationService notificationService)
 {
     _logger              = logger;
     _mapper              = mapper;
     _service             = service;
     _userService         = userService;
     _authorization       = authorization;
     _eventService        = eventService;
     _notificationService = notificationService;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DownloadTask"/> class.
 /// </summary>
 /// <param name="networkProtocolProviderFactory">The network protocol provider factory.</param>
 /// <param name="downloadSegmentCalculator">The download segment calculator.</param>
 /// <param name="downloadStreamManager">The download stream manager.</param>
 /// <param name="settings">The settings.</param>
 /// <param name="file">The file.</param>
 /// <param name="eventManager">The event manager.</param>
 public DownloadTask(
     INetworkProtocolProviderFactory networkProtocolProviderFactory,
     IDownloadSegmentPositionsCalculator downloadSegmentCalculator,
     IDownloadStreamManager downloadStreamManager,
     IDownloadSettings settings,
     DownloadFileInfo file,
     IEventManager eventManager)
 {
     m_NetworkProtocolProviderFactory = networkProtocolProviderFactory;
     m_DownloadSegmentCalculator      = downloadSegmentCalculator;
     m_Settings = settings;
     m_File     = file;
     m_DownloadStreamManager = downloadStreamManager;
     m_EventManager          = eventManager;
     m_CreateDate            = DateTime.Now;
 }
        public void Initialize(XmlElement config, IEventManager eventManager, IProfile profile) {
            ConfigurationReader.ProcessMappingSettings(configuration.PriorityMappings, config["PriorityMappings"], "VersionOnePriority", "QualityCenterPriority");
            
            this.eventManager = eventManager;
            logger = new Logger(eventManager);

            ParseConfiguration(config);

            qcServer = new QualityCenterReaderUpdater(configuration.PriorityMappings);
            qcWriter = new QualityCenterUpdaterService(qcServer);
            qcReader = new QualityCenterReaderService(qcServer);

            qcServer.Initialize(config, new Logger(eventManager));
            qcWriter.Initialize(config, eventManager, profile);
            qcReader.Initialize(config, eventManager, profile);
        }
Beispiel #47
0
        /// <summary>
        ///   Create the manager.
        /// </summary>
        /// <param name="window"></param>
        /// <param name="eventManager"></param>
        /// <exception cref="ArgumentNullException">
        ///   window is null
        ///   -or-
        ///   eventManager is null
        /// </exception>
        public InputManager(Window window, IEventManager eventManager)
        {
            if (window == null)
            {
                throw new ArgumentNullException("window");
            }
            if (eventManager == null)
            {
                throw new ArgumentNullException("eventManager");
            }

            m_window       = window;
            m_eventManager = eventManager;

            CanPause = true;
        }
Beispiel #48
0
        public HomePageLocalViewModel(IMainPage owner)
        {
            PageOwner         = owner;
            AddFolderCommand  = new DelegateCommand(AddFolderCommandAction);
            OpenFolderCommand = new DelegateCommand <VideoFolder>(OpenFolderCommandAction);

            IEventManager.GetEvent <NoFolderNoticeEventToken>().Subscribe((o) =>
            {
                HasNoFolderAction();
            });

            IEventManager.GetEvent <FolderItemChangeEventToken>().Subscribe((o) =>
            {
                RaisePropertyChanged(() => this.AllFoldersList);
            });
        }
        public OrionProjectileService(IEventManager events, ILogger log)
        {
            Debug.Assert(events != null);
            Debug.Assert(log != null);

            _events = events;
            _log    = log;

            // Note that the last projectile should be ignored, as it is not a real projectile.
            _projectiles = new WrappedReadOnlyList <OrionProjectile, Terraria.Projectile>(
                Terraria.Main.projectile.AsMemory(..^ 1),
                (projectileIndex, terrariaProjectile) => new OrionProjectile(projectileIndex, terrariaProjectile));

            OTAPI.Hooks.Projectile.PreSetDefaultsById = PreSetDefaultsByIdHandler;
            OTAPI.Hooks.Projectile.PreUpdate          = PreUpdateHandler;
        }
Beispiel #50
0
        public virtual void TestCancellationWithoutIgnore()
        {
            IEventManager manager = GetEventManager();

            manager.Subscribe <TestEvent>(GetListener(), (sender, @event) => @event.ValueChanged = true);

            TestEvent e = new TestEvent(EventExecutionTargetContext.Sync)
            {
                IsCancelled = true
            };

            EmitTestEvent(manager, e);

            Assert.AreEqual(false, e.ValueChanged,
                            "The subscription callback was called on a cancelled event when it shouldn't be");
        }
Beispiel #51
0
        public virtual void TestCancellationWithIgnore()
        {
            IEventManager manager = GetEventManager();

            manager.Subscribe <TestEvent>(GetListener(), CancelIgnoreEventHandler);

            TestEvent e = new TestEvent(EventExecutionTargetContext.Sync)
            {
                IsCancelled = true
            };

            EmitTestEvent(manager, e);

            Assert.AreEqual(true, e.ValueChanged,
                            "The subscription callback was not called on a cancelled event but it has IgnoreCancelled set to true");
        }
        public override void Initialize(XmlElement config, IEventManager eventManager, IProfile profile)
        {
            _filename = config["LogFile"].InnerText;

            base.Initialize(config,eventManager,profile);

            string folder = Path.GetDirectoryName(_filename);
            if (!Directory.Exists(folder))
                Directory.CreateDirectory(folder);

            _writer = new StreamWriter(_filename, true);
            _writer.AutoFlush = true;
            _writer.WriteLine(_majorsep);
            _writer.WriteLine("[Startup] Log opened {0}", DateTime.Now);
            _writer.WriteLine("[Startup] By {0}", Assembly.GetEntryAssembly().Location);
        }
Beispiel #53
0
        ///////////////////////////////////////////////////////////////////////

        public static bool ManagerIsOk(
            IEventManager eventManager
            ) /* THREAD-SAFE */
        {
            if (eventManager == null)
            {
                return(false);
            }

            if (eventManager.Disposed)
            {
                return(false);
            }

            return(true);
        }
Beispiel #54
0
        /// <summary>
        /// The main constructor of the class
        /// </summary>
        /// <param name="componentManager"></param>

        public EntityManager(IComponentManager componentManager)
        {
            mComponentManager = componentManager ?? throw new ArgumentNullException("componentManager");

            mEventManager = mComponentManager?.EventManager;

            mEntitiesList = new List <IEntity>();

            mNextFreeEntityId = new Queue <uint>();

            mDestroyedEntitiesList = new LinkedList <IEntity>();

            mEntitiesIdCounter = 0;

            mNumOfActiveEntities = 0;
        }
Beispiel #55
0
        public DownloadManager(IDownloadSettings downloadSettings,
                               IDownloadStreamManager downloadStreamManager,
                               INetworkProtocolProviderFactory networkProtocolProviderFactory,
                               IEventManager eventManager)
        {
            if (downloadSettings == null)
            {
                throw new ArgumentNullException("downloadSettings");
            }

            m_DownloadTaskList  = new DownloadTaskList();
            m_DownloadTaskQueue = new DownloadTaskQueue(downloadSettings.MaximumConcurrentDownloads);
            m_DownloadSettings  = downloadSettings;
            m_LocalFileDownloadStreamManager = downloadStreamManager;
            m_NetworkProtocolProviderFactory = networkProtocolProviderFactory;
            m_EventManager = eventManager;
        }
Beispiel #56
0
        public override void Initialize(XmlElement config, IEventManager eventManager, IProfile profile)
        {
            base.Initialize(config, eventManager, profile);
            changecomment = config[ChangeCommentField].InnerText;
            referencename = config[ReferenceAttributeField].InnerText;

            bool alwaysCreateValue = false;

            if (config[AlwaysCreateField] != null)
            {
                bool.TryParse(config[AlwaysCreateField].InnerText, out alwaysCreateValue);
            }
            alwaysCreate = alwaysCreateValue;

            VerifyMeta();
            eventManager.Subscribe(typeof(ChangeSetInfo), ChangeSetListener);
        }
Beispiel #57
0
 public void RemoveEventManager(IEventManager eventManager)
 {
     try
     {
         foreach (IEventManager mgr in _eventManagerList)
         {
             if (eventManager.managerId.Equals(mgr.managerId) == true)
             {
                 _eventManagerList.Remove(mgr);
                 break;
             }
         }
     }
     catch
     {
     }
 }
Beispiel #58
0
        ///////////////////////////////////////////////////////////////////////

        public static ReturnCode DoOneEvent(
            Interpreter interpreter,
            EventFlags eventFlags,
            EventPriority priority,
            int limit, /* NOTE: Pass zero for ALL. */
            bool stopOnError,
            bool errorOnEmpty,
            bool userInterface,
            ref int eventCount,
            ref Result result
            )
        {
            if (interpreter != null)
            {
                //
                // BUGFIX: Wrap in try/catch in case the interpreter is
                //         disposed (from WaitVariable).
                //
                try
                {
                    IEventManager eventManager = interpreter.EventManager;

                    if (ManagerIsOk(eventManager))
                    {
                        return(eventManager.DoOneEvent(
                                   eventFlags, priority, limit, stopOnError,
                                   errorOnEmpty, userInterface, ref eventCount,
                                   ref result));
                    }
                    else
                    {
                        result = "event manager not available";
                    }
                }
                catch (Exception e)
                {
                    result = e;
                }
            }
            else
            {
                result = "invalid interpreter";
            }

            return(ReturnCode.Error);
        }
Beispiel #59
0
 public void RemoveEventManager(IEventManager eventManager)
 {
     try
     {
         foreach (IEventManager eventManager2 in _eventManagerList)
         {
             if (eventManager.managerId.Equals(eventManager2.managerId))
             {
                 _eventManagerList.Remove(eventManager2);
                 break;
             }
         }
     }
     catch
     {
     }
 }
Beispiel #60
0
 public void RemoveCloseEventManager(IEventManager eventManager)
 {
     try
     {
         foreach (IEventManager closeEventManager in _closeEventManagerList)
         {
             if (eventManager.managerId.Equals(closeEventManager.managerId))
             {
                 _closeEventManagerList.Remove(closeEventManager);
                 break;
             }
         }
     }
     catch
     {
     }
 }