public void ShowOrHideListModels(WheelTimerPickerViewModel viewModel)
        {
            if (_oldViewModel == viewModel)
            {
                // click twice on the same item will hide it
                viewModel.IsVisible = !viewModel.IsVisible;
                viewModel.InEdit    = !viewModel.InEdit;
                UpdateViews(viewModel);
            }
            else
            {
                if (_oldViewModel != null)
                {
                    // hide previous selected item
                    _oldViewModel.IsVisible = false;
                    _oldViewModel.InEdit    = false;
                    UpdateViews(_oldViewModel);
                }
                // show selected item
                viewModel.IsVisible = true;
                viewModel.InEdit    = true;
                UpdateViews(viewModel);
            }

            _oldViewModel = viewModel;
        }
        private void UpdateViews(WheelTimerPickerViewModel view)
        {
            var index = TimerPickersViewModel.IndexOf(view);

            TimerPickersViewModel.Remove(view);
            TimerPickersViewModel.Insert(index, view);
        }
        public IntervalsPageViewModel(Tts TextToSpeech, GeolocationService geolocationService)
        {
            TimerPickersViewModel.Add(new WheelTimerPickerViewModel
            {
                Name      = "Walking Duration",
                IsVisible = true,
                InEdit    = true,
                Time      = new TimeSpan(0, 1, 0) //tobind with default val
            });

            TimerPickersViewModel.Add(new WheelTimerPickerViewModel
            {
                Name      = "Running Duration",
                IsVisible = false,
                InEdit    = false,
                Time      = new TimeSpan(0, 1, 0) //to bind with default val
            });

            _locationService = geolocationService;
            _locationService.SpeedErrorrAreaOFMonoticity = 3; // acceptble error area of 2 km/h
            _locationService.PartialSpeedGraphSize       = 15;
            Task.Run(async() => { await _locationService.GetPermissions(); });
            _oldViewModel             = TimerPickersViewModel[0];
            _textToSpeach             = TextToSpeech;
            RightButtonClickedCommand = new Command(() => OnRightButtonClicked());
            EditButtonClickedCommand  = new Command(() => OnEditButtonClicked());
            LeftButtonClickedCommand  = new Command(() => OnLeftButtonClicked());
            StartTimerCommand         = new Command(() => StartTimer());
            PauseTimerCommand         = new Command(() => PauseTimer());
            CancelTimerCommand        = new Command(() => CancelTimer());
        }