Exemplo n.º 1
0
 void SelectedSpeciesChanged(object sender, SelectedItemChangedEventArgs <ModelNameBase> e)
 {
     FormList = null;
     if (e.NewItem != null)
     {
         _cachedSpeciesId = e.NewItem.Id;
         FormList         = NotifyTaskCompletionCollection <ModelNameBase> .Create(LoadFormsAsync(), _cachedFormId);
     }
 }
Exemplo n.º 2
0
 void SelectedAbilityChanged(object sender, SelectedItemChangedEventArgs <ModelNameBase> e)
 {
     CurrentAbility = null;
     PokemonList    = null;
     if (e.NewItem != null)
     {
         CurrentAbility = NotifyTaskCompletion.Create(LoadAbilityByIdAsync(e.NewItem.Id));
         PokemonList    = NotifyTaskCompletionCollection <PokemonAbility> .Create(LoadPokemonByAbilityAsync(e.NewItem.Id));
     }
 }
Exemplo n.º 3
0
        void Versions_SelectedItemChanged(object sender, SelectedItemChangedEventArgs <GameVersion> e)
        {
            SpeciesList = null;
            if (e.NewItem != null)
            {
                SpeciesList = NotifyTaskCompletionCollection <SpeciesName> .Create(LoadSpeciesAsync(e.NewItem, _currentLanguage), _cachedSpeciesId);

                _cachedVersionid = e.NewItem.Id;
            }
        }
Exemplo n.º 4
0
 protected override void ChangeVersion(GameVersion newVersion)
 {
     SelectedAbility = null;
     base.ChangeVersion(newVersion);
     if (newVersion != null)
     {
         Abilities = NotifyTaskCompletionCollection <Ability> .Create(LoadAbilitiesAsync(CurrentVersion.VersionGroup, CurrentLanguage), _cachedAbilityId);
     }
     //SelectedAbilityChanged(this, new SelectedItemChangedEventArgs<Ability>(null, new Ability { Id = _cachedAbilityId }));
 }
Exemplo n.º 5
0
 public TestViewModel(ITestService testService, INavigationService navigationService, IStaticDataService staticDataService)
 {
     _tokenSource       = new CancellationTokenSource();
     _testService       = testService;
     _navigationService = navigationService;
     _staticDataService = staticDataService;
     _dispatcher        = CoreWindow.GetForCurrentThread().Dispatcher;
     _testService.InitializeResources(6, _tokenSource.Token);
     Versions = NotifyTaskCompletionCollection <GameVersion> .Create(LoadVersionsNewAsync(6));
 }
Exemplo n.º 6
0
        void SpeciesList_SelectedItemChanged(object sender, SelectedItemChangedEventArgs <SpeciesName> e)
        {
            Forms             = null;
            CurrentEvolutions = null;
            CurrentLocations  = null;
            if (e.NewItem != null)
            {
                Forms = NotifyTaskCompletionCollection <PokemonForm> .Create(LoadFormsAsync(e.NewItem, Versions.SelectedItem, _currentLanguage));

                CurrentEvolutions = NotifyTaskCompletion.Create(LoadEvolutionsAsync(e.NewItem.Id, Versions.SelectedItem, _currentLanguage));
                CurrentLocations  = NotifyTaskCompletion.Create(LoadLocationsAsync(e.NewItem.Id, Versions.SelectedItem, _currentLanguage));
                _cachedSpeciesId  = e.NewItem.Id;
            }
        }
Exemplo n.º 7
0
 void ChangeLanguage(Language newLanguage)
 {
     _currentLanguage = newLanguage.Id;
     Versions         = null;
     SpeciesList      = null;
     Forms            = null;
     CurrentForm      = null;
     CurrentMoveSet   = null;
     if (newLanguage != null)
     {
         ResetLanguage(newLanguage.Id);
         Versions = NotifyTaskCompletionCollection <GameVersion> .Create(LoadVersionsAsync(newLanguage.Id), _cachedVersionid);
     }
 }
