예제 #1
0
 public override void Initialize()
 {
     Bus.Register <GeolocationDataHandler>();
     Bus.Register <MessagesDataHandler>();
     if (Savior.Has(_usersKey))
     {
         _users = Savior.Get <List <UserBase> >(_usersKey);
     }
     if (Savior.Has(_groupsKey))
     {
         _groups = Savior.Get <List <UserGroupBase> >(_groupsKey);
     }
 }
예제 #2
0
 private void TryLoadCachedScenarios()
 {
     if (Savior.Has(_cachedScenariosKey))
     {
         try
         {
             Scenarios = Savior.Get <ScenarioInfo[]>(_cachedScenariosKey);
             NeedRefresh?.Invoke();
         }
         catch
         {
             Savior.Clear(_cachedScenariosKey);
         }
     }
 }
예제 #3
0
 private bool LoadData()
 {
     if (!Savior.Has(nameof(_diagramsScenariosViews)))
     {
         return(false);
     }
     _diagramsScenariosViews = Savior.Get <string[]>(nameof(_diagramsScenariosViews));
     return(_diagramsScenariosViews.Any());
 }
예제 #4
0
 private void LoadData()
 {
     if (Savior.Has(nameof(_statisticsScenariosInfos)))
     {
         _statisticsScenariosInfos = Savior.Get <List <StatisticsScenarioInfoInternal> >(nameof(_statisticsScenariosInfos));
     }
     else
     {
         _statisticsScenariosInfos = new List <StatisticsScenarioInfoInternal>();
     }
 }
예제 #5
0
 public LazuriteServer()
 {
     if (_savior.Has(SettingsKey))
     {
         _settings = _savior.Get <ServerSettings>(SettingsKey);
     }
     else
     {
         _settings = new ServerSettings();
     }
 }
예제 #6
0
        public override void Initialize()
        {
            if (_savior.Has(ScenariosIdsKey))
            {
                _scenariosIds = _savior.Get <List <string> >(ScenariosIdsKey);
            }
            else
            {
                _scenariosIds = new List <string>();
            }

            if (_savior.Has(TriggersIdsKey))
            {
                _triggersIds = _savior.Get <List <string> >(TriggersIdsKey);
            }
            else
            {
                _triggersIds = new List <string>();
            }

            _scenarios = _scenariosIds.Select(x => _savior.Get <ScenarioBase>(x)).ToList();
            _triggers  = _triggersIds.Select(x => _savior.Get <TriggerBase>(x)).ToList();

            //initialize scenarios
            foreach (var scenario in _scenarios)
            {
                if (scenario.GetInitializationState() == ScenarioInitializationValue.NotInitialized)
                {
                    scenario.FullInitializeAsync();
                }
            }

            //initialize triggers
            foreach (var trigger in _triggers)
            {
                trigger.Initialize();
                trigger.AfterInitialize();
            }
        }
예제 #7
0
 public VisualSettingsRepository()
 {
     if (_savior.Has(_key))
     {
         _allSettings = _savior.Get <List <UserVisualSettings> >(_key);
     }
     _usersRepository.OnUserRemoved = (user) =>
     {
         _allSettings.RemoveAll(x => x.UserId.Equals(user.Id));
         Save();
     };
     _scenariosRepository.OnScenarioRemoved += (sender, args) =>
     {
         _allSettings.RemoveAll(x => x.ScenarioId.Equals(args.Value.Id));
         Save();
     };
 }