private void HookModelToView(View view, DriverResponseModel driverResponseModel) { TextView driverResponseTextView = view.FindViewById <TextView>(Resource.Id.driverResponseTextView); driverResponseTextView.Text = driverResponseModel.GetBriefInfo(); Button callToDriverAfterResponseButton = view.FindViewById <Button>(Resource.Id.callToDriverAfterResponseButton); callToDriverAfterResponseButton.Click += (sender, e) => { if (!_model.CallToDriver(driverResponseModel.ResponseAuthor).IsValid) { using (Toast errorToast = Toast.MakeText(Application.Context, Resource.String.PhoneCallError, ToastLength.Short)) errorToast.Show(); } }; }
private void HookModelToDetailsView(View view, DriverModel driverModel) { _model.SelectedDriver = driverModel; view.Click += (sender, e) => { CloseDriverInfoPopupWindow(); UIHelper.GoResultActivity(_context, typeof(PedestrianProfileRequestActivity), 1); }; Button quickCallToDriverButton = view.FindViewById <Button>(Resource.Id.quickCallToDriverButton); quickCallToDriverButton.Click += (sender, e) => { if (!_model.CallToDriver(driverModel).IsValid) { using (Toast errorToast = Toast.MakeText(Application.Context, Resource.String.PhoneCallError, ToastLength.Short)) errorToast.Show(); } CloseDriverInfoPopupWindow(); }; TextView driverPopupCarBrandTextView = view.FindViewById <TextView>(Resource.Id.driverPopupCarBrandTextView); TextView driverPopupCarColorTextView = view.FindViewById <TextView>(Resource.Id.driverPopupCarColorTextView); TextView driverPopupCarNumberTextView = view.FindViewById <TextView>(Resource.Id.driverPopupCarNumberTextView); TextView driverPopupPersonNameTextView = view.FindViewById <TextView>(Resource.Id.driverPopupPersonNameTextView); TextView driverPopupPhoneNumberTextView = view.FindViewById <TextView>(Resource.Id.driverPopupPhoneNumberTextView); TextView driverPopupSkypeNumberTextView = view.FindViewById <TextView>(Resource.Id.driverPopupSkypeNumberTextView); driverPopupPersonNameTextView.Text = driverModel.PersonName; driverPopupCarColorTextView.Text = driverModel.CarColor; driverPopupCarBrandTextView.Text = driverModel.CarBrand; driverPopupCarNumberTextView.Text = driverModel.CarNumber; driverPopupPhoneNumberTextView.Text = driverModel.PhoneNumber; driverPopupSkypeNumberTextView.Text = driverModel.SkypeNumber; TextView driverAgreesTextView = view.FindViewById <TextView>(Resource.Id.driverAgreesTextView); if (driverModel.HasAcceptedRequest) { driverAgreesTextView.Visibility = ViewStates.Visible; } driverModel.HasAcceptedRequestChanged += (sender, e) => driverAgreesTextView.Visibility = driverModel.HasAcceptedRequest ? ViewStates.Visible : ViewStates.Gone; }