Exemplo n.º 1
0
 public AirportEngine(IScheduleProvider scheduleProvider, ITimeManager timeManager, IPlaneCapacityProvider planeCapacityProvider)
 {
     _scheduleProvider      = scheduleProvider;
     _timeManager           = timeManager;
     _planeCapacityProvider = planeCapacityProvider;
     _timeManager.Tick     += OnTimeManagerTick;
 }
Exemplo n.º 2
0
        public Main()
        {
            _settingsManager = Factories.CreateSettingsManager();
            _logger          = LoggerFactory.Create(_settingsManager.LogFilePath);

            this._timeManager = ServiceFactory.CreateTimeManager(_settingsManager.GetSettingValue(AppSettingsKey.Begin),
                                                                 _settingsManager.GetSettingValue(AppSettingsKey.End));

            InitializeComponent();

            CheckBasicSettings();
            InitBasicUI();
            if (!_basicSettingOK)
            {
                OnEditConfig(null, null);
                return;
            }

            InitOrderMaker();

            if (!HasTradeSettings)
            {
                this.tpStrategy.Controls.Add(UIHelpers.CreateLabel("您還沒有設定策略. 請先設定策略才可同步下單.", Color.Red, DockStyle.Fill), 0, 0);
            }
            else
            {
                this.tpStrategy.Controls.Add(UIHelpers.CreateLabel("策略設定", Color.Black, DockStyle.Fill), 0, 0);
            }

            InitStrategyUI();
        }
Exemplo n.º 3
0
 public SnapshotMessageHandler(ISnapshotSelector pool, ClientUpdateLatestManager clientUpdateMgr,
                               ITimeManager timeManager)
 {
     _pool            = pool;
     _timeManager     = timeManager;
     _clientUpdateMgr = clientUpdateMgr;
 }
Exemplo n.º 4
0
        public UcStatus(ISettingsManager settingsManager, ITimeManager timeManager, IOrderMaker orderMaker, ILogger logger)
        {
            this._settingsManager = settingsManager;
            this._timeManager     = timeManager;
            this._orderMaker      = orderMaker;
            this._logger          = logger;

            InitializeComponent();

            #region  UI
            this.labelOpenTime.Dock = DockStyle.Fill;
            this.tablePanel.Controls.Add(this.labelOpenTime, 0, 0);

            this.labelCloseTime.Dock = DockStyle.Fill;
            this.tablePanel.Controls.Add(this.labelCloseTime, 1, 0);

            this.labelTime.Dock = DockStyle.Fill;
            this.tablePanel.Controls.Add(this.labelTime, 0, 1);

            this.labelStatus.Width     = 120;
            this.labelStatus.TextAlign = ContentAlignment.MiddleLeft;
            this.tablePanel.Controls.Add(this.labelStatus, 1, 1);

            this.labelSource.Width     = 120;
            this.labelSource.TextAlign = ContentAlignment.MiddleLeft;
            this.tablePanel.Controls.Add(this.labelSource, 0, 2);
            #endregion

            this.timerDisplay.Interval = 1000;              //只負責顯示時間
            this.timerDisplay.Enabled  = true;
        }
Exemplo n.º 5
0
 public SnapshotMessageHandler(ISnapshotPool pool, IUpdateLatestHandler updateLatestHandler,
                               ITimeManager timeManager)
 {
     _pool                = pool;
     _timeManager         = timeManager;
     _updateLatestHandler = updateLatestHandler;
 }
Exemplo n.º 6
0
 /// <summary>
 /// 构建一个计时器管理器
 /// </summary>
 /// <param name="timeManager">时间管理器</param>
 public TimerManager(ITimeManager timeManager)
 {
     Guard.Requires <ArgumentNullException>(timeManager != null);
     this.timeManager = timeManager;
     executeList      = new SortSet <TimerQueue, int>();
     timerQueue       = new Stack <TimerQueue>();
 }
Exemplo n.º 7
0
 public SimulateScenarioItem(ISimulateable simulator, float duration, ITimeManager timeManager = null, Callback callback = null)
 {
     this.simulator   = simulator;
     this.duration    = duration;
     this.callback    = callback;
     this.timeManager = timeManager ?? TimeUtils.TimeManager.Instance;
 }
