Ejemplo n.º 1
0
 public PerformUpdateHandler(IStateHandler stateHandler,
                             IContentInstallationService contentInstallation, IUpdateHandler updateHandler)
 {
     _stateHandler        = stateHandler;
     _contentInstallation = contentInstallation;
     _updateHandler       = updateHandler;
 }
Ejemplo n.º 2
0
 public GameSwitcher(IDbContextLocator locator, ISetupGameStuff setup, IGameLocker locker,
     IStateHandler stateHandler) {
     _locator = locator;
     _setup = setup;
     _locker = locker;
     _stateHandler = stateHandler;
 }
Ejemplo n.º 3
0
 public GameSwitcher(IDbContextLocator locator, ISetupGameStuff setup, IGameLocker locker,
                     IStateHandler stateHandler)
 {
     _locator      = locator;
     _setup        = setup;
     _locker       = locker;
     _stateHandler = stateHandler;
 }
Ejemplo n.º 4
0
        public static async Task <T> LoadAndSaveAsync <T>(this IStateHandler <T> stateHandler)
        {
            var state = await stateHandler.LoadAsync();

            await stateHandler.SaveAsync();

            return(state);
        }
Ejemplo n.º 5
0
 public static void Register(IStateHandler controller, params string[] names)
 {
     foreach (var name in names)
     {
         if (_list.ContainsKey(name))
         {
             continue;
         }
         _list.Add(name, controller);
     }
 }
        public WindowsSession()
        {
            IDeviceList list = new DeviceList();

            list.Scan();
            IDevice device = list.First() ?? throw new ApplicationException("Could not find a device");

            this.stateHandler = new StateHandler.StateHandler(device, FocusState.Low, PhysicalPresence.Present);

            this.Initialize();
        }
Ejemplo n.º 7
0
        public Worker(IConfiguration config, IStateHandler sessionStateHandler, IDatabaseConnector databaseConnector,
                      IMessageReceiver trainPathReceiver, ITrainPathSender trainPathSender, ILogger <Worker> logger)
            : base(config, sessionStateHandler, databaseConnector, logger, Assembly.GetExecutingAssembly())
        {
            this.sessionStateHandler.SessionChangedEvent += OnSessionChangedAsync;

            this.trainPathReceiver = trainPathReceiver;
            this.trainPathReceiver.MessageReceivedEvent += OnMessageReceived;

            this.trainPathSender = trainPathSender;
        }
Ejemplo n.º 8
0
        public void AddHandler(IStateHandler handler)
        {
            if (handler == null) throw new ArgumentNullException("handler");
            if (handler.StateName == null) throw new ArgumentException("The StateName property of the given state handler must be non null.", "handler");

            if (!_handlers.ContainsKey(handler.StateName))
            {
                _handlers.Add(handler.StateName, new List<IStateHandler>());    
            }

            _handlers[handler.StateName].Add(handler);
        }
Ejemplo n.º 9
0
 public SetupGameStuff(IDbContextLocator locator, IDbContextFactory factory,
     INetworkContentSyncer networkContentSyncer, /* ICacheManager cacheMan, */
     IGameLocker gameLocker, IStateHandler stateHandler, IAssemblyService ass) {
     _locator = locator;
     _factory = factory;
     _networkContentSyncer = networkContentSyncer;
     //_cacheMan = cacheMan;
     _gameLocker = gameLocker;
     _stateHandler = stateHandler;
     _timer = new TimerWithElapsedCancellationAsync(TimeSpan.FromMinutes(30), onElapsedNonBool: OnElapsed);
     _gameFactory = new GameFactory(ass);
 }
Ejemplo n.º 10
0
 public SetupGameStuff(IDbContextLocator locator, IDbContextFactory factory,
                       INetworkContentSyncer networkContentSyncer, /* ICacheManager cacheMan, */
                       IGameLocker gameLocker, IStateHandler stateHandler, IAssemblyService ass)
 {
     _locator = locator;
     _factory = factory;
     _networkContentSyncer = networkContentSyncer;
     //_cacheMan = cacheMan;
     _gameLocker   = gameLocker;
     _stateHandler = stateHandler;
     _timer        = new TimerWithElapsedCancellationAsync(TimeSpan.FromMinutes(30), onElapsedNonBool: OnElapsed);
     _gameFactory  = new GameFactory(ass);
 }
