public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (_view != null) { ViewGroup parent = (ViewGroup)_view.Parent; if (parent != null) { parent.RemoveView(_view); } } try { this.Log().Debug("OnCreateView"); _view = inflater.Inflate(Resource.Layout.f_watchlist, container, false); this.WireUpControls(_view, "watchList"); var adapter = new ReactiveListAdapter <WatchListItemViewModel>( ViewModel.WatchList, (viewModel, parent) => new WatchListItemView(viewModel, this.Activity, parent)); Listview.Adapter = adapter; Listview.OnItemClickListener = this; if (_activatedSubscription == null && _deactivatedSubscription == null) { _activatedSubscription = Activated.Subscribe(r => this.Log().Debug("Activated")); _deactivatedSubscription = Deactivated.Subscribe(r => this.Log().Debug("Deactivated")); } } catch (InflateException e) { /* view is already there, just return view as it is */ } return(_view); }
protected FragmentBase() { Activated.Subscribe(ActivatedAction); Deactivated.Subscribe(DeactivatedAction); }