Exemplo n.º 8
0
 public OrderService(IOrderManager orderManager, ICustomerManager customerManager, ITimeManager timeManager, ICateringManager cateringManager)
 {
     _orderManager    = orderManager;
     _customerManager = customerManager;
     _timeManager     = timeManager;
     _cateringManager = cateringManager;
 }
        public WebPageNavigator(IWebDriver driver, ITimeManager timeManager)
        {
            this.driver      = driver ?? throw new ArgumentNullException(ExceptionConstants.WEB_DRIVER);
            this.timeManager = timeManager ?? throw new ArgumentNullException(ExceptionConstants.TIME_MANAGER);

            this.driver.Manage().Window.Maximize();
        }
 public void SetUp()
 {
     _repository        = Substitute.For <IListRepository>();
     _timeManager       = Substitute.For <ITimeManager>();
     _getItemService    = Substitute.For <IGetItemService>();
     _updateItemService = new UpdateItemService(_repository, _timeManager, _getItemService);
 }
 public void SetUp()
 {
     _repository        = Substitute.For <IListRepository>();
     _timeManager       = Substitute.For <ITimeManager>();
     _guidGenerator     = Substitute.For <IIdGenerator <Guid> >();
     _createItemService = new CreateItemService(_repository, _guidGenerator, _timeManager);
 }
Exemplo n.º 12
0
 public GameContext(IEntityManager entityManager, ITimeManager timeManager)
 {
     this.RandomGeneratorManager = new RandomGeneratorManager();
     this.EntityManager          = entityManager;
     this.TimeManager            = timeManager;
     this.player = null;
 }
Exemplo n.º 13
0
        public bool Start(string[] args, IFlatFileLoader _flatFileLoader, ITimeManager _timeManager, IDataMonitorManager _sqldManager)
        {
            PerfTimer hptStartup = new PerfTimer();
            hptStartup.Start();

            flatFileLoader = _flatFileLoader;
            timeManager = _timeManager;
            dmManager = _sqldManager;

            this.CanStop = true;
            this.CanShutdown = true;

            log.Info("Starting BITS State Manager service...");

            log.Info("Establishing connection to NB service...");
            if (ExecutionEngine.InstanceOf().EstablishBrokerConnections() == false)
            {
                log.Error("Cannot connect to NB service.  Quitting...");
                return false;
            }

            log.Info("Creating Module Factory instance...");
            ModuleFactory mFactory = new ModuleFactory();

            log.Info("Starting to load Module type definitions...");
            LoadAdapters();
            //AutoLoadAdapters(AppDomain.CurrentDomain.BaseDirectory + "modules");

            log.Info("Looking for startup jobs to build...");
            ExecuteStartupJobs();

            hptStartup.Stop();
            log.InfoFormat("BITS State Manager service has started in {0} seconds.", hptStartup.Duration);
            return true;
        }
Exemplo n.º 14
0
 public DefaultHistoryProvider(ITimeManager time, int depth) : base(
         time,
         (name) => $".{name}.history",
         (name, dt) => $"{new DateTimeOffset(dt).ToUnixTimeSeconds()}.{name}",
         depth
         )
 {
 }
 public SoundResourcesLoadSystem(Contexts contexts, SoundParentController soundParentController) : base(contexts.sound)
 {
     _soundPlayer           = contexts.session.clientSessionObjects.SoundPlayer;
     _timeManager           = contexts.session.clientSessionObjects.TimeManager;
     _playerContext         = contexts.player;
     _bulletContext         = contexts.bullet;
     _soundParentController = soundParentController;
 }
Exemplo n.º 16
0
 public AggregationService(IAgregationManager agregationManager, ITimeManager timeManager, ITagManager tagManager, ICateringManager cateringManager, ICustomerManager customerManager)
 {
     _agregationManager = agregationManager;
     _timeManager       = timeManager;
     _tagManager        = tagManager;
     _cateringManager   = cateringManager;
     _customerManager   = customerManager;
 }
 public DebtCollectionServiceCustom(ISubscriberManager subscriberManager, IDebtManager debtManager, IRecordingManager recordingManager,
                                    IMessagingManager messagingManager, ITimeManager timeManager, IDebtCollectionSchemeFactory schemeFactory,
                                    IServiceMessageFactory serviceMessageFactory, DebtCollectionServiceSettings settings, Simbrella.Framework.Logging.Abstractions.ILogger legacyLogger,
                                    ILoggerProvider loggerProvider, IMQProvider mqProvider)
     : base(subscriberManager, debtManager, recordingManager, messagingManager, timeManager, schemeFactory, serviceMessageFactory, settings,
            legacyLogger, loggerProvider, mqProvider)
 {
     _debtManager = (DebtManagerCustom)debtManager;
 }
