Ejemplo n.º 1
0
        /// <summary>
        /// Создать <see cref="PortfoliosPanel"/>.
        /// </summary>
        public PortfoliosPanel()
        {
            InitializeComponent();

            AlertBtn.SchemaChanged += RaiseChangedCommand;

            var cmdSvc = ConfigManager.GetService <IStudioCommandService>();

            cmdSvc.Register <PositionCommand>(this, true, cmd => AlertBtn.Process(new PositionChangeMessage
            {
                SecurityId    = cmd.Position.Key.Item1,
                PortfolioName = cmd.Position.Key.Item2,
                ServerTime    = TimeHelper.NowWithOffset,
            }.Add(PositionChangeTypes.CurrentValue, cmd.Position.Value)));
            cmdSvc.Register <BindConnectorCommand>(this, true, cmd =>
            {
                if (!cmd.CheckControl(this))
                {
                    return;
                }

                ShowToolBar = false;
            });

            WhenLoaded(() => new RequestBindSource(this).SyncProcess(this));
        }
Ejemplo n.º 2
0
 public override void Save(SettingsStorage storage)
 {
     storage.SetValue("GridSettings", TradesGrid.Save());
     storage.SetValue("Securities", _securityIds.ToArray());
     storage.SetValue("AlertSettings", AlertBtn.Save());
     storage.SetValue("VolumeFilter", VolumeFilter.Value);
 }
Ejemplo n.º 3
0
        public override void Save(SettingsStorage storage)
        {
            base.Save(storage);

            storage.SetValue("SubscribeNews", SubscribeNews);
            storage.SetValue("NewsGrid", NewsGrid.Save());
            storage.SetValue("AlertSettings", AlertBtn.Save());
        }
Ejemplo n.º 4
0
        public override void Dispose()
        {
            var cmdSvc = ConfigManager.GetService <IStudioCommandService>();

            cmdSvc.UnRegister <ResetedCommand>(this);
            cmdSvc.UnRegister <NewTradesCommand>(this);

            AlertBtn.Dispose();
        }
Ejemplo n.º 5
0
        public override void Load(SettingsStorage storage)
        {
            base.Load(storage);

            SubscribeNews = storage.GetValue("SubscribeNews", false);
            NewsGrid.Load(storage.GetValue <SettingsStorage>("NewsGrid"));

            var alertSettings = storage.GetValue <SettingsStorage>("AlertSettings");

            if (alertSettings != null)
            {
                AlertBtn.Load(alertSettings);
            }
        }
Ejemplo n.º 6
0
        /********************************************************************
        * CÓDIGO ACIMA, ADICIONA SOMBRA NO WINDOWS FORM /\ /\ /\ /\
        ********************************************************************/

        #endregion DLL SHADOW

        public AlertBig(string _title, string _message, AlertType type, AlertBtn btn, bool focus = false)
        {
            InitializeComponent();

            title.Text   = _title;
            message.Text = _message;

            switch (type)
            {
            case AlertType.success:
                icon.Image = Properties.Resources.success;
                break;

            case AlertType.info:
                icon.Image = Properties.Resources.info;
                break;

            case AlertType.warning:
                icon.Image = Properties.Resources.warning;
                break;

            case AlertType.error:
                icon.Image = Properties.Resources.error;
                break;
            }

            switch (btn)
            {
            case AlertBtn.YesNo:
                btnNo.Visible  = true;
                btnSim.Visible = true;
                if (focus)
                {
                    btnNo.Focus();
                }
                else
                {
                    btnSim.Focus();
                }
                break;

            case AlertBtn.OK:
                btnOk.Visible = true;
                btnOk.Focus();
                break;
            }

            Eventos();
            Retorno();
        }
Ejemplo n.º 7
0
        private void AddTrades(IEnumerable <Trade> trades)
        {
            if (!_securityIds.IsEmpty())
            {
                trades = trades.Where(t => _securityIds.Contains(t.Security.Id));
            }

            if (_volumeFilter != null && _volumeFilter > 0)
            {
                trades = trades.Where(t => t.Volume >= _volumeFilter);
            }

            TradesGrid.Trades.AddRange(trades);
            AlertBtn.Process(trades.Select(t => t.ToMessage()));
        }