Ejemplo n.º 11
0
 public MainViewModel(IHue hue, IImage img, IStateHandler handler)
 {
     _img                  = img;
     _hue                  = hue;
     _handler              = handler;
     _handler.ColorUpdate += _handler_ColorUpdate;
     _hue.StatusUpdate    += _hue_StatusUpdate;
     Task.Factory.StartNew(async() =>
     {
         await _hue.Init();
         Groups = await _hue.GetGroups();
     });
 }
        public async Task <ITransitionValidationResult> IsPreconditionOk()
        {
            if (TransitionToInvoke == null)
            {
                throw new TransitionNotSpecifiedException();
            }
            var transition = GetRequestedTransition;
            IStateHandler <TEntity> transitionHandler = transition.OnTransitioning.Invoke();

            if (transitionHandler is IPrevalidation <TEntity> prevalidation)
            {
                return(await prevalidation.OnValidating(StatedEntity).ConfigureAwait(false));
            }
            return(new TransitionValidationSuccessful());
        }
Ejemplo n.º 13
0
        public Worker(IConfiguration config, IStateHandler sessionStateHandler, IMessageReceiver positionsReceiver,
                      IDatabaseConnector databaseConnector, IRealtimeSender realtimeSender, ILogger <Worker> logger)
            : base(config, sessionStateHandler, databaseConnector, logger, Assembly.GetExecutingAssembly())
        {
            this.sessionStateHandler.SessionStartedEvent += OnSessionStart;

            this.positionsReceiver = positionsReceiver;
            this.positionsReceiver.MessageReceivedEvent += OnMessageReceived;

            this.realtimeSender = realtimeSender;

            converter = new Message2TrainLeg(
                config: config,
                logger: logger,
                ivuSessionDate: ivuSessionDate);
        }
Ejemplo n.º 14
0
        protected WorkerBase(IConfiguration config, IStateHandler sessionStateHandler,
                             IDatabaseConnector databaseConnector, ILogger logger, Assembly assembly)
        {
            var assemblyInfo = assembly.GetName();

            logger.LogInformation(
                "{name} (Version {version}) wird gestartet.",
                assemblyInfo.Name,
                $"{assemblyInfo.Version.Major}.{assemblyInfo.Version.Minor}");

            this.config = config;
            this.logger = logger;

            this.sessionStateHandler = sessionStateHandler;
            this.sessionStateHandler.SessionChangedEvent += OnSessionChanged;

            this.databaseConnector = databaseConnector;
        }
Ejemplo n.º 15
0
        public void AddHandler(IStateHandler handler)
        {
            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }
            if (handler.StateName == null)
            {
                throw new ArgumentException("The StateName property of the given state handler must be non null.", nameof(handler));
            }

            if (!_handlers.ContainsKey(handler.StateName))
            {
                _handlers.Add(handler.StateName, new List <IStateHandler>());
            }

            _handlers[handler.StateName].Add(handler);
        }
Ejemplo n.º 16
0
 public SimpleTestConnector(IDeviceConnector connector, IStateHandler stateHandler)
 {
     _stateHandler = stateHandler;
     _connector    = connector;
 }
Ejemplo n.º 17
0
 public ClockController(IStateHandler stateHandler, IThreadHandler threadHandler)
 {
     _threadHandler = threadHandler;
     _stateHandler  = stateHandler;
 }
 public WebApiErrorHandler(IStateHandler api) {
     _api = api;
 }
 public NotificationProviderHandler(IDbContextLocator dbContextLocator,
                                    IEnumerable <INotificationProvider> notifiers, IStateHandler stateHandler) : base(dbContextLocator)
 {
     _notifiers    = notifiers;
     _stateHandler = stateHandler;
 }
Ejemplo n.º 20
0
 public ResetLogic(IDeviceConnector deviceConnector, IStateHandler stateHandler)
 {
     _stateHandler = stateHandler;
     _connector    = deviceConnector;
 }
Ejemplo n.º 21
0
 public SimpleClockLogic(IDrawSinglePixel drawer, IStateHandler stateHandler, IResetLogic resetLogic)
 {
     _drawer       = drawer;
     _stateHandler = stateHandler;
     _resetLogic   = resetLogic;
 }
