private void DatePicker_DateSelected(object sender, DateChangedEventArgs e)
        {
            (BindingContext as MccheyneViewModel).today = e.NewDate.ToString("M_d");
            DateTime thisDate = MccheyneViewModel.GetCorrectDateLeapYear(e.NewDate);

            (BindingContext as MccheyneViewModel).GetMccheyne(thisDate);
            (BindingContext as MccheyneViewModel).GetMccheyneRange(thisDate);
        }
        public MccheynePage(/*MccheyneViewModel mccheyneViewModel*/)
        {
            InitializeComponent();
            BindingContext = new MccheyneViewModel();//mccheyneViewModel;

            gridX = bottomGrid.TranslationX;
            gridY = bottomGrid.TranslationY;

            var leftSwipeGesture = new SwipeGestureRecognizer {
                Direction = SwipeDirection.Left
            };
            var rightSwipeGesture = new SwipeGestureRecognizer {
                Direction = SwipeDirection.Right
            };

            leftSwipeGesture.Swiped  += OnLeftSwiped;
            rightSwipeGesture.Swiped += OnRightSwiped;

            mccheyneView.GestureRecognizers.Add(leftSwipeGesture);
            mccheyneView.GestureRecognizers.Add(rightSwipeGesture);
        }
Exemple #3
0
        public MccheynePage()
        {
            InitializeComponent();
            Padding        = new Thickness(0, Constants.StatusBarHeight, 0, 0);
            BindingContext = new MccheyneViewModel();

            MessagingCenter.Subscribe <MainTabbedPage>(this, MessagingCenterMessage.ScrollMccheyneToTop, (sender) =>
            {
                mccheyneCollectionView.ScrollTo(0);
            });

            MessagingCenter.Subscribe <MccheyneCheckListPage, DateTime>(this, "goToReadTapped", (s, date) =>
            {
                datepicker.Date = date;
            });

            MessagingCenter.Subscribe <MccheyneUnReadCheckListPage, DateTime>(this, "goToReadTapped", (s, date) =>
            {
                datepicker.Date = date;
            });
        }
Exemple #4
0
        private async void OnDatePickerDateSelected(object sender, DateChangedEventArgs e)
        {
            if (!(BindingContext is MccheyneViewModel viewModel))
            {
                return;
            }

            viewModel.Today = e.NewDate.ToString("M_d");
            viewModel.CurrentSettedDateTime = MccheyneViewModel.GetCorrectDateLeapYear(e.NewDate);

            viewModel.IsRefreshing = true;

            var task1 = viewModel.GetMccheyne();
            var task2 = viewModel.GetMccheyneRange();
            await Task.WhenAll(task1, task2);

            viewModel.SetTodayCheckList();

            viewModel.IsRefreshing = false;

            DependencyService.Get <IHapticFeedback>().Run();

            mccheyneCollectionView.ScrollTo(0);
        }