Пример #1
0
        protected override void OnPageDestroy(int new_windowId)
        {
            // save settings
            if (btnDownloadFanart != null)
            {
                TraktSettings.DownloadFanart = btnDownloadFanart.Selected;
            }
            if (btnDownloadFullSizeFanart != null)
            {
                TraktSettings.DownloadFullSizeFanart = btnDownloadFullSizeFanart.Selected;
            }
            if (btnGetFriendRequests != null)
            {
                TraktSettings.GetFriendRequestsOnStartup = btnGetFriendRequests.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);
        }
        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 (!btnMyAnime.Selected)
            {
                MyAnime = -1;
            }
            if (btnMyRecordedTV != null)
            {
                if (!btnMyRecordedTV.Selected)
                {
                    MyRecordedTV = -1;
                }
            }
            if (btnForTheRecordRecordings != null)
            {
                if (!btnForTheRecordRecordings.Selected)
                {
                    ForTheRecordRecordings = -1;
                }
            }
            if (btnArgusRecordings != null)
            {
                if (!btnArgusRecordings.Selected)
                {
                    ArgusRecordings = -1;
                }
            }
            if (btnMyLiveTV != null)
            {
                if (!btnMyLiveTV.Selected)
                {
                    MyLiveTV = -1;
                }
            }
            if (btnForTheRecordLiveTV != null)
            {
                if (!btnForTheRecordLiveTV.Selected)
                {
                    ForTheRecordLiveTV = -1;
                }
            }
            if (btnArgusLiveTV != null)
            {
                if (!btnArgusLiveTV.Selected)
                {
                    ArgusLiveTV = -1;
                }
            }

            // enable plugins
            int i = 1;

            int[] intArray = new int[12] {
                TVSeries, MovingPictures, MyVideos, MyFilms, OnlineVideos,
                MyAnime, MyRecordedTV, ForTheRecordRecordings, MyLiveTV,
                ForTheRecordLiveTV, 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 (btnMyAnime.Selected && MyAnime < 0)
            {
                MyAnime = intArray.Max() + i; i++;
            }
            if (btnMyRecordedTV != null)
            {
                if (btnMyRecordedTV.Selected && MyRecordedTV < 0)
                {
                    MyRecordedTV = intArray.Max() + i; i++;
                }
            }
            if (btnForTheRecordRecordings != null)
            {
                if (btnForTheRecordRecordings.Selected && ForTheRecordRecordings < 0)
                {
                    ForTheRecordRecordings = intArray.Max() + i; i++;
                }
            }
            if (btnArgusRecordings != null)
            {
                if (btnArgusRecordings.Selected && ArgusRecordings < 0)
                {
                    ArgusRecordings = intArray.Max() + i; i++;
                }
            }
            if (btnMyLiveTV != null)
            {
                if (btnMyLiveTV.Selected && MyLiveTV < 0)
                {
                    MyLiveTV = intArray.Max() + i; i++;
                }
            }
            if (btnForTheRecordLiveTV != null)
            {
                if (btnForTheRecordLiveTV.Selected && ForTheRecordLiveTV < 0)
                {
                    ForTheRecordLiveTV = intArray.Max() + i; i++;
                }
            }
            if (btnArgusLiveTV != null)
            {
                if (btnArgusLiveTV.Selected && ArgusLiveTV < 0)
                {
                    ArgusLiveTV = intArray.Max() + i; i++;
                }
            }

            // save settings
            TraktSettings.TVSeries       = TVSeries;
            TraktSettings.MovingPictures = MovingPictures;
            TraktSettings.MyVideos       = MyVideos;
            TraktSettings.MyFilms        = MyFilms;
            TraktSettings.OnlineVideos   = OnlineVideos;
            TraktSettings.MyAnime        = MyAnime;
            if (btnMyRecordedTV != null)
            {
                TraktSettings.MyTVRecordings = MyRecordedTV;
            }
            if (btnForTheRecordRecordings != null)
            {
                TraktSettings.ForTheRecordRecordings = ForTheRecordRecordings;
            }
            if (btnArgusRecordings != null)
            {
                TraktSettings.ArgusRecordings = ArgusRecordings;
            }
            if (btnMyLiveTV != null)
            {
                TraktSettings.MyTVLive = MyLiveTV;
            }
            if (btnForTheRecordLiveTV != null)
            {
                TraktSettings.ForTheRecordTVLive = ForTheRecordLiveTV;
            }
            if (btnArgusLiveTV != null)
            {
                TraktSettings.ArgusTVLive = ArgusLiveTV;
            }

            TraktSettings.saveSettings();

            base.OnPageDestroy(new_windowId);
        }