Exemplo n.º 1
0
        public DataCurveTriggerB(IHSApplication hs, ILogging logging, IHsCollectionFactory collectionFactory,
                                 IHomeSeerHandler homeSeerHandler, IReformatCopiedAction reformatCopiedAction = null,
                                 IDataCurveTriggerUi dataCurveUi = null,
                                 IDataCurveComputationHandlerB dataCurveComputationHandler = null)
        {
            _collectionFactory = collectionFactory;
            _logging           = logging;
            _homeSeerHandler   = homeSeerHandler;
            _hs = hs;
            _dataCurveComputationHandler = dataCurveComputationHandler;
            if (reformatCopiedAction == null)
            {
                _reformatCopiedAction = new ReformatCopiedAction(_logging);
            }

            if (dataCurveUi == null)
            {
                _dataCurveUi = new DataCurveTriggerBUi(_homeSeerHandler, _hs);
            }

            if (_dataCurveComputationHandler == null)
            {
                _dataCurveComputationHandler = new ComputationTriggerBHandler(_logging);
            }
        }
Exemplo n.º 2
0
        public TriggerHandler(IHSApplication hs, IAppCallbackAPI callback, IIniSettings iniSettings,
                              ILogging logging, IHsCollectionFactory collectionFactory, IHomeSeerHandler homeSeerHandler, IStorageHandler storageHandler)
        {
            _hs                = hs;
            _callback          = callback;
            _iniSettings       = iniSettings;
            _logging           = logging;
            _collectionFactory = collectionFactory;
            _homeSeerHandler   = homeSeerHandler;
            _storageHandler    = storageHandler;
            _logging.LogDebug("Creating trigger types");
            _triggerTypes = CreateTriggerTypes();

            _logging.LogDebug("Starting thread to fetch triggers");
            GetPluginTriggersFromHomeSeerInNewThread();

            _logging.LogDebug("Done init TriggerHandler");
        }
Exemplo n.º 3
0
        public static ITrigger Get(IHSApplication hs, string triggerType, ILogging logging, ITriggerHandler triggerHandler, IAppCallbackAPI callback, IHsCollectionFactory collectionFactory, IHomeSeerHandler homeSeerHandler)
        {
            switch (triggerType)
            {
            case "DataCurveSeer.TriggerHandling.Triggers.DataCurveTrigger":
                return(new DataCurveTrigger(hs, logging, collectionFactory, homeSeerHandler));

            case "DataCurveSeer.TriggerHandling.Triggers.DataCurveTriggerB.DataCurveTriggerB":
                return(new DataCurveTrigger(hs, logging, collectionFactory, homeSeerHandler));

            default:
                logging.Log($"Could not find any match for {triggerType}. Alert the creator and tell him to check for errors.");
                break;
            }

            return(null);
        }