Ejemplo n.º 1
0
        void CreateDetailsAsync()
        {
            HourModel hour = _place.GetHourOfDay(dpDate.Date.DayOfWeek);

            _startHour = hour.HourStart.Hour;
            _endHour   = hour.HourEnd.Hour;

            gridDetail.RowDefinitions.Clear();
            gridDetail.ColumnDefinitions.Clear();
            _hourToShow = DateTime.Now.Hour;

            if (_binding.Pitches.Count <= 3)
            {
                _rowsToShow = 7;
            }

            AddDetail(true);
        }
Ejemplo n.º 2
0
        public PlaceViewModel(Page page, PlaceModel place) : base(page)
        {
            Place      = place;
            _hourOfDay = place.GetHourOfDay();

            FindCommand      = new Command(async() => { await OpenPageAsync(new FindCourtView()); });
            OpenMapCommand   = new Command(async() => { await OpenPageAsync(new MapView(_place)); });
            ShowTimesCommand = new Command(async() =>
            {
                string[] times = new string[place.Hours.Count];
                int count      = 0;
                foreach (HourModel hour in place.Hours)
                {
                    int numberDay = hour.NumberDay;
                    if (numberDay == 7)
                    {
                        numberDay = 0;
                    }

                    string day = null;
                    if (numberDay == 8)
                    {
                        day = T.GetValue("holydays");
                    }
                    else
                    {
                        day = place.GetDayName(numberDay, DependencyService.Get <ILocalize>().GetCurrentCultureInfo());
                    }

                    times[count] = string.Format("{0}: {1:hh:mm tt} - {2:hh:mm tt}", day, hour.HourStart, hour.HourEnd);
                    count++;
                }

                await _page.DisplayActionSheet("", T.GetValue("close"), null, times);
            });
        }