public ShopConnectorService(
     IRepository <ShopConnectorConnectionRecord> connectionRepository,
     IRepository <ShopConnectorSkuMapping> skuMappingRepository,
     ICommonServices services,
     IDateTimeHelper dateTimeHelper,
     AdminAreaSettings adminAreaSettings,
     IManufacturerService manufacturerService,
     ITaxCategoryService taxCategoryService,
     Lazy <IMediaService> mediaService,
     Lazy <IPluginFinder> pluginFinder,
     Lazy <IRepository <StoreMapping> > storeMappingRepository,
     Lazy <ICategoryService> categoryService,
     Lazy <IExportProfileService> exportProfileService,
     Lazy <IDataExporter> dataExporter,
     Lazy <ICatalogSearchService> catalogSearchService,
     IAsyncState asyncState,
     ShopConnectorSettings shopConnectorSettings)
 {
     _connectionRepository   = connectionRepository;
     _skuMappingRepository   = skuMappingRepository;
     _services               = services;
     _dateTimeHelper         = dateTimeHelper;
     _adminAreaSettings      = adminAreaSettings;
     _manufacturerService    = manufacturerService;
     _taxCategoryService     = taxCategoryService;
     _mediaService           = mediaService;
     _pluginFinder           = pluginFinder;
     _storeMappingRepository = storeMappingRepository;
     _categoryService        = categoryService;
     _exportProfileService   = exportProfileService;
     _dataExporter           = dataExporter;
     _catalogSearchService   = catalogSearchService;
     _asyncState             = asyncState;
     _shopConnectorSettings  = shopConnectorSettings;
 }
 public ShopConnectorImportController(
     IShopConnectorService connectorService,
     IAsyncState asyncState)
 {
     _connectorService = connectorService;
     _asyncState       = asyncState;
 }
예제 #3
0
        /// <summary>
        /// Configura o cliente para o modo udp
        /// </summary>
        private void ConfigureUdp()
        {
            // udp não é baseado em conexão

            AsyncState = new AsyncState(this, Cfg, this, new byte[1024]);
            ((AsyncState)(AsyncState)).EndPoint = new IPEndPoint(IPAddress.Parse(Cfg.IP), Cfg.Port);
            ((AsyncState)(AsyncState)).BeginReceive();
        }
예제 #4
0
        public InstallController(
            IInstallationLocalizationService locService,
            IAsyncState asyncState)
        {
            _locService = locService;
            _asyncState = asyncState;

            Logger = NullLogger.Instance;
        }
예제 #5
0
        private static void _DecrementAsyncRefCount(TClient client)
        {
            IAsyncState asyncState = _GetAsyncState(client);

            if (asyncState.RefCount > 0)
            {
                asyncState.RefCount--;
            }
        }
예제 #6
0
 public InstallController(
     IHostApplicationLifetime hostApplicationLifetime,
     IApplicationContext appContext,
     IAsyncState asyncState)
 {
     _installService          = EngineContext.Current.Scope.ResolveOptional <IInstallationService>();
     _hostApplicationLifetime = hostApplicationLifetime;
     _appContext = appContext;
     _asyncState = asyncState;
 }
예제 #7
0
        public DefaultTaskScheduler(IAsyncState asyncState)
        {
            _asyncState = asyncState;

            _sweepInterval  = 1;
            _timer          = new System.Timers.Timer();
            _timer.Elapsed += Elapsed;

            Logger = NullLogger.Instance;
            HostingEnvironment.RegisterObject(this);
        }
예제 #8
0
        private static IAsyncState _GetAsyncState(TClient client)
        {
            IAsyncState asyncState = client as IAsyncState;

            if (asyncState == null)
            {
                throw new InvalidOperationException();
            }

            return(asyncState);
        }
예제 #9
0
        IEnumerator OnEnter(IAsyncState state, params Func <IEnumerator>[] removes)
        {
            Debug.LogFormat("<color=orange>[{0}][ステート開始] {1} -> {2}</color>", Time.frameCount, currentState, state.GetType().Name);
            previousState = currentState;
            currentState  = state;

            foreach (var cb in removes)
            {
                removableCoroutines.Remove(cb);
            }

            yield return(state.OnEnter());
        }
예제 #10
0
        public TaskExecutor(
            IScheduleTaskService scheduledTaskService,
            IComponentContext componentContext,
            IAsyncState asyncState,
            Func <Type, ITask> taskResolver)
        {
            _scheduledTaskService = scheduledTaskService;
            _componentContext     = componentContext;
            _asyncState           = asyncState;
            _taskResolver         = taskResolver;

            Logger = LogManager.GetLogger(typeof(TaskExecutor));
        }
