public override void Refresh() { //tags var selectedTags = Tags .Where(x => x.IsChecked) .Select(x => x.Item) .ToList(); Tags.Clear(); foreach (var checkItem in Context .Tags .OrderBy(x => x.Name) .ToList() .Select(x => new CheckListItem <Tag>(x, selectedTags.Contains(x)))) { Tags.Add(checkItem); } //strategies var selectedStrats = Strategies .Where(x => x.IsChecked) .Select(x => x.Item) .ToList(); Strategies.Clear(); foreach (var checkItem in Context .Strategies .OrderBy(x => x.Name) .ToList() .Select(x => new CheckListItem <Strategy>(x, selectedStrats.Contains(x)))) { Strategies.Add(checkItem); } //benchmarks Benchmarks.Clear(); foreach (Benchmark b in Context.Benchmarks.OrderBy(x => x.Name)) { Benchmarks.Add(b); } }
public override void Refresh() { //tags var selectedTags = Tags .Where(x => x.IsChecked) .Select(x => x.Item) .ToList(); Tags.Clear(); foreach (var checkItem in Context .Tags .OrderBy(x => x.Name) .ToList() .Select(x => new CheckListItem <Tag>(x, selectedTags.Contains(x)))) { Tags.Add(checkItem); } //strategies var selectedStrats = Strategies .Where(x => x.IsChecked) .Select(x => x.Item) .ToList(); Strategies.Clear(); foreach (var checkItem in Context .Strategies .OrderBy(x => x.Name) .ToList() .Select(x => new CheckListItem <Strategy>(x, selectedStrats.Contains(x)))) { Strategies.Add(checkItem); } //Instruments if (Instruments.Count == 0) { //on first load we want all instruments selected, otherwise remember previous selection foreach (var checkItem in Context .Instruments .OrderBy(x => x.Symbol) .ToList() .Select(x => new CheckListItem <Instrument>(x, true))) { Instruments.Add(checkItem); } } else { var selectedInstruments = Instruments .Where(x => x.IsChecked) .Select(x => x.Item) .ToList(); Instruments.Clear(); foreach (var checkItem in Context .Instruments .OrderBy(x => x.Symbol) .ToList() .Select(x => new CheckListItem <Instrument>(x, selectedInstruments.Contains(x)))) { Instruments.Add(checkItem); } } //benchmarks Benchmarks.Clear(); foreach (Benchmark b in Context.Benchmarks.OrderBy(x => x.Name)) { Benchmarks.Add(b); } //backtest results from the external data source BacktestSeries.Clear(); if (Datasourcer.ExternalDataSource.Connected) { BacktestSeries.AddRange( Datasourcer .ExternalDataSource .GetBacktestSeries()); } }