Ejemplo n.º 22
0
 public ActionDispatcher(IMediator mediator, IStateHandler stateHandler)
 {
     _mediator     = mediator;
     _stateHandler = stateHandler;
 }
			private Exception ExecuteState (IStateHandler state, ref bool readysync)
			{
				Exception lasterror = null;
				try {
					if (state.PossibleToTimeout) {
						_app.Context.BeginTimeoutPossible ();
					}

					try {
						state.Execute ();	
					} finally {
						if (state.PossibleToTimeout) {
							_app.Context.EndTimeoutPossible ();
						}
					}
#if TARGET_J2EE		//Catch case of aborting by timeout
					if (_app.Context.TimedOut) {
						_app.CompleteRequest ();
						return null;
					}
#endif
					if (state.PossibleToTimeout) {
						// Async Execute
						_app.Context.TryWaitForTimeout ();
					}

					readysync = state.CompletedSynchronously;
#if TARGET_J2EE		// Finishing execution for End without error
				}catch ([email protected]){
					lasterror = null;
					_app.CompleteRequest ();
#endif
				} catch (ThreadAbortException obj) {
					object o = obj.ExceptionState;
					Type type = (o != null) ? o.GetType () : null;
					if (type == typeof (StepTimeout)) {
						Thread.ResetAbort ();
						lasterror = new HttpException ("The request timed out.");
						_app.CompleteRequest ();
					} else if (type == typeof (StepCompleteRequest)) {
						Thread.ResetAbort ();
						_app.CompleteRequest ();
					}
				} catch (Exception obj) {
#if TARGET_J2EE
					lasterror = HandleJavaException(obj);
#else
					lasterror = obj;
#endif
				}

				return lasterror;
			}
Ejemplo n.º 24
0
 public void Transfer(IStateContext <TKey, TValue> context, IStateHandler <TKey, TValue> handler)
 {
     this.OnTransfering(context);
     this.OnTransfer(context, handler);
     this.OnTransferred(context);
 }
Ejemplo n.º 25
0
 public Worker(IConfiguration config, IStateHandler sessionStateHandler, IDatabaseConnector databaseConnector,
               ICrewChecker crewChecker, ILogger <Worker> logger)
     : base(config, sessionStateHandler, databaseConnector, logger, Assembly.GetExecutingAssembly())
 {
     this.crewChecker = crewChecker;
 }
Ejemplo n.º 26
0
 protected virtual void OnTransfer(IStateContext <TKey, TValue> context, IStateHandler <TKey, TValue> handler)
 {
     handler.Handle(context);
 }
Ejemplo n.º 27
0
 public GetStateHandler(IDbContextLocator dbContextLocator, IGameLockMonitor monitor, IStateHandler stateHandler)
     : base(dbContextLocator)
 {
     _monitor      = monitor;
     _stateHandler = stateHandler;
 }
Ejemplo n.º 28
0
 public GetClientInfoHandler(IStateHandler stateHandler)
 {
     _stateHandler = stateHandler;
 }
Ejemplo n.º 29
0
 public StateManager()
 {
     Listener = new StateListener();
     _handler = Listener;
 }
Ejemplo n.º 30
0
 public ResolveUserErrorHandler(IDbContextLocator dbContextLocator, IStateHandler handler)
     : base(dbContextLocator)
 {
     _handler = handler;
 }
Ejemplo n.º 31
0
 public ClientHandler(IStateHandler stateHandler)
 {
     _stateHandler = stateHandler;
 }
Ejemplo n.º 32
0
 public StatesController(IStateHandler stateHandler)
 {
     _stateHandler = stateHandler;
 }
Ejemplo n.º 33
0
 public SelfUpdateHandler(ISquirrelApp squirrel, IDbContextFactory contextFactory, IStateHandler stateHandler)
 {
     _squirrel       = squirrel;
     _contextFactory = contextFactory;
     _stateHandler   = stateHandler;
 }
Ejemplo n.º 34
0
 public WebApiErrorHandler(IStateHandler api)
 {
     _api = api;
 }
Ejemplo n.º 35
0
 public MainThreadHandler(IClockLogic clockLogic, ITestConnector testConnector, IStateHandler stateHandler)
 {
     _stateHandler  = stateHandler;
     _clockLogic    = clockLogic;
     _testConnector = testConnector;
 }