public TradesViewController(IReactiveTrader reactiveTrader, IConcurrencyService concurrencyService)
            : base(UITableViewStyle.Plain)
        {
            _reactiveTrader     = reactiveTrader;
            _concurrencyService = concurrencyService;

            Title            = "Trades";
            TabBarItem.Image = UIImage.FromBundle("tab_trades");

            _model = new TradeTilesModel(_reactiveTrader, _concurrencyService);

            _model.DoneTrades.CollectionChanged += (sender, e) => {
                // todo - handle insertions/removals properly
                UITableView table = this.TableView;

                if (table != null)
                {
                    if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add &&
                        e.NewItems.Count == 1)
                    {
                        table.InsertRows(
                            new [] {
                            NSIndexPath.Create(0, e.NewStartingIndex)
                        }, UITableViewRowAnimation.Top);
                    }
                    else
                    {
                        table.ReloadData();
                    }
                }
            };

            _model.Initialise();
        }
Ejemplo n.º 2
0
 public TradesViewSource(TradeTilesModel tradeTilesModel)
 {
     _tradeTilesModel = tradeTilesModel;
 }