Exemplo n.º 18
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="timeManager">TimeManager implementation that this instance uses</param>
        public PasswordManager(ITimeManager timeManager)
        {
            if (timeManager == null)
            {
                throw new Exception("Must set a valid TimeManager implementation");
            }

            _timeManager = timeManager;
        }
Exemplo n.º 19
0
 public TimeController(ILogger <TimeController> logger,
                       IHttpContextAccessor httpContextAccessor,
                       IMapper mapper,
                       ITimeManager timeManager)
 {
     _logger = logger;
     _httpContextAccessor = httpContextAccessor;
     _mapper      = mapper;
     _timeManager = timeManager;
 }
Exemplo n.º 20
0
        List <BackupTask> CreateTasks(BackupUtilityConfiguration config, ITimeManager time)
        {
            var tasks = new List <BackupTask>();

            foreach (var backup in config.Backup)
            {
                var sourceFs = CreateFileManager(config.Sftp, backup.From.Mode, backup.From.Host);
                if (sourceFs == null)
                {
                    return(null);
                }
                var destFs = CreateFileManager(config.Sftp, backup.To.Mode, backup.To.Host);
                if (destFs == null)
                {
                    return(null);
                }
                var fromPathes = backup.From.Pathes;
                if (fromPathes.Count == 0)
                {
                    fromPathes = new List <string> {
                        backup.From.Path
                    };
                }
                foreach (var path in fromPathes)
                {
                    if (string.IsNullOrEmpty(path))
                    {
                        WriteLineWithColor("Empty source path!", ConsoleColor.Red);
                        return(null);
                    }
                    if (string.IsNullOrEmpty(backup.To.Path))
                    {
                        WriteLineWithColor("Empty destination path!", ConsoleColor.Red);
                        return(null);
                    }
                    var sourceCachePath  = path + ".md5.cache";
                    var sourceFilesRange = sourceFs is SftpFileManager ? 128 : 1024;
                    var sourceHasher     = new CachedFileHasher(new DirectFileHasher(sourceFs), sourceFs, sourceCachePath, sourceFilesRange, true);
                    var sourceDirName    = sourceFs.GetDirectoryName(path);
                    var cachePath        = destFs.CombinePath(backup.To.Path, sourceDirName + ".md5.cache");
                    var destFilesRange   = destFs is SftpFileManager ? 128 : 1024;
                    var destHasher       = new CachedFileHasher(new DirectFileHasher(destFs), destFs, cachePath, destFilesRange, false);
                    var task             = new BackupTask(
                        path,
                        backup.To.Path,
                        sourceFs,
                        destFs,
                        new DefaultHistoryProvider(time, 3),
                        new FileChangeValidator(sourceHasher, destHasher)
                        );
                    tasks.Add(task);
                }
            }
            return(tasks);
        }
Exemplo n.º 21
0
        public ProcessDetailPresenter(ITimeManager timeManager,
                                      IProcessInfoControl view, ILoggerFactory loggerFactory)
        {
            _timeManager   = timeManager;
            _view          = view;
            _loggerFactory = loggerFactory;

            _ctoken = new CancellationTokenSource();

            _view.ProcessInfoControlClick           += _view_ProcessInfoControlClick;
            _view.ProcessInfoControlHandleDestroyed += _view_ProcessInfoControlHandleDestroyed;
        }
