示例#1
0
        private void DrawTimerOnElapsed()
        {
            try
            {
                RaiseChangedCommand();

                var elements = _changedElements.CopyAndClear();

                var candleElement = elements.OfType <ChartCandleElement>().FirstOrDefault();

                if (candleElement == null)
                {
                    foreach (var indicatorElement in elements.OfType <ChartIndicatorElement>())
                    {
                        AddIndicator(indicatorElement);
                    }
                }
                else
                {
                    _candlesCount = 0;

                    _bufferedChart.IsAutoRange = true;
                    GuiDispatcher.GlobalDispatcher.AddAction(() => IsStarted = true);

                    _skipElements.Clear();
                    _candleManager.Start((CandleSeries)_bufferedChart.GetSource(candleElement));
                }
            }
            catch (Exception ex)
            {
                ex.LogError();
            }
        }
示例#2
0
        private void OnFlush(object state)
        {
            DockingControl[] items;
            bool             isLayoutChanged;

            lock (_syncRoot)
            {
                if (_isFlushing || _isDisposing)
                {
                    return;
                }

                isLayoutChanged = _isLayoutChanged;
                items           = _changedControls.CopyAndClear();

                _isFlushing      = true;
                _isLayoutChanged = false;
            }

            try
            {
                if (items.Length > 0 || isLayoutChanged)
                {
                    GuiDispatcher.GlobalDispatcher.AddSyncAction(() =>
                    {
                        if (_isDisposing)
                        {
                            return;
                        }

                        Save(items, isLayoutChanged);
                    });

                    Changed.SafeInvoke();
                }
                else
                {
                    lock (_syncRoot)
                    {
                        if (_flushTimer == null)
                        {
                            return;
                        }

                        _flushTimer.Dispose();
                        _flushTimer = null;
                    }
                }
            }
            catch (Exception excp)
            {
                this.AddErrorLog(excp, "Flush layout changed error.");
            }
            finally
            {
                lock (_syncRoot)
                    _isFlushing = false;
            }
        }
示例#3
0
        private void OnFlush(object state)
        {
            DockingControl[] items;
            bool             isLayoutChanged;

            lock (_syncRoot)
            {
                if (_isFlushing)
                {
                    return;
                }

                isLayoutChanged = _isLayoutChanged;
                items           = _changedControls.CopyAndClear();

                _isFlushing      = true;
                _isLayoutChanged = false;
            }

            try
            {
                if (items.Length > 0 || isLayoutChanged)
                {
                    GuiDispatcher.GlobalDispatcher.AddSyncAction(() =>
                    {
                        CultureInfo.InvariantCulture.DoInCulture(() =>
                        {
                            foreach (var control in items)
                            {
                                _dockingControlSettings[control] = control.Save();
                            }

                            if (isLayoutChanged)
                            {
                                _layout = SaveLayout();
                            }
                        });
                    });

                    Changed.SafeInvoke();
                }
                else
                {
                    lock (_syncRoot)
                    {
                        if (_flushTimer == null)
                        {
                            return;
                        }

                        _flushTimer.Dispose();
                        _flushTimer = null;
                    }
                }
            }
            catch (Exception excp)
            {
                this.AddErrorLog(excp, "Flush layout changed error.");
            }
            finally
            {
                lock (_syncRoot)
                    _isFlushing = false;
            }
        }