Exemplo n.º 8
0
        /// <summary>
        /// Initializes a new instance of the SettingsViewModel
        /// </summary>
        /// <param name="staticDataService">A service implemtation</param>
        public SettingsViewModel(IStaticDataService staticDataService, INavigationService navigationService)
        {
            _tokenSource       = new CancellationTokenSource();
            _staticDataService = staticDataService;
            _navigationService = navigationService;

            int displayLanguage = 6;

            AppSettings = ApplicationData.Current.LocalSettings;
            object lang = AppSettings.Values["displayLanguage"];

            if (lang != null)
            {
                displayLanguage = Convert.ToInt32(lang);
            }

            Languages = NotifyTaskCompletionCollection <Language> .Create(LoadLanguagesAsync(displayLanguage), displayLanguage);
        }
Exemplo n.º 9
0
        public PokemonViewModel(IStaticDataService staticDataService, IPokemonService pokemonService, INavigationService navigationService)
        {
            _tokenSource       = new CancellationTokenSource();
            _staticDataService = staticDataService;
            _pokemonService    = pokemonService;
            _navigationService = navigationService;

            var    settings = ApplicationData.Current.LocalSettings;
            object lang     = settings.Values["displayLanguage"];

            if (lang != null)
            {
                _currentLanguage = Convert.ToInt32(lang);
            }
            else
            {
                _currentLanguage = 6;
            }

            ChangeLanguage(new Language {
                Id = _currentLanguage
            });
            Messenger.Default.Register <Language>(this, (language) => ChangeLanguage(language));

            if (IsInDesignMode)
            {
                Versions = NotifyTaskCompletionCollection <GameVersion> .Create(LoadVersionsAsync(_currentLanguage));

                SpeciesList = NotifyTaskCompletionCollection <SpeciesName> .Create(LoadSpeciesAsync(null, _currentLanguage));

                Forms = NotifyTaskCompletionCollection <PokemonForm> .Create(LoadFormsAsync(new SpeciesName {
                    Id = 1
                }, null, _currentLanguage));

                CurrentForm       = NotifyTaskCompletion.Create(LoadFormAsync(1, null, _currentLanguage));
                CurrentMoveSet    = NotifyTaskCompletion.Create(LoadMoveSetAsync(6, null, _currentLanguage));
                CurrentStats      = NotifyTaskCompletion.Create(LoadStatsAsync(6, null, _currentLanguage));
                CurrentEvolutions = NotifyTaskCompletion.Create(LoadEvolutionsAsync(6, null, _currentLanguage));
                CurrentLocations  = NotifyTaskCompletion.Create(LoadLocationsAsync(6, null, _currentLanguage));
            }
        }
Exemplo n.º 10
0
 /// <summary>
 /// Reacts to changes of the current version
 /// </summary>
 /// <param name="newVersion">The new version</param>
 protected override void ChangeVersion(GameVersion newVersion)
 {
     base.ChangeVersion(newVersion);
     AbilityList = NotifyTaskCompletionCollection <ModelNameBase> .Create(LoadAbilitiesAsync, _cachedAbilityId);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AbilityViewModel"/> class
 /// </summary>
 /// <param name="dataService">The service that is responsible for data loading</param>
 public AbilityViewModel(IDataService dataService) : base()
 {
     _dataService = dataService;
     AbilityList  = NotifyTaskCompletionCollection <ModelNameBase> .Create(LoadAbilitiesAsync, _cachedAbilityId);
 }
Exemplo n.º 12
0
 void ChangeLanguage(DisplayLanguage newLanguage)
 {
     _currentLanguage = newLanguage;
     VersionList      = NotifyTaskCompletionCollection <GameVersion> .Create(LoadVersionsAsync, _cachedVersionId);
 }
Exemplo n.º 13
0
 protected override void ChangeVersion(GameVersion newVersion)
 {
     PokemonList = null;
     base.ChangeVersion(newVersion);
     PokemonList = NotifyTaskCompletionCollection <ModelNameBase> .Create(LoadPokemonAsync(), _cachedSpeciesId);
 }