예제 #11
0
 public SchedulingController(
     ITaskStore taskStore,
     ITaskActivator taskActivator,
     ITaskScheduler taskScheduler,
     IAsyncState asyncState,
     CommonSettings commonSettings)
 {
     _taskStore      = taskStore;
     _taskActivator  = taskActivator;
     _taskScheduler  = taskScheduler;
     _asyncState     = asyncState;
     _commonSettings = commonSettings;
 }
예제 #12
0
 public InstallationService(
     IHttpContextAccessor httpContextAccessor,
     IApplicationContext appContext,
     IAsyncState asyncState,
     IUrlHelper urlHelper,
     IEnumerable <Lazy <InvariantSeedData, InstallationAppLanguageMetadata> > seedDatas)
 {
     _httpContextAccessor = httpContextAccessor;
     _appContext          = appContext;
     _asyncState          = asyncState;
     _urlHelper           = urlHelper;
     _seedDatas           = seedDatas;
 }
예제 #13
0
 public ScheduleTaskController(
     IScheduleTaskService scheduleTaskService,
     ITaskScheduler taskScheduler,
     IAsyncState asyncState,
     AdminModelHelper adminModelHelper,
     AdminAreaSettings adminAreaSettings,
     CommonSettings commonSettings)
 {
     _scheduleTaskService = scheduleTaskService;
     _taskScheduler       = taskScheduler;
     _asyncState          = asyncState;
     _adminModelHelper    = adminModelHelper;
     _adminAreaSettings   = adminAreaSettings;
     _commonSettings      = commonSettings;
 }
예제 #14
0
        public TaskExecutor(
            IScheduleTaskService scheduledTaskService,
            IComponentContext componentContext,
            IAsyncState asyncState,
            Func <Type, ITask> taskResolver,
            IApplicationEnvironment env)
        {
            _scheduledTaskService = scheduledTaskService;
            _componentContext     = componentContext;
            _asyncState           = asyncState;
            _taskResolver         = taskResolver;
            _env = env;

            Logger = NullLogger.Instance;
            T      = NullLocalizer.Instance;
        }
예제 #15
0
        public DefaultTaskExecutor(
            ITaskStore taskStore,
            Func <Type, ITask> taskResolver,
            IComponentContext componentContext,
            IAsyncState asyncState,
            AsyncRunner asyncRunner,
            IApplicationContext appContext)
        {
            _taskStore        = taskStore;
            _taskResolver     = taskResolver;
            _componentContext = componentContext;
            _asyncState       = asyncState;
            _asyncRunner      = asyncRunner;
            _appContext       = appContext;

            Logger = NullLogger.Instance;
        }
예제 #16
0
        public TaskExecutor(
            ITaskStore taskStore,
            ITaskActivator taskActivator,
            IComponentContext componentContext,
            IAsyncState asyncState,
            AsyncRunner asyncRunner,
            IApplicationContext appContext)
        {
            _taskStore        = taskStore;
            _taskActivator    = taskActivator;
            _componentContext = componentContext;
            _asyncState       = asyncState;
            _asyncRunner      = asyncRunner;
            _appContext       = appContext;

            Logger = NullLogger.Instance;
        }
 public ScheduleTaskController(
     IScheduleTaskService scheduleTaskService,
     ITaskScheduler taskScheduler,
     IPermissionService permissionService,
     IDateTimeHelper dateTimeHelper,
     ILocalizationService localizationService,
     IWorkContext workContext,
     IAsyncState asyncState)
 {
     this._scheduleTaskService = scheduleTaskService;
     this._taskScheduler       = taskScheduler;
     this._permissionService   = permissionService;
     this._dateTimeHelper      = dateTimeHelper;
     this._localizationService = localizationService;
     this._workContext         = workContext;
     this._asyncState          = asyncState;
 }
 public ScheduleTaskController(
     IScheduleTaskService scheduleTaskService,
     ITaskScheduler taskScheduler,
     IPermissionService permissionService,
     IDateTimeHelper dateTimeHelper,
     ILocalizationService localizationService,
     IWorkContext workContext,
     IStoreContext storeContext,
     IAsyncState asyncState)
 {
     _scheduleTaskService = scheduleTaskService;
     _taskScheduler       = taskScheduler;
     _permissionService   = permissionService;
     _dateTimeHelper      = dateTimeHelper;
     _localizationService = localizationService;
     _workContext         = workContext;
     _storeContext        = storeContext;
     _asyncState          = asyncState;
 }
