/// <summary> /// Подключиться. /// </summary> public override void Connect() { base.Connect(); var rooms = Invoke(f => f.GetRooms(SessionId)); foreach (var room in rooms) { _rooms.Add(room.Id, room); } var ids = Invoke(f => f.GetJoinedRooms(SessionId)); _accessedRooms.AddRange(ids); var joins = Invoke(f => f.GetAvatingJoins(SessionId)); foreach (var id in joins) { _avaitingJoins.Add(id, GetJoin(id)); } joins = Invoke(f => f.GetMyJoins(SessionId)); foreach (var id in joins) { _myJoins.Add(id, GetJoin(id)); } foreach (var roomId in _accessedRooms) { Invoke(f => f.Subscribe(SessionId, roomId)); } }
private void OnNewSecurities(IEnumerable <Security> securities) { if (_currentSecurity == null) { return; } var newStrikes = GetStrikes(securities).ToArray(); if (newStrikes.Length <= 0) { return; } _options.AddRange(newStrikes); SetDateLimits(); Desk.Options = _options.Cache; lock (_needRefreshLock) _needRefresh = true; }
/// <summary> /// Initializes a new instance of the <see cref="BasketSecurityBaseProcessor{TBasketSecurity}"/>. /// </summary> /// <param name="security">Security.</param> protected BasketSecurityBaseProcessor(Security security) { Security = security ?? throw new ArgumentNullException(nameof(security)); SecurityId = security.ToSecurityId(); BasketExpression = security.BasketExpression; BasketSecurity = Security.ToBasket <TBasketSecurity>(); if (BasketSecurity.InnerSecurityIds.IsEmpty()) { throw new ArgumentException(LocalizedStrings.SecurityDoNotContainsLegs.Put(BasketExpression), nameof(security)); } _basketLegs.AddRange(BasketSecurity.InnerSecurityIds); }
/// <summary> /// Загрузить настройки. /// </summary> /// <param name="storage">Хранилище настроек.</param> public void Load(SettingsStorage storage) { var connections = storage .GetValue <IEnumerable <SettingsStorage> >("Connections") .Select(s => { var providerName = s.GetValue <string>("Provider"); var provider = DatabaseProviderRegistry.Providers.FirstOrDefault(p => p.Name.CompareIgnoreCase(providerName)); return(provider == null ? null : new DatabaseConnectionPair { Provider = provider, ConnectionString = s.GetValue <string>("ConnectionString") }); }) .Where(p => p != null) .ToArray(); lock (_connections.SyncRoot) _connections.AddRange(connections); }