private void UpdateStockData(object sender, StockUpdateEventArgs args)
        {
            if (ValueLabel.InvokeRequired)
            {
                StockUpdateCallback callback = UpdateStockData;
                Invoke(callback, this, args);
            }
            else
            {
                var stockData = args.StockData;

                if (stockData.ActualData > PreviousStockData.ActualData)
                {
                    Painter <Green> .Paint(ValueLabel, PaintMode.Light);
                }
                else if (stockData.ActualData < PreviousStockData.ActualData)
                {
                    Painter <Red> .Paint(ValueLabel, PaintMode.Light);
                }

                ValueLabel.Text = Formatter.FormatCurrency(args.StockData.ActualData, Pad.Left, 12);
                var changeRate = Formatter.FormatChangeRate(args.StockData.ChangeRate, Pad.Right, 0);
                ToolTip.SetToolTip(ValueLabel, changeRate);
                PreviousStockData = stockData;
            }
        }
Beispiel #2
0
        protected void OnStockUpdate(StockData stockData)
        {
            var args = new StockUpdateEventArgs(stockData);

            Volatile.Read(ref StockUpdate)?.Invoke(this, args);
        }