示例#1
0
        /// <summary>
        /// Removes the cheat from the selected library.
        /// </summary>
        /// <param name="cheat">The cheat to remove.</param>
        private void RemoveCheatFromLibrary(Cheat cheat)
        {
            if (!this.CheatsInLibrary.Contains(cheat))
            {
                OutputViewModel.GetInstance().Log(OutputViewModel.LogLevel.Error, "Unable to remove cheat from library");
                return;
            }

            AccessTokens accessTokens = SettingsViewModel.GetInstance().AccessTokens;

            try
            {
                SqualrApi.RemoveCheatFromLibrary(accessTokens.AccessToken, this.ActiveLibrary.LibraryId, cheat.CheatId);

                this.cheatsInLibrary.Remove(cheat);
                this.cheatsAvailable.Insert(0, cheat);
                this.RaisePropertyChanged(nameof(this.CheatsAvailable));
                this.RaisePropertyChanged(nameof(this.CheatsInLibrary));
            }
            catch (Exception ex)
            {
                OutputViewModel.GetInstance().Log(OutputViewModel.LogLevel.Error, "Error removing cheat from library", ex);
            }
        }