예제 #19
0
        public TaskExecutor(
            IScheduleTaskService scheduledTaskService,
            IDbContext dbContext,
            ICustomerService customerService,
            IWorkContext workContext,
            IComponentContext componentContext,
            IAsyncState asyncState,
            Func <Type, ITask> taskResolver)
        {
            _scheduledTaskService = scheduledTaskService;
            _dbContext            = dbContext;
            _workContext          = workContext;
            _componentContext     = componentContext;
            _asyncState           = asyncState;
            _taskResolver         = taskResolver;

            Logger = NullLogger.Instance;
            T      = NullLocalizer.Instance;
        }
예제 #20
0
 public LanguageController(
     ILanguageService languageService,
     IStoreMappingService storeMappingService,
     IGenericAttributeService genericAttributeService,
     AdminAreaSettings adminAreaSettings,
     IPluginFinder pluginFinder,
     ICountryService countryService,
     ICommonServices services,
     IDateTimeHelper dateTimeHelper,
     IAsyncState asyncState)
 {
     _languageService         = languageService;
     _storeMappingService     = storeMappingService;
     _genericAttributeService = genericAttributeService;
     _adminAreaSettings       = adminAreaSettings;
     _pluginFinder            = pluginFinder;
     _countryService          = countryService;
     _services       = services;
     _dateTimeHelper = dateTimeHelper;
     _asyncState     = asyncState;
 }
예제 #21
0
        private void _CloseClient(TClient client)
        {
            int refCount = 0;

            IAsyncState asyncState = client as IAsyncState;

            if (asyncState != null)
            {
                refCount = asyncState.RefCount;
            }

            if (refCount == 0)
            {
                try
                {
                    this.OnCloseInnerClient(client);
                }
                catch { } // ignore errors

                ServiceHelper.CloseCommObject(client);
            }
        }
예제 #22
0
        /// <summary>
        /// 状態変更をリクエストします.
        /// 実際に状態変更されるまでに別のリクエストがあった場合、リクエストは上書きされます.
        /// </summary>
        public IAsyncStateMachine ChangeState(IAsyncState state)
        {
            Debug.LogFormat("<color=red>[{0}][ステート変更リクエスト] {1} -> {2}</color>", Time.frameCount, currentState, state.GetType().Name);

            // ステート変更に伴い、削除リストにあるコルーチンを削除する.
            removableCoroutines.ForEach(x => queuedCoroutines.Remove(x));
            removableCoroutines.Clear();

            Func <IEnumerator> onUpdate = () => OnUpdate(state);
            Func <IEnumerator> onExit   = () => OnExit(state);
            Func <IEnumerator> onEnter  = () => OnEnter(state, onExit);

            // コルーチンキューに追加
            queuedCoroutines.Add(onEnter);
            queuedCoroutines.Add(onUpdate);
            queuedCoroutines.Add(onExit);

            // ステート変更時の削除コルーチンを追加.
            removableCoroutines.Add(onEnter);
            removableCoroutines.Add(onUpdate);
            removableCoroutines.Add(onExit);

            return(this);
        }
예제 #23
0
        IEnumerator OnExit(IAsyncState state)
        {
            yield return(state.OnExit());

            Debug.LogFormat("<color=green>[{0}][ステート完了] {1}</color>", Time.frameCount, state.GetType().Name);
        }
예제 #24
0
        private static void _IncrementAsyncRefCount(TClient client)
        {
            IAsyncState asyncState = _GetAsyncState(client);

            asyncState.RefCount++;
        }
예제 #25
0
 public ConnectionEventArgs(IAsyncState state)
 {
     State = state;
 }
 public ReceiveEventArgs(IAsyncState state)
 {
     State = state;
 }
예제 #27
0
        IEnumerator OnUpdate(IAsyncState state)
        {
            yield return(state.OnUpdate());

            state.OnUpdateComplete();
        }
예제 #28
0
 /// <summary>
 /// 新しい状態を登録します.
 /// </summary>
 public IAsyncStateMachine RegisterState(IAsyncState state)
 {
     states.Add(state);
     state.stateMachine = this;
     return(this);
 }
예제 #29
0
 /// <summary>
 /// 指定したコールバックに新しい状態遷移を追加します.
 /// </summary>
 public IAsyncStateMachine AddTransition(ref Action action, IAsyncState state)
 {
     action += () => ChangeState(state);
     return(this);
 }