public HomeController(IMemoryCache memoryCache,
                       IAsk ask,
                       ISettings settings,
                       IParticipation participation,
                       IDraws draws,
                       IHubContext <UpdateHub> hubContext,
                       UpdateHub hub,
                       IOptions <DrawSettings> drawSettings,
                       IOptions <SetupSettings> setupSettings,
                       IOptions <FeaturesSettings> featuresSettings,
                       IOptions <ColdStakingSettings> coldStakingSettings)
 {
     _memoryCache         = memoryCache;
     _ask                 = ask;
     _settings            = settings;
     _participation       = participation;
     _draws               = draws;
     _hub                 = hub;
     _hubContext          = hubContext;
     _drawSettings        = drawSettings.Value;
     _setupSettings       = setupSettings.Value;
     _tickerSettings      = tickerSettings.Value;
     _featuresSettings    = featuresSettings.Value;
     _coldStakingSettings = coldStakingSettings.Value;
 }
        public SimulationManager(ISettings settings, UpdateHub updateHub)
        {
            mainLock       = new object();
            this.settings  = settings;
            this.updateHub = updateHub;


            TypeContainer.Register <ExtensionLoader>(InstanceBehaviour.Singleton);
            TypeContainer.Register <IExtensionLoader, ExtensionLoader>(InstanceBehaviour.Singleton);
            TypeContainer.Register <IExtensionResolver, ExtensionLoader>(InstanceBehaviour.Singleton);
            TypeContainer.Register <DefinitionManager>(InstanceBehaviour.Singleton);
            TypeContainer.Register <IDefinitionManager, DefinitionManager>(InstanceBehaviour.Singleton);
            TypeContainer.Register <DiskPersistenceManager>(InstanceBehaviour.Singleton);
            TypeContainer.Register <IPersistenceManager, DiskPersistenceManager>(InstanceBehaviour.Singleton);
            TypeContainer.Register <ResourceManager>(InstanceBehaviour.Singleton);
            TypeContainer.Register <IResourceManager, ResourceManager>(InstanceBehaviour.Singleton);

            extensionLoader = TypeContainer.Get <ExtensionLoader>();
            extensionLoader.LoadExtensions();

            ResourceManager = TypeContainer.Get <ResourceManager>();
            ResourceManager.InsertUpdateHub(updateHub);

            Service    = new GameService(ResourceManager);
            simulation = new Simulation(ResourceManager, extensionLoader, Service)
            {
                IsServerSide = true
            };
            backgroundThread = new Thread(SimulationLoop)
            {
                Name         = "Simulation Loop",
                IsBackground = true
            };
        }
        public SimulationManager(ISettings settings, UpdateHub updateHub)
        {
            mainLock = new object();

            this.settings = settings; //TODO: Where are the settings?

            extensionLoader = new ExtensionLoader(settings);
            extensionLoader.LoadExtensions();

            definitionManager = new DefinitionManager(extensionLoader);

            var persistenceManager = new DiskPersistenceManager(extensionLoader, definitionManager, settings);

            ResourceManager = new ResourceManager(extensionLoader, definitionManager, settings, persistenceManager);
            ResourceManager.InsertUpdateHub(updateHub);

            chunkSubscription = updateHub.Subscribe(ResourceManager.GlobalChunkCache, DefaultChannels.Chunk);
            ResourceManager.GlobalChunkCache.InsertUpdateHub(updateHub);
            Service    = new GameService(ResourceManager);
            simulation = new Simulation(ResourceManager, extensionLoader, Service)
            {
                IsServerSide = true
            };
            backgroundThread = new Thread(SimulationLoop)
            {
                Name         = "Simulation Loop",
                IsBackground = true
            };
        }
Exemple #4
0
        protected void lbConfirm_Click(object sender, EventArgs e)
        {
            try
            {
                int cid = Convert.ToInt32(ViewState["cid"]);
                int sid = Convert.ToInt32(ViewState["sid"]);

                SalitaEntities db = new SalitaEntities();

                CustomerNeed N = new CustomerNeed();

                N.Canceled            = false;
                N.Customer_ID         = cid;
                N.Note                = this.txtNote.Value;
                N.RequestDateTime     = DateTime.Now;
                N.RequestedService_ID = sid;
                N.WasFullfilled       = false;

                db.CustomerNeeds.Add(N);

                UpdateHub.SendServer("");

                Response.Redirect("request_service_feedback.aspx");
            }
            catch (Exception E)
            {
                this.CustomValidator1.ErrorMessage = E.Message;
                this.CustomValidator1.IsValid      = false;
            }
        }
