private void Button_Click(object sender, RoutedEventArgs e) { for (int i = 0; i < 100; i++) { CandleModel cm = new CandleModel(); Random r = new Random(); cm.High = r.Next(10, 12); cm.Low = r.Next(7, 10); cm.Open = r.Next((int)cm.Low, (int)cm.High); cm.Close = r.Next((int)cm.Low, (int)cm.High); cm.UporDown = cm.Open < cm.Close; cm.Date = dt; cm.Volume = (new Random()).Next(10, 40); LineModel lm = new LineModel(); lm.Date = dt; lm.LineValue = (new Random()).Next(10, 40); tempLine.Add(lm); dt = dt.AddDays(1); temp.Add(cm); } SetMaxMin(); vm.XaxisEnd = dt.ToShortDateString(); vm.MyList = temp.ToList(); vm.MyLineList = tempLine.ToList(); }
private void CommonMethod_AddOrRemoveFromDataSourceEvent(bool obj) { if (obj) { if (temp.Count == 0) { return; } Removetemp.Add(temp[0]); temp.RemoveAt(0); CandleModel cm = new CandleModel(); Random r = new Random(); cm.High = r.Next(10, 10); cm.Low = r.Next(10, 10); cm.Open = r.Next((int)cm.Low, (int)cm.High); cm.Close = r.Next((int)cm.Low, (int)cm.High); cm.UporDown = cm.Open < cm.Close; cm.Date = dt; dt = dt.AddDays(1); temp.Add(cm); vm.MyList = temp.ToList(); SetMaxMin(); } else { } }