Пример #1
0
        public static DateTimePickerFragment NewInstance(Action <DateTime> onDateSelected, DateTime?lastDate = null)
        {
            var fragment = new DateTimePickerFragment {
                dateSelectedHandler = onDateSelected
            };

            DateTimePickerFragment.lastDate = lastDate;

            return(fragment);
        }
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.menu_schedule_datetimepicker:
                DateTime?lastDate = null;      //TODO
                var      frag     = DateTimePickerFragment.NewInstance(time =>
                {
                    viewPager.Adapter = null;
                    adapter           = new ScheduleFragmentAdapter(((AppCompatActivity)Activity).SupportFragmentManager,
                                                                    tabLayout.TabCount, time, time.DayOfYear);
                    viewPager.Adapter = adapter;
                    lastDate          = time; //TODO
                }, lastDate);

                frag.Show(Activity.SupportFragmentManager, DateTimePickerFragment.DateTimePickerTag);     //TODO
                return(true);

            default:
                return(base.OnOptionsItemSelected(item));
            }
        }