예제 #1
0
        /// <summary>
        /// перерисовать таблицу портфелей
        /// </summary>
        private void RePaintPortfolio()
        {
            try
            {
                if (_positionHost.Child == null)
                {
                    return;
                }

                if (!_positionHost.CheckAccess())
                {
                    _positionHost.Dispatcher.Invoke(RePaintPortfolio);
                    return;
                }

                // очищаем старые данные с грида

                _gridPosition.Rows.Clear();

                if (_portfolios == null)
                {
                    return;
                }

                // отправляем портфели на прорисовку
                for (int i = 0; _portfolios != null && i < _portfolios.Count; i++)
                {
                    PaintPortfolio(_portfolios[i]);
                }
            }
            catch (Exception error)
            {
                SendNewLogMessage(error.ToString(), LogMessageType.Error);
            }
        }
예제 #2
0
        /// <summary>
        /// redraw the portfolio table
        /// перерисовать таблицу портфелей
        /// </summary>
        private void RePaintPortfolio()
        {
            try
            {
                if (_positionHost.Child == null)
                {
                    return;
                }

                if (_portfolios == null)
                {
                    return;
                }

                for (int i = 0; i < _portfolios.Count; i++)
                {
                    List <Portfolio> portfolios = _portfolios.FindAll(p => p.Number == _portfolios[i].Number);

                    if (portfolios.Count > 1)
                    {
                        _portfolios.RemoveAt(i);
                        break;
                    }
                }

                if (!_positionHost.CheckAccess())
                {
                    _positionHost.Dispatcher.Invoke(RePaintPortfolio);
                    return;
                }

                // clear old data from grid
                // очищаем старые данные с грида

                _gridPosition.Rows.Clear();

                if (_portfolios == null)
                {
                    return;
                }

                // send portfolios to draw
                // отправляем портфели на прорисовку
                for (int i = 0; _portfolios != null && i < _portfolios.Count; i++)
                {
                    try
                    {
                        PaintPortfolio(_portfolios[i]);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            catch (Exception error)
            {
                SendNewLogMessage(error.ToString(), LogMessageType.Error);
            }
        }
예제 #3
0
//прорисовка

        /// <summary>
        /// остановить прорисовку элементов
        /// </summary>
        public void StopPaint()
        {
            try
            {
                if (!_host.CheckAccess())
                {
                    _host.Dispatcher.Invoke(StopPaint);
                    return;
                }
                _host.Child = null;
            }
            catch (Exception error)
            {
                SendNewLogMessage(error.ToString(), LogMessageType.Error);
            }
        }
예제 #4
0
        // drawing
        // прорисовка

        /// <summary>
        /// start drawing the object
        /// начать прорисовку объекта
        /// </summary>
        public void StartPaint(WindowsFormsHost host)
        {
            _host = host;
            if (!_host.CheckAccess())
            {
                _host.Dispatcher.Invoke(new Action <WindowsFormsHost>(StartPaint), host);
                return;
            }

            _host.Child = _grid;
        }
예제 #5
0
 /// <summary>
 /// finish drawing the object
 /// остановить прорисовку объекта
 /// </summary>
 public void StopPaint()
 {
     if (_host == null)
     {
         return;
     }
     if (!_host.CheckAccess())
     {
         _host.Dispatcher.Invoke(StopPaint);
         return;
     }
     if (_host != null)
     {
         _host.Child = null;
         _host       = null;
     }
 }
예제 #6
0
        /// <summary>
        /// прорисовать окошко с сообщением в новом потоке
        /// </summary>
        private void ShowMessageInNewThread(string message)
        {
            try
            {
                if (!_hostChart.CheckAccess())
                {
                    _hostChart.Dispatcher.Invoke(new Action <string>(ShowMessageInNewThread), message);
                    return;
                }

                AlertMessageSimpleUi ui = new AlertMessageSimpleUi(message);
                ui.Show();
            }
            catch (Exception error)
            {
                SendNewLogMessage(error.ToString(), LogMessageType.Error);
            }
        }
예제 #7
0
        /// <summary>
        /// redraw the portfolio table
        /// перерисовать таблицу портфелей
        /// </summary>
        private void RePaintPortfolio()
        {
            try
            {
                if (_positionHost.Child == null)
                {
                    return;
                }

                if (_portfolios == null)
                {
                    return;
                }

                try
                {
                    for (int i = 0; i < _portfolios.Count; i++)
                    {
                        List <Portfolio> portfolios =
                            _portfolios.FindAll(p => p.Number == _portfolios[i].Number);

                        if (portfolios.Count > 1)
                        {
                            _portfolios.RemoveAt(i);
                            break;
                        }
                    }
                }
                catch
                {
                    // ignore
                }

                if (!_positionHost.CheckAccess())
                {
                    _positionHost.Dispatcher.Invoke(RePaintPortfolio);
                    return;
                }

                if (_portfolios == null)
                {
                    _gridPosition.Rows.Clear();
                    return;
                }

                int curUpRow     = 0;
                int curSelectRow = 0;

                if (_gridPosition.RowCount != 0)
                {
                    curUpRow = _gridPosition.FirstDisplayedScrollingRowIndex;
                }

                if (_gridPosition.SelectedRows.Count != 0)
                {
                    curSelectRow = _gridPosition.SelectedRows[0].Index;
                }

                _gridPosition.Rows.Clear();

                // send portfolios to draw
                // отправляем портфели на прорисовку
                for (int i = 0; _portfolios != null && i < _portfolios.Count; i++)
                {
                    try
                    {
                        PaintPortfolio(_portfolios[i]);
                    }
                    catch (Exception)
                    {
                    }
                }

                /* int curUpRow = 0;
                 * int curSelectRow = 0;*/

                if (curUpRow != 0 && curUpRow != -1)
                {
                    _gridPosition.FirstDisplayedScrollingRowIndex = curUpRow;
                }

                if (curSelectRow != 0 &&
                    _gridPosition.Rows.Count > curSelectRow &&
                    curSelectRow != -1)
                {
                    _gridPosition.Rows[curSelectRow].Selected = true;
                }
            }
            catch (Exception error)
            {
                SendNewLogMessage(error.ToString(), LogMessageType.Error);
            }
        }