void OnItemClick(object sender, int position) { if (pageVM.FriendsList[position].IsActive) { var po = new FriendPO(pageVM.FriendsList[position]); var intent = new Intent(this, typeof(FriendDetailsActivity)); intent.PutExtra(nameof(FriendPO), po); StartActivity(intent); } }
UserDTO GetUserInfo() { var fPO = new FriendPO(); if (Intent.Extras != null) { fPO = Intent.GetParcelableExtra(nameof(FriendPO)) as FriendPO; return(fPO.ToUserDTO()); } return(null); }
void OnItemClick(object sender, int position) { Intent intent; if (Info[position] is TitleWithInfoItemVM) { var cell = Info[position] as TitleWithInfoItemVM; switch (cell.Type) { case UserInfoType.Phone: intent = new Intent(Intent.ActionDial); intent.SetData(Android.Net.Uri.Parse("tel:" + cell.Info)); if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.CallPhone) != Android.Content.PM.Permission.Granted) { ActivityCompat.RequestPermissions(this, new[] { Manifest.Permission.CallPhone }, 1); } else { StartActivity(intent); } break; case UserInfoType.Email: intent = new Intent(Intent.ActionSendto); intent.SetData(Android.Net.Uri.FromParts("mailto", cell.Info, null)); StartActivity(intent); break; case UserInfoType.Location: intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse("geo:" + cell.Info)); StartActivity(intent); break; } } else if (Info[position] is FriendItemVM && (Info[position] as FriendItemVM).IsActive) { var friend = Info[position] as FriendItemVM; foreach (var user in CoreContext.Cache) { if (user.Id == friend.Id) { var po = new FriendPO(user); intent = new Intent(this, typeof(FriendDetailsActivity)); intent.PutExtra(nameof(FriendPO), po); StartActivity(intent); break; } } } }