public MainWindow() { InitializeComponent(); window = this; LoadingGif.Visibility = Visibility.Hidden; string url = "http://marketeer.vigilgaming.org/api/v1/gold"; GetGold(url).ContinueWith(t => { ChartValues <double> Values = new ChartValues <double>(); List <string> lLabels = new List <string>(); List <GoldPoint> points = GoldPoint.FromJson(t.Result); Values.AddRange(points.Select(p => (double)p.Price).Reverse()); lLabels.AddRange(points.Select(p => p.Timestamp.Replace('T', ' ').Replace(":00.000Z", "")).Reverse()); Application.Current.Dispatcher.Invoke((Action) delegate { SeriesCollection = new SeriesCollection { new LineSeries { Title = "Gold Prices (72 hours)", Values = Values, Fill = Brushes.Transparent, LineSmoothness = 0, //0: straight lines, 1: really smooth lines //PointGeometry = Geometry.Parse("m 25 70.36218 20 -28 -20 22 -8 -6 z"), PointGeometrySize = 5, PointForeground = Brushes.Gold } }; Labels = lLabels.ToArray(); DataContext = this; }); }); log_window = new Log(); logic = new Logic(log_window); AutoUpdater.Start("http://marketeer.vigilgaming.org/download/updateInfo.xml"); VersionControl.Text = string.Concat("v", Version); Task.Run(() => { logic.StartPCAP(); }); }
public Gold() { InitializeComponent(); string url = "http://marketeer.vigilgaming.org/api/v1/gold"; GetGold(url).ContinueWith(t => { ChartValues <double> Values = new ChartValues <double>(); List <string> lLabels = new List <string>(); List <GoldPoint> points = GoldPoint.FromJson(t.Result); Values.AddRange(points.Select(p => (double)p.Price).Reverse()); lLabels.AddRange(points.Select(p => p.Timestamp.Replace('T', ' ').Replace(":00.000Z", "")).Reverse()); Application.Current.Dispatcher.Invoke((Action) delegate { SeriesCollection = new SeriesCollection { new LineSeries { Title = "Gold Prices (72 hours)", Values = Values, Fill = Brushes.Transparent, LineSmoothness = .5, //0: straight lines, 1: really smooth lines //PointGeometry = Geometry.Parse("m 25 70.36218 20 -28 -20 22 -8 -6 z"), PointGeometrySize = 10, PointForeground = Brushes.Gold } }; Labels = lLabels.ToArray(); DataContext = this; }); }); }