public override void UpdateData(object data, int connId) { List <CUserVmInstrumentRecord> vm = (List <CUserVmInstrumentRecord>)data; if (!DictStockRecords.ContainsKey(connId)) { DictStockRecords[connId] = new List <CUserVmInstrumentRecord>(); } DictStockRecords[connId] = vm; BindGrid(); /* * if (DictStockRecords.Count == 0 || DictStockRecords[connId].Except(vm).Any()) //differs * { * DictStockRecords = vm; * BindGrid(); * } */ /* * var res = ListStockRecords.FirstOrDefault(a => a.Isin == vm.Isin); * if (res == null) * ListStockRecords.Add(vm); * else * { * * res.VM = vm.VM; * * } */ }
public void BindGrid() { if (_winVM != null) { _winVM.GUIDispatcher.BeginInvoke( new Action(() => { try { //changed 2018-03-28 if (DictStockRecords.ContainsKey(ConIdToShow)) { _winVM.VMControlDatagrid.VMDetailed.ItemsSource = DictStockRecords[ConIdToShow]; _winVM.VMControlDatagrid.VMDetailed.Items.Refresh(); } } catch (Exception e) { Error("DetailedVMWindow.BindGrid", e); } } )); } }