Exemplo n.º 22
0
        public Uc_Strategy(IOrderMaker orderMaker, TradeSettings settings, ITimeManager timeManager, ILogger logger)
        {
            this._orderMaker    = orderMaker;
            this._tradeSettings = settings;
            this._timeManager   = timeManager;
            this._logger        = logger;

            InitializeComponent();

            if (!File.Exists(_tradeSettings.FileName))
            {
                File.Create(_tradeSettings.FileName).Close();
            }
            _positionFile    = new PositionFile();
            _positionManager = ServiceFactory.CreatePositionManager(_orderMaker, _tradeSettings, logger);

            this.timer.Interval = _tradeSettings.Interval;
            this.timer.Enabled  = true;

            #region  UI
            var lbl = UIHelpers.CreateLabel(_tradeSettings.Name);
            lbl.Font = new System.Drawing.Font("新細明體", 11.25F);
            this.tpTop.Controls.Add(lbl, 0, 0);


            this.tpTop.Controls.Add(UIHelpers.CreateLabel("即時部位:"), 2, 0);
            lblPosition = UIHelpers.CreateLabel("");
            this.tpTop.Controls.Add(lblPosition, 3, 0);


            lblTime = UIHelpers.CreateLabel("");
            this.tpTop.Controls.Add(lblTime, 4, 0);


            for (int i = 0; i < _tradeSettings.Accounts.Count; i++)
            {
                var item = _tradeSettings.Accounts[i];

                var uc_Account = new Uc_Account();
                uc_Account.BindData(item);

                this.uc_AccountList.Add(uc_Account);


                fpanelAccounts.Height += uc_Account.Height;
                this.fpanelAccounts.Controls.Add(uc_Account);
                fpanelAccounts.Controls.SetChildIndex(uc_Account, 0);


                this.Height += uc_Account.Height;
            }
            #endregion
        }
Exemplo n.º 23
0
 /// <summary>
 /// Initialize history provider which allows to store several copies of file
 /// </summary>
 /// <param name="fileNameToDirectoryConverter">
 /// How to convert input file name to backup directory, when several copies is required
 /// </param>
 /// <param name="fileNameToVersionedFileName">
 /// How to convert input file name to file name inside history directory
 /// </param>
 /// <param name="historyDepth">
 /// How many copies we need to store
 /// </param>
 public HistoryProvider(
     ITimeManager time,
     Func <string, string> fileNameToDirectoryConverter,
     Func <string, DateTime, string> fileNameToVersionedFileName,
     int historyDepth
     )
 {
     _time          = time;
     _dirConverter  = fileNameToDirectoryConverter;
     _fileConverter = fileNameToVersionedFileName;
     Depth          = historyDepth;
 }
Exemplo n.º 24
0
        public UserCmdCollectSystem(Contexts contexts)
        {
            _sessionObjects = contexts.session.clientSessionObjects;

            _timeManager         = _sessionObjects.TimeManager;
            _generator           = _sessionObjects.UserCmdGenerator;
            _vehicleCmdGenerator = new UnityVehicleCmdGenerator(contexts.userInput.userInputManager.Instance);
            _playerContext       = contexts.player;

            _simulationTimer = _sessionObjects.SimulationTimer;

            _contexts = contexts;
        }
Exemplo n.º 25
0
        // Constructor
        public Engine(IAssetManager assetManager, IInputManager inputManager, IScreenManager screenManager,
                      ITimeManager timeManager, ISceneManager sceneManager, IRenderManager renderManager, IDebugManager debugManager)
        {
            // Managers
            _assetManager  = assetManager as IAssetManagerInternal;
            _inputManager  = inputManager as IInputManagerInternal;
            _screenManager = screenManager as IScreenManagerInternal;
            _timeManager   = timeManager as ITimeManagerInternal;
            _sceneManager  = sceneManager as ISceneManagerInternal;
            _renderManager = renderManager as IRenderManagerInternal;
            _debugManager  = debugManager as IDebugManagerInternal;

            Instance = this;
        }
