protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); ViewModel = new QuestionDetailViewModel(Intent.GetStringExtra("questionId")); title = FindViewById <TextView>(Resource.Id.question_view_item_title); answerCount = FindViewById <TextView>(Resource.Id.textAnswerCount); answerBtn = FindViewById <Button>(Resource.Id.btnAnswer); recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); recyclerView.HasFixedSize = false; recyclerView.AddItemDecoration(new DividerItemDecoration(recyclerView.Context, DividerItemDecoration.Vertical)); recyclerView.SetAdapter(adapter = new BrowseItemsAdapter(this, ViewModel)); refresher = FindViewById <SwipeRefreshLayout>(Resource.Id.refresher); refresher.SetColorSchemeColors(Resource.Color.accent); answerBtn.Click += (sender, e) => { var intent = new Intent(this, typeof(AnswerActivity)); intent.PutExtra("data", ViewModel.Question.ObjectId); StartActivity(intent); }; }
void Refresher_Refresh(object sender, EventArgs e) { ViewModel.LoadQuestionDetailCommand.Execute(null); recyclerView.SetAdapter(adapter = new BrowseItemsAdapter(this, ViewModel)); refresher.Refreshing = false; }