Exemple #5
0
            public void BroadcastRefresh(OrganizationEntity org, DeviceEntity device = null)
            {
                var context   = _connectionManager.GetHubContext <UpdateHub>();
                var groupName = UpdateHub.GetGroupName(org, device) ?? UpdateHub.GetGroupName(org);

                log.DebugFormat("Broadcasting update to {0} for {1}", groupName, device?.Id);

                context.Clients.Group(groupName).RefreshAll();
            }
Exemple #6
0
            public void BroadcastDeviceChange(OrganizationEntity org, DeviceEntity device)
            {
                var context   = _connectionManager.GetHubContext <UpdateHub>();
                var groupName = UpdateHub.GetGroupName(org, device);

                log.DebugFormat("Broadcasting update to {0} for {1}", groupName, device.Id);

                context.Clients.Group(groupName).DeviceChanged(device.Id);
            }
Exemple #7
0
            public void BroadcastUpdate(OrganizationEntity org, IRoom room)
            {
                var context   = _connectionManager.GetHubContext <UpdateHub>();
                var groupName = UpdateHub.GetGroupName(org, room);

                log.DebugFormat("Broadcasting update to {0} for {1}", groupName, room.Id);

                context.Clients.Group(groupName).Update(room.Id);
            }
 public UpdateInfosService(IMemoryCache memoryCache, UpdateHub hub, IHubContext <UpdateHub> hubContext, IOptions <NakoApiSettings> nakoApiSettings, IOptions <TickerSettings> tickerSettings)
 {
     _memoryCache     = memoryCache;
     _hub             = hub;
     _hubContext      = hubContext;
     _updateTimer     = new System.Timers.Timer();
     _nakoApiSettings = nakoApiSettings.Value;
     _tickerSettings  = tickerSettings.Value;
 }
Exemple #9
0
        public async Task Handle(FriendInvitationReceivedEvent @event)
        {
            var notificationHub = new NotificationHub(_notificationHubContext);
            var updateHub       = new UpdateHub(_updateHubContext);

            await notificationHub.BroadcastNotification(@event.UserId, "Friend invitation received",
                                                        $"User {@event.FriendName} sent you an invitation to become friends");

            await updateHub.UpdateFriendRequests(@event.UserId);
        }
Exemple #10
0
        public async Task Handle(FriendInvitationAcceptedEvent @event)
        {
            var notificationHub = new NotificationHub(_notificationHubContext);
            var updateHub       = new UpdateHub(_updateHubContext);

            await notificationHub.BroadcastNotification(@event.UserId, "Invitation accepted",
                                                        $"User {@event.FriendName} is now a friend");

            await updateHub.UpdateFriends(@event.UserId);
        }
        public ServerHandler(ISettings settings)
        {
            logger = LogManager.GetCurrentClassLogger();

            var updateHub = new UpdateHub();

            UpdateHub = updateHub;

            server = new Server();

            SimulationManager = new SimulationManager(settings, updateHub);
            defaultManager    = new DefaultCommandManager <ushort, CommandParameter, byte[]>(typeof(ServerHandler).Namespace + ".Commands");
        }
 public HomeController(IMemoryCache memoryCache,
                       IAsk ask,
                       IHubContext <UpdateHub> hubContext,
                       UpdateHub hub,
                       IOptions <SetupSettings> setupSettings,
                       IOptions <FeaturesSettings> featuresSettings,
                       IOptions <ColdStakingSettings> coldStakingSettings)
 {
     _memoryCache         = memoryCache;
     _ask                 = ask;
     _hub                 = hub;
     _hubContext          = hubContext;
     _setupSettings       = setupSettings.Value;
     _featuresSettings    = featuresSettings.Value;
     _coldStakingSettings = coldStakingSettings.Value;
 }
        public DataUpdateService(
            BlockIndexService blockIndexService,
            TickerService tickerService,
            CurrencyService currencyService,
            IMemoryCache memoryCache,
            UpdateHub hub,
            IHubContext <UpdateHub> hubContext,
            IOptions <NakoSettings> nakoSettings,
            IOptions <TickerSettings> tickerSettings)
        {
            _tickerService     = tickerService;
            _blockIndexService = blockIndexService;
            _memoryCache       = memoryCache;
            _hub             = hub;
            _hubContext      = hubContext;
            _nakoApiSettings = nakoSettings.Value;
            _tickerSettings  = tickerSettings.Value;
            _currencyService = currencyService;

            _nakoTimer     = new System.Timers.Timer();
            _tickerTimer   = new System.Timers.Timer();
            _currencyTimer = new System.Timers.Timer();
        }