Ejemplo n.º 8
0
        public override void Load(SettingsStorage storage)
        {
            base.Load(storage);

            SubscribeNews = storage.GetValue("SubscribeNews", false);

            NewsGrid.NewsProvider = ConfigManager.GetService <INewsProvider>();
            NewsGrid.Load(storage.GetValue <SettingsStorage>("NewsGrid"));

            var alertSettings = storage.GetValue <SettingsStorage>("AlertSettings");

            if (alertSettings != null)
            {
                AlertBtn.Load(alertSettings);
            }
        }
Ejemplo n.º 9
0
        public override void Load(SettingsStorage storage)
        {
            var panelSettings = storage.GetValue <SettingsStorage>("PositionsPanel");

            if (panelSettings != null)
            {
                ((IPersistable)PositionsPanel).Load(panelSettings);
            }

            var alertSettings = storage.GetValue <SettingsStorage>("AlertSettings");

            if (alertSettings != null)
            {
                AlertBtn.Load(alertSettings);
            }
        }
Ejemplo n.º 10
0
        public override void Load(SettingsStorage storage)
        {
            TradesGrid.Load(storage.GetValue <SettingsStorage>("GridSettings"));

            _securityIds.SyncDo(list =>
            {
                list.Clear();
                list.AddRange(storage.GetValue("Securities", ArrayHelper.Empty <string>()));
            });

            var alertSettings = storage.GetValue <SettingsStorage>("AlertSettings");

            if (alertSettings != null)
            {
                AlertBtn.Load(alertSettings);
            }

            VolumeFilter.Value = storage.GetValue <decimal?>("VolumeFilter");
        }
Ejemplo n.º 11
0
        public NewsPanel()
        {
            InitializeComponent();

            NewsGrid.PropertyChanged  += (s, e) => RaiseChangedCommand();
            NewsGrid.SelectionChanged += (s, e) => new SelectCommand <News>(NewsGrid.SelectedNews, false).Process(this);

            AlertBtn.SchemaChanged += RaiseChangedCommand;

            GotFocus += (s, e) => new SelectCommand <News>(NewsGrid.SelectedNews, false).Process(this);

            var cmdSvc = ConfigManager.GetService <IStudioCommandService>();

            cmdSvc.Register <NewNewsCommand>(this, false, cmd =>
            {
                NewsGrid.News.Add(cmd.News);

                AlertBtn.Process(cmd.News.ToMessage());
            });
            cmdSvc.Register <ResetedCommand>(this, false, cmd => NewsGrid.News.Clear());
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Создать <see cref="PortfoliosPanel"/>.
        /// </summary>
        public PortfoliosPanel()
        {
            InitializeComponent();

            AlertBtn.SchemaChanged += RaiseChangedCommand;

            var cmdSvc = ConfigManager.GetService <IStudioCommandService>();

            cmdSvc.Register <PositionCommand>(this, true, cmd => AlertBtn.Process(cmd.Position.ToMessage(TimeHelper.Now)));
            cmdSvc.Register <BindConnectorCommand>(this, true, cmd =>
            {
                if (!cmd.CheckControl(this))
                {
                    return;
                }

                ShowToolBar = false;
            });

            WhenLoaded(() => new RequestBindSource(this).SyncProcess(this));
        }
        public override void Load(SettingsStorage storage)
        {
            var gridSettings = storage.GetValue <SettingsStorage>("SecurityPicker");

            if (gridSettings != null)
            {
                SecurityPicker.Load(gridSettings);
            }

            var alertSettings = storage.GetValue <SettingsStorage>("AlertSettings");

            if (alertSettings != null)
            {
                AlertBtn.Load(alertSettings);
            }

            _securityIds.SyncDo(list =>
            {
                list.Clear();
                list.AddRange(storage.GetValue("Securities", ArrayHelper <string> .EmptyArray));
            });
        }
 public override void Save(SettingsStorage storage)
 {
     storage.SetValue("SecurityPicker", SecurityPicker.Save());
     storage.SetValue("AlertSettings", AlertBtn.Save());
     storage.SetValue("Securities", _securityIds.ToArray());
 }
Ejemplo n.º 15
0
 public override void Dispose()
 {
     ConfigManager.GetService <IStudioCommandService>().UnRegister <PositionCommand>(this);
     PositionsPanel.Dispose();
     AlertBtn.Dispose();
 }
Ejemplo n.º 16
0
 public override void Save(SettingsStorage storage)
 {
     storage.SetValue("PositionsPanel", PositionsPanel.Save());
     storage.SetValue("AlertSettings", AlertBtn.Save());
 }