// Notes: // - The exchange has a total and a held value. // - For a given fund, the maximum it can be allocated is the exchange's 'available' amount // plus the held amount of the fund, because the funds total includes it's held amount. public FundAllocationsUI(Window owner, Model model) { InitializeComponent(); Icon = owner?.Icon; Owner = owner; Model = model; Filter = new CoinFilter(x => (CoinDataAdapter)x); Exchanges = new ListCollectionView(model.TradingExchanges.ToList()); Funds = new ListCollectionView(model.Funds) { Filter = x => ((Fund)x).Id != Fund.Main }; Coins = new ListCollectionView(ListAdapter.Create(model.Coins, x => new CoinDataAdapter(this, x), x => x.CoinData)) { Filter = Filter.Predicate }; Exchanges.CurrentChanged += delegate { Coins.Refresh(); }; Funds.CurrentChanged += delegate { Coins.Refresh(); }; Filter.PropertyChanged += delegate { Coins.Refresh(); }; Accept = Command.Create(this, Close); DataContext = this; }
public List <Coin> GetFilter([FromQuery] CoinFilter filter) { if (filter.HoejtBud == 0) { filter.HoejtBud = int.MaxValue; } return(coins.FindAll(c => filter.LavBud <= c.Bud && c.Bud <= filter.HoejtBud)); }