public void AddItemToDownload(IVideoItem item)
 {
     SelectedCountry = Countries.First(x => x.Key == dlindex);
     if (!SelectedCountry.Value.Select(x => x.ID).Contains(item.ID))
     {
         SelectedCountry.Value.Add(item);
     }
     RefreshItems();
 }
        public RegistrationViewModel(ApplicationManager appManager)
        {
            _appManager          = appManager;
            _countriesRepository = new CountriesRepository();

            SelectedCountry = Countries.First();
            SelectedSex     = Sexes.First();
            SelectedAge     = Ages.First();
        }
        private void SetNextState()
        {
            this.state = this.state != ResultsState.TwelvePoints ? this.state + 1 : ResultsState.RevealCountry;

            if (this.state == ResultsState.SplashScreen)
            {
                Messenger.Default.Send(new ReadyForLateVotesMessage());
            }

            if (this.state == ResultsState.RevealCountry)
            {
                if (Countries.Count(c => c.IsInQueue) > 0)
                {
                    this.currentlyRevealedCountry = GetSelectedCountry();
                }
                else
                {
                    this.state = ResultsState.RevealWinner;
                }
            }

            if (this.state == ResultsState.TwelvePoints)
            {
                if (this.currentlyRevealedCountry != null)
                {
                    this.currentlyRevealedCountry.IsSelected = false;
                    this.currentlyRevealedCountry.IsInQueue  = false;

                    if (Countries.Count(c => c.IsInQueue) > 0)
                    {
                        if (Countries.Count(c => c.IsInQueue && c.IsSelected) == 0)
                        {
                            Countries.First(c => c.IsInQueue).IsSelected = true;
                        }
                    }
                }
            }

            var selectedCountryId = Countries.FirstOrDefault(c => c.IsSelected)?.Id;

            Model.Country nextCountry = null;
            if (selectedCountryId.HasValue)
            {
                nextCountry = dataService.GetCountry(selectedCountryId.Value);
            }

            Messenger.Default.Send(new ChangeStateMessage(this.state, nextCountry));
            NextCommand.RaiseCanExecuteChanged();
        }
Ejemplo n.º 4
0
        public void OnGet()
        {
            Continents = _locationRepo.GetContinents()
                         .Select(x => new SelectListItem()
            {
                Value = x, Text = x
            })
                         .ToList();
            SelectedContinent = Continents.First().Value;

            Countries = _locationRepo.GetCountries(SelectedContinent)
                        .Select(x => new SelectListItem()
            {
                Value = x, Text = x
            })
                        .ToList();
            SelectedCountry = Countries.First().Value;
        }
Ejemplo n.º 5
0
        public async Task GetPickerValues()
        {
            var countriesList = await CountryDataStore.GetItemsAsync();

            foreach (Country c in countriesList)
            {
                Countries.Add(c);
            }

            SelectedCountry = Countries.First(x => x.Id == Model.Country.Id);


            var citiesList = await CityDataStore.GetItemsAsync();

            foreach (var item in citiesList)
            {
                Cities.Add(item);
            }

            SelectedCity = Cities.First(x => x.Id == Model.City.Id);


            var seasonsList = await SeasonDataStore.GetItemsAsync();

            foreach (var item in seasonsList)
            {
                Seasons.Add(item);
            }

            SelectedSeason = Seasons.First(x => x.Id == Model.Season.Id);


            var currenciesList = await CurrencyDataStore.GetItemsAsync();

            foreach (var item in currenciesList)
            {
                Currencies.Add(item);
            }

            SelectedCurrency = Currencies.First(x => x.Id == Model.Currency.Id);

            IsBusy = false;
        }
        public async Task Search(Dictionary <string, string> dic)
        {
            if (string.IsNullOrEmpty(SearchKey))
            {
                return;
            }

            switch (SelectedSite.Cred.Site)
            {
            case SiteType.YouTube:

                if (SelectedCountry.Key == dlindex)
                {
                    SelectedCountry = Countries.First();
                }

                SelectedCountry.Value.Clear();

                List <VideoItemPOCO> lst = await YouTubeSite.SearchItemsAsync(SearchKey, SelectedCountry.Key, 50).ConfigureAwait(true);

                if (lst.Any())
                {
                    foreach (IVideoItem item in lst.Select(poco => VideoItemFactory.CreateVideoItem(poco, SiteType.YouTube)))
                    {
                        item.IsHasLocalFileFound(DirPath);
                        string title;
                        if (dic.TryGetValue(item.ParentID, out title))
                        {
                            // подсветим видео, если канал уже есть в подписке
                            item.SyncState   = SyncState.Added;
                            item.ParentTitle = title;
                            item.WatchState  = await db.GetItemWatchStateAsync(item.ID).ConfigureAwait(false);
                        }
                        SelectedCountry.Value.Add(item);
                    }
                    RefreshItems();
                }
                break;
            }
        }
Ejemplo n.º 7
0
 protected override void Given()
 {
     base.Given();
     _expected = Countries.First();
 }