Esempio n. 1
0
        List <StockDataPoint> CreateDataSource()
        {
            XDocument             document = DataLoader.LoadXmlFromResources("/Data/Dell.xml");
            List <StockDataPoint> result   = new List <StockDataPoint>();

            if (document != null)
            {
                IEnumerable <XElement> elements   = document.Element("Dell").Elements();
                IEnumerator            enumerator = elements.GetEnumerator();
                enumerator.MoveNext();
                StockDataPoint previousPoint = ReadDataPointFrpmXML((XElement)(enumerator.Current));

                foreach (XElement element in elements)
                {
                    StockDataPoint point = ReadDataPointFrpmXML(element);
                    point.ToolTipData.OpenDynamic    = GetStockDynamic(previousPoint.Open, point.Open).ImageSource;
                    point.ToolTipData.CloseDynamic   = GetStockDynamic(previousPoint.Close, point.Close).ImageSource;
                    point.ToolTipData.HighDynamic    = GetStockDynamic(previousPoint.High, point.High).ImageSource;
                    point.ToolTipData.LowDynamic     = GetStockDynamic(previousPoint.Low, point.Low).ImageSource;
                    point.ToolTipData.OpenFontBrush  = GetStockDynamic(previousPoint.Open, point.Open).Brush;
                    point.ToolTipData.CloseFontBrush = GetStockDynamic(previousPoint.Close, point.Close).Brush;
                    point.ToolTipData.HighFontBrush  = GetStockDynamic(previousPoint.High, point.High).Brush;
                    point.ToolTipData.LowFontBrush   = GetStockDynamic(previousPoint.Low, point.Low).Brush;
                    result.Add(point);
                    previousPoint = point;
                }
            }
            return(result);
        }
Esempio n. 2
0
        StockDataPoint ReadDataPointFrpmXML(XElement element)
        {
            StockDataPoint point = new StockDataPoint();

            point.TradeDate         = Convert.ToDateTime(element.Element("Argument").Value, CultureInfo.InvariantCulture);
            point.Open              = Convert.ToDecimal(element.Element("OpenValue").Value, CultureInfo.InvariantCulture);
            point.Close             = Convert.ToDecimal(element.Element("CloseValue").Value, CultureInfo.InvariantCulture);
            point.Low               = Convert.ToDecimal(element.Element("LowValue").Value, CultureInfo.InvariantCulture);
            point.High              = Convert.ToDecimal(element.Element("HighValue").Value, CultureInfo.InvariantCulture);
            point.ToolTipData       = new ToolTipStockData();
            point.ToolTipData.Owner = point;
            return(point);
        }