protected override void OnPageDestroy(int new_windowId) { // save settings if (btnDownloadFanart != null) { TraktSettings.DownloadFanart = btnDownloadFanart.Selected; } if (btnDownloadFullSizeFanart != null) { TraktSettings.DownloadFullSizeFanart = btnDownloadFullSizeFanart.Selected; } if (btnGetFollowerRequests != null) { TraktSettings.GetFollowerRequestsOnStartup = btnGetFollowerRequests.Selected; } if (btnShowRateDialogOnWatched != null) { TraktSettings.ShowRateDialogOnWatched = btnShowRateDialogOnWatched.Selected; } if (btnSyncRatings != null) { TraktSettings.SyncRatings = btnSyncRatings.Selected; } if (btnCreateMyFilmsCategories != null) { TraktSettings.MyFilmsCategories = btnCreateMyFilmsCategories.Selected; } // update any internal plugin settings required TraktSettings.UpdateInternalPluginSettings(); TraktSettings.SaveSettings(); base.OnPageDestroy(new_windowId); }
private bool TestAccount(TraktAuthenticationToken token) { // test account by requesting the user settings var response = TraktAPI.TraktAPI.GetUserSettings(); if (response == null || response.User == null) { GUIUtils.ShowNotifyDialog(Translation.Error, Translation.FailedOnlineSettings); return(false); } else { // Save New Account Settings TraktSettings.Username = response.User.Username; TraktSettings.OnlineSettings = response; TraktSettings.AccountStatus = ConnectionState.Connected; InitProperties(); // clear caches // watchlists are stored by user so dont need clearing. GUINetwork.ClearCache(); GUICalendarTV.ClearCache(); GUIRecommendationsMovies.ClearCache(); GUIRecommendationsShows.ClearCache(); // clear any stored user data TraktCache.ClearSyncCache(); // persist settings TraktSettings.SaveSettings(false); return(true); } }
private void DisconnectAccount() { TraktLogger.Info("Revoking application access to trakt.tv account"); GUIBackgroundTask.Instance.ExecuteInBackgroundAndCallback(() => { TraktAPI.TraktAPI.RevokeToken(); return(true); }, delegate(bool success, object result) { if (success) { // clear account settings TraktSettings.Username = string.Empty; TraktSettings.UserAccessToken = string.Empty; TraktSettings.UserAccessTokenExpiry = string.Empty; TraktSettings.UserRefreshToken = string.Empty; TraktSettings.AccountStatus = ConnectionState.Disconnected; InitProperties(); // clear caches // watchlists are stored by user so dont need clearing. GUINetwork.ClearCache(); GUICalendarTV.ClearCache(); GUIRecommendationsMovies.ClearCache(); GUIRecommendationsShows.ClearCache(); // clear any stored user data TraktCache.ClearSyncCache(); // persist settings TraktSettings.SaveSettings(false); } }, Translation.AuthorizingApplication, false); }
protected override void OnPageDestroy(int new_windowId) { // disable plugins if (!btnTVSeries.Selected) { TVSeries = -1; } if (!btnMovingPictures.Selected) { MovingPictures = -1; } if (!btnMyVideos.Selected) { MyVideos = -1; } if (!btnMyFilms.Selected) { MyFilms = -1; } if (!btnOnlineVideos.Selected) { OnlineVideos = -1; } if (!btnMyRecordedTV.IsSelected(TraktSettings.MyTVRecordings >= 0)) { MyRecordedTV = -1; } if (!btnArgusRecordings.IsSelected(TraktSettings.ArgusRecordings >= 0)) { ArgusRecordings = -1; } if (!btnMyLiveTV.IsSelected(TraktSettings.MyTVLive >= 0)) { MyLiveTV = -1; } if (!btnArgusLiveTV.IsSelected(TraktSettings.ArgusTVLive >= 0)) { ArgusLiveTV = -1; } // enable plugins int i = 1; int[] intArray = new int[9] { TVSeries, MovingPictures, MyVideos, MyFilms, OnlineVideos, MyRecordedTV, MyLiveTV, ArgusLiveTV, ArgusRecordings }; Array.Sort(intArray); // keep existing sort order if (btnTVSeries.Selected && TVSeries < 0) { TVSeries = intArray.Max() + i; i++; } if (btnMovingPictures.Selected && MovingPictures < 0) { MovingPictures = intArray.Max() + i; i++; } if (btnMyVideos.Selected && MyVideos < 0) { MyVideos = intArray.Max() + i; i++; } if (btnMyFilms.Selected && MyFilms < 0) { MyFilms = intArray.Max() + i; i++; } if (btnOnlineVideos.Selected && OnlineVideos < 0) { OnlineVideos = intArray.Max() + i; i++; } if (btnMyRecordedTV.IsSelected(TraktSettings.MyTVRecordings >= 0) && MyRecordedTV < 0) { MyRecordedTV = intArray.Max() + i; i++; } if (btnArgusRecordings.IsSelected(TraktSettings.ArgusRecordings >= 0) && ArgusRecordings < 0) { ArgusRecordings = intArray.Max() + i; i++; } if (btnMyLiveTV.IsSelected(TraktSettings.MyTVLive >= 0) && MyLiveTV < 0) { MyLiveTV = intArray.Max() + i; i++; } if (btnArgusLiveTV.IsSelected(TraktSettings.ArgusTVLive >= 0) && ArgusLiveTV < 0) { ArgusLiveTV = intArray.Max() + i; i++; } // save settings TraktSettings.TVSeries = TVSeries; TraktSettings.MovingPictures = MovingPictures; TraktSettings.MyVideos = MyVideos; TraktSettings.MyFilms = MyFilms; TraktSettings.OnlineVideos = OnlineVideos; if (btnMyRecordedTV != null) { TraktSettings.MyTVRecordings = MyRecordedTV; } if (btnArgusRecordings != null) { TraktSettings.ArgusRecordings = ArgusRecordings; } if (btnMyLiveTV != null) { TraktSettings.MyTVLive = MyLiveTV; } if (btnArgusLiveTV != null) { TraktSettings.ArgusTVLive = ArgusLiveTV; } TraktSettings.SaveSettings(false); base.OnPageDestroy(new_windowId); }