private List<User> GetUsers() { List<User> userList = new List<User>(); Random random = new Random(); for (int i = 0; i < 100; i++) { User user = new User(); user.userId = i + 1000; user.userName = "******" + (i + 1); int num = random.Next(4); if (num == 0) { user.photoRes = Resource.Drawable.one; } else if (num == 1) { user.photoRes = Resource.Drawable.two; } else if (num == 2) { user.photoRes = Resource.Drawable.three; } else if (num == 3) { user.photoRes = Resource.Drawable.four; } userList.Add(user); } return userList; }
private List<User> GetUsers() { List<User> userList = new List<User>(); for (int i = 0; i < 100; i++) { User user = new User(); user.userId = i + 1000; user.userName = "******" + (i + 1); userList.Add(user); } return userList; }
private void FillSimpleView(RecyclerView.ViewHolder vh, User user) { NormalViewHolder normalViewHolder = (NormalViewHolder)vh.JavaCast<NormalViewHolder>(); ; SwipeMenuLayout itemView = (SwipeMenuLayout)normalViewHolder.ItemView.JavaCast<SwipeMenuLayout>(); itemView.Click += delegate { Toast.MakeText(mContext, "Hi " + user.userName, ToastLength.Short).Show(); }; normalViewHolder.btGood.Click += delegate { Toast.MakeText(normalViewHolder.ItemView.Context, "Good ", ToastLength.Short).Show(); }; normalViewHolder.btOpen.Click += delegate { Toast.MakeText(mContext, "Open " + user.userName, ToastLength.Short).Show(); }; normalViewHolder.btDelete.Click += delegate { try { users.RemoveAt(vh.AdapterPosition); mAdapter.NotifyItemRemoved(vh.AdapterPosition); } catch { //有的时候会执行多次点击事件导致报错 } }; normalViewHolder.tvName.Text = user.userName; }
private void FillDifferentView(DifferentViewHolder vh, User user) { DifferentViewHolder differentViewHolder = vh; SwipeMenuLayout itemView = (SwipeMenuLayout)differentViewHolder.ItemView.JavaCast<SwipeMenuLayout>(); differentViewHolder.tvName.Text = user.userName; itemView.Click += delegate { Toast.MakeText(mContext, "Hi " + user.userName, ToastLength.Short).Show(); }; differentViewHolder.btGood.Click += delegate { Toast.MakeText(differentViewHolder.ItemView.Context, "Good ", ToastLength.Short).Show(); }; differentViewHolder.btFavorite.Click += delegate { Toast.MakeText(differentViewHolder.ItemView.Context, "Good " + user.userName, ToastLength.Short).Show(); }; }
/*public void Save(Admin adminUser) { _userContext.InsertOrReplace(adminUser); }*/ public void Save(User[] users) { UserContext.InsertOrReplace(users); }
public void Save(User user) { UserContext.InsertOrReplace(user); }
public IEnumerable<User> GetAllVersions(User givenUser) { return UserContext.GetByIndexedProperty(_userVersionPartitionSchema.PartitionKey, _userVersionPartitionSchema.GetIndexedPropertyFromCriteria(givenUser)); }