Exemplo n.º 1
0
        /*Класс для представления продолжительности игры*/

        public DurationGameViewModel()
        {
            GameChekedCommand = new RelayCommand(Game_Unlimited_Cheked);
            GameUnchekedCommand = new RelayCommand(Game_Unlimited_Unchecked);

            OldDay = TimeSpan.FromMinutes(SelectTour.GameDuration).Days;
            SetTime(SelectTour.GameDuration);

            var days = new List<int>();
            for (var i = 0; i < DaysInWeek + 1; i++)
                days.Add(i);

            DaysList = new ListLoopingDataSource<int> {Items = days, SelectedItem = OldDay};
            SetEnabledTimePicker(!SelectTour.IsGameUnlimited);
            IsChecked = SelectTour.IsGameUnlimited;
        }
Exemplo n.º 2
0
        private void LoadLists()
        {
            _dayList = new ListLoopingDataSource<int> { Items = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }, SelectedItem = DateTime.Now.Day, Tag = "day"};
            _monthList = new ListLoopingDataSource<int> { Items = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }, SelectedItem = DateTime.Now.Month, Tag = "month"};
            var years = new List<int>();
            for (var i = 2009; i <= DateTime.Now.Year; i++)
            {
                years.Add(i);
            }
            _yearList = new ListLoopingDataSource<int> { Items = years, SelectedItem = DateTime.Now.Year, Tag = "year"};

            SelectorDay.DataSource = _dayList;
            SelectorMonth.DataSource = _monthList;
            SelectorYear.DataSource = _yearList;

            _dayList.SelectionMoved += List_SelectionMoved;
            _monthList.SelectionMoved += List_SelectionMoved;
            _yearList.SelectionMoved += List_SelectionMoved;
        }
Exemplo n.º 3
0
        protected void SetTime(int duration)
        {
            var time = TimeSpan.FromMinutes(duration);

            var hours = new List<int>();
            var min = new List<int>();
            for (var i = 0; i < MinuteInHour; i++)
            {
                if (hours.Count != HoursInDay)
                    hours.Add(i);

                if (min.Count != MinuteInHour)
                    min.Add(i);
            }
            OldHour = time.Hours;
            OldMin = time.Minutes;

            HoursList = new ListLoopingDataSource<int> {Items = hours, SelectedItem = OldHour};
            MinList = new ListLoopingDataSource<int> {Items = min, SelectedItem = OldMin};
        }