public UITableViewCell Load(Torrent torrent) { _title.Text = torrent.Name; _status.Text = torrent.StatusString; _progress.Progress = (float)torrent.PercentProgress / 1000f; _eta.Text = torrent.EtaString; _up.Text = torrent.UpBps; _down.Text = torrent.DownBps; return _cell; }
protected virtual void Initialize() { var container = TinyIoCContainer.Current; _server = container.Resolve<Server>(); _hub = container.Resolve<ITinyMessengerHub>(); _hub.Subscribe<TorrentDetailsMessage>(m => { _torrent = m.Torrent; _torrentDetailsController.TableView.ReloadData(); _torrentDetailsController.TableView.SetContentOffset(PointF.Empty, false); _navigationController.PushViewController(_torrentDetailsController, true); }); _hub.Subscribe<TorrentChangedMessage>(m => Execute.BeginInvoke(() => { if (_torrent != null && _torrent.ID == m.Torrent.ID) { if (m.Removed) { _navigationController.PopViewControllerAnimated(true); } else { _torrent = m.Torrent; _torrentDetailsController.TableView.ReloadData(); } } })); for (int i = 0; i < _cells.Length; i++) { _cells[i] = new UITableViewCell(UITableViewCellStyle.Value1, string.Empty) { SelectionStyle = UITableViewCellSelectionStyle.None, }; } }
public TorrentDetailsMessage(object sender, Torrent torrent) : base(sender) { Torrent = torrent; }