Exemplo n.º 1
0
        public void RefreshContent(Dictionary <string, Stock> stockData)
        {
            // update background
            this.BackColor = mainForm.Theme.NotificationBackground;

            this.tableLayoutPanel.Controls.Clear();
            foreach (var id in this.StockList)
            {
                UserControlStock control = new UserControlStock(id, mainForm.Theme);

                var s = stockData?.Values.FirstOrDefault(e => e.Id == id);

                if (s != null)
                {
                    control.LName.Text  = s.Name;
                    control.LValue.Text =
                        Math.Round(s.Value, 3, MidpointRounding.AwayFromZero).ToString("G29") +
                        "€"; // G29 to remove last zero if it is zero.
                    control.LPct.Text = Math.Round(s.Pct, 2) + "%";

                    if (s.Pct > 0)
                    {
                        control.LPct.ForeColor = mainForm.Theme.Positive;
                        control.LPct.Text      = "+" + control.LPct.Text;
                    }
                    else if (s.Pct < 0)
                    {
                        control.LPct.ForeColor = mainForm.Theme.Negative;
                    }

                    this.tableLayoutPanel.Controls.Add(control);
                }
            }
        }
Exemplo n.º 2
0
        private void RemoveToolStripMenuItemClick(object sender, EventArgs e)
        {
            UserControlStock c = (UserControlStock)((Control)this.contextMenuStripNotif.Tag).Parent;

            this.mainForm.RemoveStockFromNotif(c.Id);
            this.RefreshLocation();
        }
Exemplo n.º 3
0
        private void OpenBrowserToolStripMenuItemClick(object sender, EventArgs e)
        {
            UserControlStock c = (UserControlStock)((Control)this.contextMenuStripNotif.Tag).Parent;
            Stock            s = this.mainForm.GetStockById(c.Id);

            System.Diagnostics.Process.Start("https://www.boursorama.com/cours/1rP" + s.Ticker);
        }
Exemplo n.º 4
0
        public void RefreshContent(Dictionary <string, Stock> stockData)
        {
            this.tableLayoutPanel.Controls.Clear();
            foreach (var id in this.StockList)
            {
                UserControlStock control = new UserControlStock(id);

                var s = stockData.Values.FirstOrDefault(e => e.Id == id);

                if (s != null)
                {
                    control.LName.Text  = s.Name;
                    control.LValue.Text = Math.Round(s.Value, 3, MidpointRounding.AwayFromZero).ToString("G29") + "€"; // G29 to remove last zero if it is zero.
                    control.LPct.Text   = Math.Round(s.Pct, 2) + "%";

                    if (s.Pct > 0)
                    {
                        control.LPct.ForeColor = Color.LimeGreen;
                        control.LPct.Text      = "+" + control.LPct.Text;
                    }
                    else if (s.Pct < 0)
                    {
                        control.LPct.ForeColor = Color.Tomato;
                    }

                    this.tableLayoutPanel.Controls.Add(control);
                }
            }
        }
Exemplo n.º 5
0
        private void highlightToolStripMenuItemClick(object sender, EventArgs e)
        {
            UserControlStock c = (UserControlStock)((Control)this.contextMenuStripNotif.Tag).Parent;
            Stock            s = this.mainForm.GetStockById(c.Id);

            s.Highlight = c.ToggleHighlight();

            this.mainForm.SaveFile();
        }