示例#1
0
        /// <summary>
        /// Selects a specific game for which to view the store.
        /// </summary>
        /// <param name="library">The selected library.</param>
        private void SelectLibrary(Library library)
        {
            BrowseViewModel.GetInstance().Navigate(NavigationPage.LibraryEdit);

            Task.Run(() =>
            {
                try
                {
                    this.IsLibraryLoading = true;

                    // Deselect current library
                    this.ActiveLibrary   = null;
                    this.CheatsAvailable = null;
                    this.CheatsInLibrary = null;
                    this.RaisePropertyChanged(nameof(this.CheatsAvailable));
                    this.RaisePropertyChanged(nameof(this.CheatsInLibrary));

                    // Select library
                    AccessTokens accessTokens   = SettingsViewModel.GetInstance().AccessTokens;
                    LibraryCheats libraryCheats = SqualrApi.GetCheats(accessTokens.AccessToken, library.LibraryId);
                    SqualrApi.SetActiveLibrary(accessTokens.AccessToken, library.LibraryId);

                    this.ActiveLibrary   = library;
                    this.CheatsAvailable = new ObservableCollection <Cheat>(libraryCheats.CheatsAvailable);
                    this.CheatsInLibrary = new ObservableCollection <Cheat>(libraryCheats.CheatsInLibrary);
                    this.RaisePropertyChanged(nameof(this.CheatsAvailable));
                    this.RaisePropertyChanged(nameof(this.CheatsInLibrary));
                }
                catch (Exception ex)
                {
                    OutputViewModel.GetInstance().Log(OutputViewModel.LogLevel.Error, "Error loading cheats", ex);
                }
                finally
                {
                    this.IsLibraryLoading = false;
                }
            });
        }