コード例 #1
0
        void CommitCreation(string name, DatePicker datepicker, TimePicker timepicker)
        {
            RememberThing rememberThing = new RememberThing();

            rememberThing.Name = name;

            int hours   = 0;
            int minutes = 0;
            int seconds = 0;

            // Init values
            if (Build.VERSION.SdkInt >= BuildVersionCodes.M)
            {
                hours   = timepicker.Hour;
                minutes = timepicker.Minute;
            }
            else
            {
                hours   = timepicker.CurrentHour.IntValue();
                minutes = timepicker.CurrentMinute.IntValue();
            }

            rememberThing.Deadline = new DateTime(datepicker.DateTime.Year, datepicker.DateTime.Month,
                                                  datepicker.DateTime.Day, hours, minutes, seconds);

            adapter.RememberThings.Insert(0, rememberThing);
            adapter.NotifyItemInserted(0);
        }
コード例 #2
0
        /// <summary>
        /// Populates the list.
        /// </summary>
        void PopulateList()
        {
            // Let's create some dummy elements
            RememberThing thing1 = new RememberThing();

            thing1.Name     = "Bring the milk";
            thing1.Deadline = DateTime.Now.AddMinutes(10);

            RememberThing thing2 = new RememberThing();

            thing2.Name     = "Bring the bread";
            thing2.Deadline = DateTime.Now.AddMinutes(20);

            List <RememberThing> rememberThings = new List <RememberThing>();

            rememberThings.Add(thing1);
            rememberThings.Add(thing2);

            adapter = new RememberThingsAdapter(rememberThings);
            recyclerView.SetAdapter(adapter);
        }
コード例 #3
0
            public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
            {
                RememberThing rememberThing = RememberThings[position];

                (holder as RememberThingsViewHolder).BindViewHolder(rememberThing);
            }
コード例 #4
0
 public void BindViewHolder(RememberThing rememberThing)
 {
     name.Text     = rememberThing.Name;
     deadline.Text = rememberThing.Deadline.ToString();
 }