Ejemplo n.º 1
0
 /// <summary>
 /// Constructor. Creates instances.
 /// </summary>
 public SnakeController(Floor floor)
 {
     _parts                    = new SnakeParts();
     _moveController           = new SnakeMoveController(_parts);
     _snakeEatingSystem        = new SnakeEatingController(_parts);
     _snakeGrowingSystem       = new SnakeGrowingController(_parts);
     _snakeCollisionController = new SnakeCollisionController(_parts, floor);
 }
Ejemplo n.º 2
0
 public EventController(IMethod _SMethod,
                        IEvent _SEvent, IMinio _SMinio,
                        IUser _SUser, IEventDetail _SEventDetail, IEventParticipant _SEventParticipant,
                        IEventCategory _SEventCategory, ICategory _SCategory, IEventSponsor _SEventSponsor,
                        ISponsor _SSponsor, IUserInterest _SUserInterest,
                        INotificationDispatcher notificationDispatcher
                        )
     : base(_SMethod)
 {
     this._SEvent                = _SEvent;
     this._SMinio                = _SMinio;
     this._SUser                 = _SUser;
     this._SEventDetail          = _SEventDetail;
     this._SEventParticipant     = _SEventParticipant;
     this._SEventCategory        = _SEventCategory;
     this._SCategory             = _SCategory;
     this._SEventSponsor         = _SEventSponsor;
     this._SSponsor              = _SSponsor;
     this._SUserInterest         = _SUserInterest;
     this.notificationDispatcher = notificationDispatcher;
 }
Ejemplo n.º 3
0
        public NotificationService()
        {
            _connection                 = new Connection();
            emailVerificationQueues     = new Queue <EmailVerificationQueueModel>();
            emailVerificationLockObject = new object();

            passwordQueues     = new Queue <PasswordQueueModel>();
            passwordLockObject = new object();

            eventQueues     = new Queue <EventQueueModel>();
            eventLockObject = new object();

            eventParticipantRequestQueues = new Queue <EventParticipantRequestQueueModel>();
            eventParticipantLockObject    = new object();

            HubConnection connection = new HubConnectionBuilder().WithUrl(_connection.apiUrl + "/NotificationHub").Build();

            connection.StartAsync().ContinueWith(task =>
            {
                if (task.IsFaulted)
                {
                    Console.WriteLine(task.Exception);
                }
                else
                {
                    Console.WriteLine("SignalR Connected...");
                }
            });

            connection.On <EventQueueModel>("sendEventPushNotification", (item) =>
            {
                eventQueues.Enqueue(item);
            });

            connection.On <EmailVerificationQueueModel>("SendEmailVerification", (item) =>
            {
                emailVerificationQueues.Enqueue(item);
            });

            connection.On <PasswordQueueModel>("SendPassword", (item) =>
            {
                passwordQueues.Enqueue(item);
            });

            connection.On <EventParticipantRequestQueueModel>("sendEventParticipantRequest", (item) =>
            {
                eventParticipantRequestQueues.Enqueue(item);
            });

            emailVerificaitonTimer = new Timer(EmailVerificationTick, emailVerificationLockObject, TimeSpan.Zero, TimeSpan.FromSeconds(15));
            passwordTimer          = new Timer(PasswordTick, passwordLockObject, TimeSpan.Zero, TimeSpan.FromSeconds(15));
            eventTimer             = new Timer(EventTick, eventLockObject, TimeSpan.Zero, TimeSpan.FromSeconds(15));
            eventParticipantTimer  = new Timer(EventParticipantTick, eventParticipantLockObject, TimeSpan.Zero, TimeSpan.FromSeconds(60));

            _SSystemParameter  = new SSystemParameter(new DbContext());
            _SMethod           = new SMethod();
            _SEvent            = new SEvent(new DbContext());
            _SEventParticipant = new SEventParticipant(new DbContext());
            _SUser             = new SUser(new DbContext());


            List <SystemParameter> systemParameters = _SSystemParameter.GetSystemParameter();
            SmtpModel smtpModel = _SMethod.SystemParameterToObject <SmtpModel>(systemParameters);

            if (!String.IsNullOrEmpty(smtpModel.smtp_host))
            {
                _SSmtp = new SSmtp(smtpModel.smtp_host, smtpModel.smtp_port, smtpModel.smtp_sender, smtpModel.smtp_password);
            }
        }