private void button_Click(object sender, RoutedEventArgs e) { List<DataItem> ds = new List<DataItem>(200); Random r = new Random(); Thread thr = new Thread( ()=> { for (int i = 0; i < 200; i++) { int value = (int)Math.Round(Math.Sin(i) * 10) + 50; DataItem dataitem = new DataItem(); dataitem.Data = value; ds.Add(dataitem); Console.Write(value); Console.Write(" ,"); this.Dispatcher.Invoke(new Action(() => { chart1.SetDataSource(ds); })); Thread.Sleep(200); } }); thr.Start(); }
public DataItemViewModel(DataItem di) { this.Name = di.Name; _matches.Add(new TextSelection(0, this.Name.Substring(0, 2))); }