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); } }
private void TryLoadCachedScenarios() { if (Savior.Has(_cachedScenariosKey)) { try { Scenarios = Savior.Get <ScenarioInfo[]>(_cachedScenariosKey); NeedRefresh?.Invoke(); } catch { Savior.Clear(_cachedScenariosKey); } } }
private bool LoadData() { if (!Savior.Has(nameof(_diagramsScenariosViews))) { return(false); } _diagramsScenariosViews = Savior.Get <string[]>(nameof(_diagramsScenariosViews)); return(_diagramsScenariosViews.Any()); }
private void LoadData() { if (Savior.Has(nameof(_statisticsScenariosInfos))) { _statisticsScenariosInfos = Savior.Get <List <StatisticsScenarioInfoInternal> >(nameof(_statisticsScenariosInfos)); } else { _statisticsScenariosInfos = new List <StatisticsScenarioInfoInternal>(); } }
public LazuriteServer() { if (_savior.Has(SettingsKey)) { _settings = _savior.Get <ServerSettings>(SettingsKey); } else { _settings = new ServerSettings(); } }
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(); } }
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(); }; }