예제 #1
0
        /// <summary>
        /// Вызывать событие <see cref="DataLoaded"/>.
        /// </summary>
        /// <param name="security">Инструмент.</param>
        /// <param name="dataType">Тип данных.</param>
        /// <param name="arg">Параметр данных.</param>
        /// <param name="time">Время последних данных.</param>
        /// <param name="count">Количество последних данных.</param>
        protected void RaiseDataLoaded(Security security, Type dataType, object arg, DateTimeOffset time, int count)
        {
            if (security == null)
            {
                this.AddInfoLog(LocalizedStrings.Str2207Params, count, dataType.Name);
            }
            else
            {
                this.AddInfoLog(LocalizedStrings.Str2208Params, security.Id, count, dataType.Name, arg);
            }

            DataLoaded.SafeInvoke(security, dataType, arg, time, count);
        }
예제 #2
0
        private void OnFlush()
        {
            try
            {
                this.GuiSync(() => DataLoading.SafeInvoke());

                while (true)
                {
                    Query query;

                    lock (_syncObject)
                    {
                        _isChanged = false;

                        if (_query == null)
                        {
                            this.GuiAsync(() => DataLoaded.SafeInvoke());

                            _isFlushing = false;
                            break;
                        }

                        query  = _query;
                        _query = null;
                    }

                    Process(query.Item1, query.Item2, query.Item3, query.Item4);
                }
            }
            catch (Exception ex)
            {
                this.GuiAsync(() =>
                {
                    DataLoaded.SafeInvoke();
                    throw new InvalidOperationException(LocalizedStrings.Str1538, ex);
                });
            }
        }