public FxClientSyncfusionViewModel(IFxDataService dataService) { _dataService = dataService; var ratesTable = dataService.FxRates; _sortedRates = new SortedTable(ratesTable); _sortedRates.SortBy(FxTableDefinitions.FxRates.CcyPairId, Comparer <string> .Default); SetTable(_sortedRates); _columnTypes = new Dictionary <string, Type> { { FxTableDefinitions.FxRates.CcyPairId, typeof(string) }, { FxTableDefinitions.FxRates.Bid, typeof(double) }, { FxTableDefinitions.FxRates.Ask, typeof(double) }, { FxTableDefinitions.FxRates.Open, typeof(double) }, { FxTableDefinitions.FxRates.Close, typeof(double) }, { FxTableDefinitions.FxRates.Change, typeof(double) }, { FxTableDefinitions.FxRates.YearRangeStart, typeof(double) }, { FxTableDefinitions.FxRates.YearRangeEnd, typeof(double) }, { FxTableDefinitions.FxRates.Time, typeof(DateTime) }, { FxTableDefinitions.FxRates.Ticks, typeof(double) }, }; Columns = new ObservableCollection <string>(_columnTypes.Keys); dataService.Start(Application.Current.Dispatcher); }
public void TestFillingTable() { var sourceTable = TestTableHelper.CreateReactiveTable(); const int count = 100; var table = new SortedTable(sourceTable); table.SortBy(TestTableColumns.StringColumn, Comparer <string> .Default); AddValuesInReverseOrder(count, sourceTable); CheckValuesAreSorted(count, table); }
public SyncfusionTestViewModel(IAccountBalanceDataService dataService) { var table = dataService.AccountPeople; _accountFilter = (FilteredTable)table.Filter( new DelegatePredicate1 <decimal>(AccountColumns.AccountBalance, b => b > BalanceBelowFilter)); _balanceSort = new SortedTable(_accountFilter); _balanceSort.SortBy(AccountColumns.AccountBalance, Comparer <decimal> .Default); SetTable(_balanceSort); _columnTypes = new Dictionary <string, Type> { { AccountColumns.AccountBalance, typeof(decimal) }, { PersonColumns.IdNameColumn, typeof(string) }, { PersonColumns.NameColumn, typeof(string) }, { PersonAccountColumns.AccountDetails, typeof(string) } }; Columns = new ObservableCollection <string>(_columnTypes.Keys); }
public void TestUpdatingSortKey() { var sourceTable = TestTableHelper.CreateReactiveTable(); const int count = 100; AddValuesInReverseOrder(count, sourceTable); var table = new SortedTable(sourceTable); table.SortBy(TestTableColumns.StringColumn, Comparer <string> .Default); CheckValuesAreSorted(count, table); var rowId = 5; sourceTable.SetValue(TestTableColumns.StringColumn, rowId, "_"); Assert.AreEqual("_", table.GetValue(TestTableColumns.StringColumn, 0)); rowId = 6; sourceTable.SetValue(TestTableColumns.StringColumn, rowId, "X"); Assert.AreEqual("X", table.GetValue(TestTableColumns.StringColumn, count - 1)); }