Exemplo n.º 26
0
 public AgregationManager(IDbHelper db,
                          ITimeManager timeManager,
                          ICateringManager cateringManager,
                          IReflectionHelper reflectionHelper,
                          ICustomerManager customerManager,
                          ITagManager tagManager)
 {
     _db               = db;
     _timeManager      = timeManager;
     _cateringManager  = cateringManager;
     _reflectionHelper = reflectionHelper;
     _customerManager  = customerManager;
     _tagManager       = tagManager;
 }
        public byte GetAllowedDirectionsMask(ITimeManager timeManager, State state, int player, DistanceMap distanceMap, InterestingFacts facts)
        {
            var result = (byte)0;

            minimax.Alphabeta(timeManager, state, player, facts.pathsToOwned, distanceMap, facts);
            for (int i = 0; i < 4; i++)
            {
                if (minimax.bestResultScores[i] > 0)
                {
                    result = (byte)(result | (1 << i));
                }
            }

            return(result);
        }
Exemplo n.º 28
0
 /// <summary>
 /// Initialize all subsystems
 /// </summary>
 /// <param name="timeSystem"></param>
 /// <param name="settings"></param>
 public Driver(ITimeSystem timeSystem, ISettings settings)
 {
     //when reordering, be carefull, in order to pass only initialized objects
     this.fileManager      = new FileManager(settings);
     this.languageSwitcher = new LanguageSwitcher(settings);
     //probably all of them should be properties, not fields, in order to automatically update referencies
     TaskCollection       = LifeIdea.LazyCure.Core.Tasks.TaskCollection.Default;
     this.timeLogsManager = new TimeLogsManager(this.fileManager);
     HistoryDataProvider  = new HistoryDataProvider(timeLogsManager, TaskCollection);
     this.timeManager     = new TimeManager(timeSystem, TimeLogsManager);
     HistoryDataProvider.CreateSummaries(TimeManager.TimeLog);
     this.workingTime          = new WorkingTimeForDay(TimeManager.TimeLog, TaskCollection);
     this.efficiencyCalculator = new EfficiencyCalculator(workingTime);
     ApplySettings(settings);
 }
Exemplo n.º 29
0
        protected virtual void CreateManagersInstance()
        {
            for (int i = 0; i < managersList.Length; i++)
            {
                var         instance   = GameObject.Instantiate(managersList[i], transform);
                IInitialize initialize = instance.GetComponentInChildren <IInitialize>();
                if (initialize != null)
                {
                    ObjectInitializationCallBack.AddListener(initialize.Initialize);
                }

                if (_timeManager == null)
                {
                    _timeManager = instance.GetComponentInChildren <ITimeManager>();
                }
            }
        }
Exemplo n.º 30
0
        public Clock(IAlarm alarm, IDisplay display)
        {
            _alarm         = alarm;
            _buttonManager = new ButtonManager();
            _display       = display;
            _modeManager   = new ModeManager();
            _timeManager   = new TimeManager();
            _timer         = new SixtySecondTimer();

            _buttonManager.SetModeManager(_modeManager);
            _buttonManager.SetTimeManager(_timeManager);

            _timeManager.SetAlarm(_alarm);
            _timeManager.SetDisplay(_display);
            _timeManager.SetModeManager(_modeManager);
            _timer.SetTimeManager(_timeManager);
        }
Exemplo n.º 31
0
 public MainViewModel(ITimeManager timeManager, AirportEngine engine, LastFlightViewModel lastFlightViewModel, ArrivalScoreboardViewModel arrivalScoreboard, DepartureScoreboardViewModel departureScoreboard, DiagramViewModel diagramViewModel)
 {
     _timeManager        = timeManager;
     _engine             = engine;
     LastFlightViewModel = lastFlightViewModel;
     ArrivalScoreboard   = arrivalScoreboard;
     DepartureScoreboard = departureScoreboard;
     DiagramViewModel    = diagramViewModel;
     PossibleMultiplyers = new ObservableCollection <int>
     {
         1,
         10,
         100,
         1000,
         10000
     };
     _engine.Start();
 }
Exemplo n.º 32
0
        public virtual StateEnums.Status Initialize(IJob _job, IFlatFileLoader ffLoader, ITimeManager tManager, IDataMonitorManager dm)
        {
            job = _job;
            flatFileLoader = ffLoader;
            timeManager = tManager;
            dmManager = dm;

            return Initialize(job);
        }
Exemplo n.º 33
0
 public static void StartStateManagerService(IFlatFileLoader ffLoader, ITimeManager tManager, IDataMonitorManager sqldManager)
 {
     StateManagerService.Start(null, ffLoader, tManager, sqldManager);
 }