コード例 #1
0
 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;
 }
コード例 #2
0
 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;
 }
コード例 #3
0
            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;
            }
コード例 #4
0
 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(); };
 }
コード例 #5
0
 /*public void Save(Admin adminUser) { _userContext.InsertOrReplace(adminUser); }*/
 public void Save(User[] users)
 {
     UserContext.InsertOrReplace(users);
 }
コード例 #6
0
 public void Save(User user)
 {
     UserContext.InsertOrReplace(user);
 }
コード例 #7
0
 public IEnumerable<User> GetAllVersions(User givenUser)
 {
     return UserContext.GetByIndexedProperty(_userVersionPartitionSchema.PartitionKey, _userVersionPartitionSchema.GetIndexedPropertyFromCriteria(givenUser));
 }