Inheritance: MonoBehaviour
Ejemplo n.º 1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="view"></param>
 /// <param name="control"></param>
 public DeleteControlCommand(GUIView view, GUIControl control)
 {
     mView = view;
     Controls.Add(control);
     mParent = Controls[0].Parent;
     mIndex = mView.Controls.IndexOf(Controls[0]);
 }
Ejemplo n.º 2
0
        public ProgressBar(GUIControl parent)
            : base("", parent)
        {
            size=	new Size2(120, 32);
            pHorizontal=	true;
            pProgress=	0f;
            pAutoLabel=	true;
            pProgressColors=	new GUIColorPacket
            (
                new Color(0, 200, 0),
                new Color(230, 230, 230),
                new Color(0, 200, 150),
                new Color(0, 150, 150)
            );
            pProgressLeftColors=	new GUIColorPacket
            (
                new Color(200, 0, 0),
                new Color(100, 100, 100),
                new Color(200, 100, 50),
                new Color(200, 0, 0)
            );

            pAutoAdjustSize=	false;
            pBGColors.normal=	new Color(25, 25, 25);
            pBGColors.disabled=	new Color(0, 0, 0);

            addEvent("onProgressChanged");
            addEvent("onProgressColorsChanged");
            addEvent("onProgressLeftColorsChanged");
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Recursively create keyframes
        /// </summary>
        /// <param name="animation"></param>
        /// <param name="control"></param>
        private void CreateKeyframes(GUIAnimation animation, GUIControl control)
        {
            animation.CreateKeyFrame(control, 0);

            foreach (GUIControl child in control.Controls)
                CreateKeyframes(animation, child);
        }
        public void ContainerItemAdded(GUIControl control)
        {
            var focused = this.FocusedControl;
            this.focusableCollection.Add(control);
            this.focusableCollection.Sort((x, y) => x.FocusIndex.CompareTo(y.FocusIndex));

            if (focused != null)
                this.focusedIndex = this.focusableCollection.IndexOf(focused);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Constructor
        /// </summary>
        public ResizeControlCommand(GUIControl control, PointF srcCenter, SizeF srcSize, PointF dstCenter, SizeF dstSize)
        {
            Controls.Add(control);

            mSourceCenter = srcCenter;
            mSourceSize = srcSize;
            mDestCenter = dstCenter;
            mDestSize = dstSize;
        }
Ejemplo n.º 6
0
        public Button(string pmText, GUIControl pmParent)
            : base(pmText, pmParent)
        {
            pAutoAdjustSize=	false;
            pBorder=	new Border();
            pHoverPressEnabled=	true;

            addEvent("onBorderChanged");
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Sets the contents of a splitter panel.
        /// </summary>
        /// <param name="panelIndex">Panel index (0-1).</param>
        /// <param name="panel">Panel contents.</param>
        /// <param name="noScale">Determines whether the content is to be scaled.</param>
        public void SetPanel(int panelIndex, GUIControl panel, bool noScale)
        {
            if (panelIndex < 0 || panelIndex > 1)
                throw new ArgumentException("Invalid panel index", "panelIndex");

            m_Panel[panelIndex] = panel;
            m_Scale[panelIndex] = !noScale;

            if (null != m_Panel[panelIndex])
            {
                m_Panel[panelIndex].ParentControl = this;
            }
        }
Ejemplo n.º 8
0
        public TextBox(GUIControl pmParent)
            : base(pmParent)
        {
            pCursorPos=	0;
            pCursorEnd=	0;
            pSelAll=	false;
            pTabable=	true;
            pFGColors.normal=	new Color(255, 0, 0);
            tick=	0;
            tickMax=	96;

            includeEvent("onKeyPress", (GUIEvent<KeyboardState>)onKeyboardPress);
        }
	// Use this for initialization
	void Start () 
	{
		_control = FindObjectOfType (typeof(GUIControl)) as GUIControl;
		_player = FindObjectOfType (typeof(PlayerManager)) as PlayerManager;

		MenuInGameButtons = GetComponentsInChildren<Button> ();

		MenuInGameNumberOfButtons = 9;
		PreviewCharacterMenuNumberOfStageOfSlots = 4;

		MenuInGameIndex = 0;
		PreviewCharacterMenuIndex = 0;
	}
Ejemplo n.º 10
0
        public Label(string pmText, GUIControl pmParent)
            : base(pmParent)
        {
            pText=	pmText.Replace("\t", "    ");
            pFGColors=	new GUIColorPacket
            (
                new Color(0, 0, 0),
                new Color(100, 100, 100),
                new Color(0, 0, 0),
                new Color(0, 0, 0)
            );
            pAutoAdjustSize=	true;

            addEvent("onTextChanged");
            addEvent("onFGColorsChanged");
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="controls"></param>
        /// <param name="newParent"></param>
        public ChangeParentCommand(List<GUIControl> controls, GUIControl newParent, int index)
        {
            foreach (GUIControl control in controls)
            {
                ControlState controlState = new ControlState();
                controlState.mControl = control;
                controlState.mParent = control.Parent;
                controlState.mIndex = control.Parent.Controls.IndexOf(control);
                controlState.mCenter = control.Center;
                controlState.mRotation = control.Rotation;
                controlState.mLocation = control.Location;

                // Store the original frame layouts and things
                foreach (GUIAnimation animation in control.ParentView.Animations)
                {
                    foreach (GUIAnimationChannel channel in animation.AnimationChannels)
                    {
                        if (channel.Control != control)
                            continue;

                        ChannelState channelState = new ChannelState();
                        channelState.mChannel = channel;

                        foreach (KeyFrame keyFrame in channel.KeyFrames)
                        {
                            channelState.mLayouts.Add((ControlLayout)keyFrame.Layout.Clone());
                        }

                        controlState.mChannelStates.Add(channelState);
                    }
                }

                mControlStates.Add(controlState);
            }

            mControls.AddRange(controls);
            mNewParent = newParent;
            mIndex = index;
        }
Ejemplo n.º 12
0
        protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
        {
            base.OnClicked(controlId, control, actionType);

            if (control == lcFolders)
            {
                if (lcFolders.SelectedListItem.IsPlayed)
                {
                    lcFolders.SelectedListItem.Label2   = "";
                    lcFolders.SelectedListItem.IsPlayed = false;
                    FolderInfo(lcFolders.SelectedListItem).ScanShare = false;
                    _scanShare--;
                }
                else
                {
                    lcFolders.SelectedListItem.Label2   = GUILocalizeStrings.Get(193); // Scan
                    lcFolders.SelectedListItem.IsPlayed = true;
                    FolderInfo(lcFolders.SelectedListItem).ScanShare = true;
                    _scanShare++;
                }
            }

            if (control == btnStripartistprefixes)
            {
                if (btnStripartistprefixes.Selected)
                {
                    OnStripArtistsPrefixes();
                    SettingsChanged(true);
                }
            }

            if (control == btnTreatFolderAsAlbum)
            {
                if (btnTreatFolderAsAlbum.Selected)
                {
                    btnCreateMissingFolderThumbs.IsEnabled = true;
                }
                else
                {
                    btnCreateMissingFolderThumbs.IsEnabled = false;
                }
                SettingsChanged(true);
            }

            if (control == btnDateAdded)
            {
                OnDateAdded();
            }

            if (control == btnUpdateDatabase)
            {
                if (_scanShare == 0)
                {
                    GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
                    dlgOk.SetHeading(GUILocalizeStrings.Get(1020));   // Information
                    dlgOk.SetLine(1, GUILocalizeStrings.Get(300004)); // Nothing to scan
                    dlgOk.SetLine(2, GUILocalizeStrings.Get(300005)); //Please select folder(s) for scan.
                    dlgOk.DoModal(GetID);
                    return;
                }
                OnUpdateDatabase();
            }
        }
Ejemplo n.º 13
0
        protected override void OnShowContextMenu()
        {
            GUIListItem selectedItem = this.Facade.SelectedListItem;

            if (selectedItem == null)
            {
                return;
            }

            TraktWatchListMovie selectedMovie = (TraktWatchListMovie)selectedItem.TVTag;

            IDialogbox dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }

            dlg.Reset();
            dlg.SetHeading(GUIUtils.PluginName());

            GUIListItem listItem = null;

            // only allow removal if viewing your own watch list
            if (CurrentUser == TraktSettings.Username)
            {
                listItem = new GUIListItem(Translation.RemoveFromWatchList);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.RemoveFromWatchList;
            }
            else if (!selectedMovie.InWatchList)
            {
                // viewing someone else's watch list and not in yours
                listItem = new GUIListItem(Translation.AddToWatchList);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.AddToWatchList;
            }

            // Add to Custom List
            listItem = new GUIListItem(Translation.AddToList + "...");
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.AddToList;

            // Mark As Watched
            if (!selectedMovie.Watched)
            {
                listItem = new GUIListItem(Translation.MarkAsWatched);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.MarkAsWatched;
            }

            // Mark As UnWatched
            if (selectedMovie.Watched)
            {
                listItem = new GUIListItem(Translation.MarkAsUnWatched);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.MarkAsUnWatched;
            }

            // Add to Library
            // Don't allow if it will be removed again on next sync
            // movie could be part of a DVD collection
            if (!selectedMovie.InCollection && !TraktSettings.KeepTraktLibraryClean)
            {
                listItem = new GUIListItem(Translation.AddToLibrary);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.AddToLibrary;
            }

            if (selectedMovie.InCollection)
            {
                listItem = new GUIListItem(Translation.RemoveFromLibrary);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.RemoveFromLibrary;
            }

            // Related Movies
            listItem = new GUIListItem(Translation.RelatedMovies + "...");
            dlg.Add(listItem);

            listItem.ItemId = (int)ContextMenuItem.Related;
            // Rate Movie
            listItem = new GUIListItem(Translation.RateMovie);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Rate;

            // Shouts
            listItem = new GUIListItem(Translation.Shouts + "...");
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Shouts;

            if (TraktHelper.IsOnlineVideosAvailableAndEnabled)
            {
                // Trailers
                listItem = new GUIListItem(Translation.Trailers);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.Trailers;
            }

            // Change Layout
            listItem = new GUIListItem(Translation.ChangeLayout);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.ChangeLayout;

            if (!selectedMovie.InCollection && TraktHelper.IsMpNZBAvailableAndEnabled)
            {
                // Search for movie with mpNZB
                listItem = new GUIListItem(Translation.SearchWithMpNZB);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.SearchWithMpNZB;
            }

            if (!selectedMovie.InCollection && TraktHelper.IsMyTorrentsAvailableAndEnabled)
            {
                // Search for movie with MyTorrents
                listItem = new GUIListItem(Translation.SearchTorrent);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.SearchTorrent;
            }

            // Show Context Menu
            dlg.DoModal(GUIWindowManager.ActiveWindow);
            if (dlg.SelectedId < 0)
            {
                return;
            }

            switch (dlg.SelectedId)
            {
            case ((int)ContextMenuItem.MarkAsWatched):
                MarkMovieAsWatched(selectedMovie);
                if (CurrentUser != TraktSettings.Username)
                {
                    if (selectedMovie.Plays == 0)
                    {
                        selectedMovie.Plays = 1;
                    }
                    selectedMovie.Watched = true;
                    selectedItem.IsPlayed = true;
                    OnMovieSelected(selectedItem, Facade);
                    selectedMovie.Images.NotifyPropertyChanged("PosterImageFilename");
                    GUIWatchListMovies.ClearCache(TraktSettings.Username);
                }
                else
                {
                    // when marking a movie as seen via API, it will remove from watch list
                    // we should do the same in GUI
                    PreviousSelectedIndex = this.Facade.SelectedListItemIndex;
                    if (_WatchListMovies.Count() >= 1)
                    {
                        // remove from list
                        var moviesToExcept = new List <TraktWatchListMovie>();
                        moviesToExcept.Add(selectedMovie);
                        _WatchListMovies           = WatchListMovies.Except(moviesToExcept);
                        userWatchList[CurrentUser] = _WatchListMovies;
                        LoadWatchListMovies();
                    }
                    else
                    {
                        // no more movies left
                        ClearProperties();
                        GUIControl.ClearControl(GetID, Facade.GetID);
                        _WatchListMovies = null;
                        userWatchList.Remove(CurrentUser);
                        // notify and exit
                        GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoMovieWatchList);
                        GUIWindowManager.ShowPreviousWindow();
                        return;
                    }
                }
                break;

            case ((int)ContextMenuItem.MarkAsUnWatched):
                MarkMovieAsUnWatched(selectedMovie);
                selectedMovie.Watched = false;
                selectedItem.IsPlayed = false;
                OnMovieSelected(selectedItem, Facade);
                selectedMovie.Images.NotifyPropertyChanged("PosterImageFilename");
                break;

            case ((int)ContextMenuItem.AddToWatchList):
                AddMovieToWatchList(selectedMovie);
                selectedMovie.InWatchList = true;
                OnMovieSelected(selectedItem, Facade);
                selectedMovie.Images.NotifyPropertyChanged("PosterImageFilename");
                GUIWatchListMovies.ClearCache(TraktSettings.Username);
                break;

            case ((int)ContextMenuItem.RemoveFromWatchList):
                PreviousSelectedIndex = this.Facade.SelectedListItemIndex;
                RemoveMovieFromWatchList(selectedMovie);
                if (_WatchListMovies.Count() >= 1)
                {
                    // remove from list
                    var moviesToExcept = new List <TraktWatchListMovie>();
                    moviesToExcept.Add(selectedMovie);
                    _WatchListMovies           = WatchListMovies.Except(moviesToExcept);
                    userWatchList[CurrentUser] = _WatchListMovies;
                    LoadWatchListMovies();
                }
                else
                {
                    // no more movies left
                    ClearProperties();
                    GUIControl.ClearControl(GetID, Facade.GetID);
                    _WatchListMovies = null;
                    userWatchList.Remove(CurrentUser);
                    // notify and exit
                    GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoMovieWatchList);
                    GUIWindowManager.ShowPreviousWindow();
                    return;
                }
                break;

            case ((int)ContextMenuItem.AddToList):
                TraktHelper.AddRemoveMovieInUserList(selectedMovie.Title, selectedMovie.Year, selectedMovie.IMDBID, false);
                break;

            case ((int)ContextMenuItem.Trailers):
                GUICommon.ShowMovieTrailersMenu(selectedMovie);
                break;

            case ((int)ContextMenuItem.AddToLibrary):
                AddMovieToLibrary(selectedMovie);
                selectedMovie.InCollection = true;
                OnMovieSelected(selectedItem, Facade);
                selectedMovie.Images.NotifyPropertyChanged("PosterImageFilename");
                if (CurrentUser != TraktSettings.Username)
                {
                    GUIWatchListMovies.ClearCache(TraktSettings.Username);
                }
                break;

            case ((int)ContextMenuItem.RemoveFromLibrary):
                RemoveMovieFromLibrary(selectedMovie);
                selectedMovie.InCollection = false;
                OnMovieSelected(selectedItem, Facade);
                selectedMovie.Images.NotifyPropertyChanged("PosterImageFilename");
                if (CurrentUser != TraktSettings.Username)
                {
                    GUIWatchListMovies.ClearCache(TraktSettings.Username);
                }
                break;

            case ((int)ContextMenuItem.Related):
                RelatedMovie relatedMovie = new RelatedMovie();
                relatedMovie.IMDbId           = selectedMovie.IMDBID;
                relatedMovie.Title            = selectedMovie.Title;
                GUIRelatedMovies.relatedMovie = relatedMovie;
                GUIWindowManager.ActivateWindow((int)TraktGUIWindows.RelatedMovies);
                break;

            case ((int)ContextMenuItem.Rate):
                GUICommon.RateMovie(selectedMovie);
                OnMovieSelected(selectedItem, Facade);
                selectedMovie.Images.NotifyPropertyChanged("PosterImageFilename");
                if (CurrentUser != TraktSettings.Username)
                {
                    GUIWatchListMovies.ClearCache(TraktSettings.Username);
                }
                break;

            case ((int)ContextMenuItem.Shouts):
                GUIShouts.ShoutType = GUIShouts.ShoutTypeEnum.movie;
                GUIShouts.MovieInfo = new MovieShout {
                    IMDbId = selectedMovie.IMDBID, TMDbId = selectedMovie.TMDBID, Title = selectedMovie.Title, Year = selectedMovie.Year
                };
                GUIShouts.Fanart = selectedMovie.Images.FanartImageFilename;
                GUIWindowManager.ActivateWindow((int)TraktGUIWindows.Shouts);
                break;

            case ((int)ContextMenuItem.ChangeLayout):
                CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout);
                break;

            case ((int)ContextMenuItem.SearchWithMpNZB):
                string loadingParam = string.Format("search:{0}", selectedMovie.Title);
                GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MpNZB, loadingParam);
                break;

            case ((int)ContextMenuItem.SearchTorrent):
                string loadPar = selectedMovie.Title;
                GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MyTorrents, loadPar);
                break;

            default:
                break;
            }

            base.OnShowContextMenu();
        }
        public override bool OnMessage(GUIMessage message)
        {
            switch (message.Message)
            {
            case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT:
            {
                base.OnMessage(message);
                LoadSettings();
                GUISpinControl cntl = (GUISpinControl)GetControl((int)Controls.CONTROL_FPS);
                cntl.ShowRange = false;
                GUIControl.ClearControl(GetID, (int)Controls.CONTROL_SPEED_HORIZONTAL);
                for (int i = 1; i <= 5; ++i)
                {
                    GUIControl.AddItemLabelControl(GetID, (int)Controls.CONTROL_SPEED_HORIZONTAL, i.ToString());
                }
                GUIControl.SelectItemControl(GetID, (int)Controls.CONTROL_SPEED_HORIZONTAL, m_iSpeedHorizontal - 1);

                GUIControl.ClearControl(GetID, (int)Controls.CONTROL_SPEED_VERTICAL);
                for (int i = 1; i <= 5; ++i)
                {
                    GUIControl.AddItemLabelControl(GetID, (int)Controls.CONTROL_SPEED_VERTICAL, i.ToString());
                }
                GUIControl.SelectItemControl(GetID, (int)Controls.CONTROL_SPEED_VERTICAL, m_iSpeedVertical - 1);

                GUIControl.ClearControl(GetID, (int)Controls.CONTROL_FPS);
                for (int i = 10; i <= 100; ++i)
                {
                    GUIControl.AddItemLabelControl(GetID, (int)Controls.CONTROL_FPS, i.ToString());
                }
                GUIControl.SelectItemControl(GetID, (int)Controls.CONTROL_FPS, GUIGraphicsContext.MaxFPS - 10);


                GUIControl.ClearControl(GetID, (int)Controls.CONTROL_LISTLOOP_DELAY);
                for (int i = 1; i <= 10000; ++i)
                {
                    GUIControl.AddItemLabelControl(GetID, (int)Controls.CONTROL_LISTLOOP_DELAY, i.ToString());
                }
                GUIControl.SelectItemControl(GetID, (int)Controls.CONTROL_LISTLOOP_DELAY, m_iListLoopDelay - 1);


                ResetExampleLabels();

                return(true);
            }

            case GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT:
            {
                SaveSettings();
            }
            break;

            case GUIMessage.MessageType.GUI_MSG_CLICKED:
            {
                int iControl = message.SenderControlId;
                if (iControl == (int)Controls.CONTROL_SPEED_HORIZONTAL)
                {
                    string strLabel = message.Label;
                    m_iSpeedHorizontal = Int32.Parse(strLabel);
                    GUIGraphicsContext.ScrollSpeedHorizontal = m_iSpeedHorizontal;
                    ResetExampleLabels();
                }
                if (iControl == (int)Controls.CONTROL_SPEED_VERTICAL)
                {
                    string strLabel = message.Label;
                    m_iSpeedVertical = Int32.Parse(strLabel);
                    GUIGraphicsContext.ScrollSpeedVertical = m_iSpeedVertical;
                    ResetExampleLabels();
                }
                if (iControl == (int)Controls.CONTROL_FPS)
                {
                    string strLabel = message.Label;
                    int    fps      = Int32.Parse(strLabel);
                    GUIGraphicsContext.MaxFPS = fps;
                }
                if (iControl == (int)Controls.CONTROL_LISTLOOP_DELAY)
                {
                    string strLabel = message.Label;
                    m_iListLoopDelay = Int32.Parse(strLabel);
                    GUIGraphicsContext.ScrollSpeedVertical = m_iListLoopDelay;
                    ResetExampleLabels();
                }
            }
            break;
            }
            return(base.OnMessage(message));
        }
        protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
        {
            // wait for any background action to finish
            if (GUIBackgroundTask.Instance.IsBusy)
            {
                return;
            }

            switch (controlId)
            {
            // Disconnect
            case ((int)SkinControls.Disconnect):
                DisconnectAccount();
                break;

            case ((int)SkinControls.Create):
                ShowAccountControls(true);
                break;

            case ((int)SkinControls.Login):
                bool autoLogin = ShowLoginMenu();
                ShowAccountControls(false);
                if (autoLogin)
                {
                    GUIControl.SetControlLabel(GetID, btnUsername.GetID, this.Username);
                    GUIControl.SetControlLabel(GetID, btnPassword.GetID, GetMaskedPassword(this.Password));
                    TraktAccount account = new TraktAccount
                    {
                        Username = this.Username,
                        Password = this.Password
                    };
                    TestAccount(account);
                }
                break;

            case ((int)SkinControls.Username):
                string username = Username;
                if (GUIUtils.GetStringFromKeyboard(ref username))
                {
                    Username = username;
                    GUIControl.SetControlLabel(GetID, btnUsername.GetID, username);
                }
                break;

            case ((int)SkinControls.Password):
                string password = Password;
                if (GUIUtils.GetStringFromKeyboard(ref password, true))
                {
                    Password = password;
                    GUIControl.SetControlLabel(GetID, btnPassword.GetID, GetMaskedPassword(password));
                }
                break;

            case ((int)SkinControls.EmailButton):
                string email = Email;
                if (GUIUtils.GetStringFromKeyboard(ref email))
                {
                    Email = email;
                    GUIControl.SetControlLabel(GetID, btnEmail.GetID, email);
                }
                break;

            case ((int)SkinControls.Ok):
                if (ValidateFields())
                {
                    TraktAccount account = new TraktAccount
                    {
                        Username = this.Username,
                        Password = this.Password.GetSha1(),
                        Email    = this.Email
                    };
                    TestAccount(account);
                }
                break;

            case ((int)SkinControls.Cancel):
                HideAccountControls();
                break;

            default:
                break;
            }
            base.OnClicked(controlId, control, actionType);
        }
        private void SendSeasonEpisodesToFacade(IEnumerable <TraktEpisode> episodes)
        {
            // clear facade
            GUIControl.ClearControl(GetID, Facade.GetID);

            if (episodes == null || episodes.Count() == 0)
            {
                GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoEpisodesInSeason);
                GUIWindowManager.ShowPreviousWindow();
                return;
            }

            // Set Common Show Properties
            GUICommon.SetShowProperties(Show);

            int itemCount     = 0;
            var episodeImages = new List <TraktImage>();

            foreach (var episode in episodes)
            {
                // use episode short string
                string itemLabel = string.Format("{0}. {1}", episode.Number.ToString(), string.IsNullOrEmpty(episode.Title) ? Translation.Episode + " " + episode.Number.ToString() : episode.Title);

                // add image for download
                var images = new TraktImage
                {
                    EpisodeImages = episode.Images,
                    ShowImages    = Show.Images
                };

                episodeImages.Add(images);

                var item = new GUIEpisodeListItem(itemLabel, (int)TraktGUIWindows.SeasonEpisodes);

                item.Label2 = episode.FirstAired == 0 ? " " : episode.FirstAired.FromEpoch().ToShortDateString();
                item.TVTag  = new TraktEpisodeSummary {
                    Episode = episode, Show = Show
                };
                item.IsPlayed        = episode.Watched;
                item.Images          = images;
                item.ItemId          = Int32.MaxValue - itemCount;
                item.IconImage       = "defaultTraktEpisode.png";
                item.IconImageBig    = "defaultTraktEpisodeBig.png";
                item.ThumbnailImage  = "defaultTraktEpisodeBig.png";
                item.OnItemSelected += OnEpisodeSelected;
                Utils.SetDefaultIcons(item);
                Facade.Add(item);
                itemCount++;
            }

            // Set Facade Layout
            Facade.SetCurrentLayout(Enum.GetName(typeof(Layout), CurrentLayout));
            GUIControl.FocusControl(GetID, Facade.GetID);

            if (PreviousSelectedIndex >= itemCount)
            {
                Facade.SelectIndex(PreviousSelectedIndex - 1);
            }
            else
            {
                Facade.SelectIndex(PreviousSelectedIndex);
            }

            // set facade properties
            GUIUtils.SetProperty("#itemcount", itemCount.ToString());
            GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", itemCount.ToString(), itemCount > 1 ? Translation.Episodes : Translation.Episode));

            // Download episode images Async and set to facade
            GUIEpisodeListItem.GetImages(episodeImages);
        }
Ejemplo n.º 17
0
        protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
        {
            // wait for any background action to finish
            if (GUIBackgroundTask.Instance.IsBusy)
            {
                return;
            }

            switch (controlId)
            {
            // Disconnect
            case ((int)SkinControls.AuthoriseOrDisconnect):
                if (string.IsNullOrEmpty(TraktSettings.UserAccessToken))
                {
                    GUIBackgroundTask.Instance.ExecuteInBackgroundAndCallback(() =>
                    {
                        TraktAPI.TraktAPI.AuthorisationCancelled = false;

                        #region Get Device Code
                        TraktLogger.Info("Getting device code from trakt.tv");

                        TraktSettings.AccountStatus = ConnectionState.Connecting;

                        var code = TraktAPI.TraktAPI.GetDeviceCode();
                        if (code == null || string.IsNullOrEmpty(code.DeviceCode))
                        {
                            return(null);
                        }
                        #endregion

                        #region Poll for Access Token
                        TraktLogger.Info("Successfully got device code from trakt.tv, presenting code '{0}' to user for activation at '{1}'. Code expires in '{2}' secs", code.UserCode, code.VerificationUrl, code.ExpiresIn);

                        // show the user their user code
                        GUIUtils.SetProperty("#Trakt.Settings.Account.Authorise", "true");
                        GUIUtils.SetProperty("#Trakt.Settings.Account.UserCode", code.UserCode);
                        GUIUtils.SetProperty("#Trakt.Settings.Account.ActivateUrl", code.VerificationUrl);
                        GUIUtils.SetProperty("#Trakt.Settings.Account.UserCode", code.UserCode);
                        GUIUtils.SetProperty("#Trakt.Settings.Account.ScanQRCode", string.Format(Translation.ScanQRCode, code.VerificationUrl, code.UserCode));

                        TraktLogger.Info("Polling trakt.tv for authorisation token every '{0}' secs until user enters code", code.Interval);

                        var authToken = TraktAPI.TraktAPI.GetAuthenticationToken(code);
                        if (authToken != null)
                        {
                            TraktSettings.UserRefreshToken      = authToken.RefreshToken;
                            TraktSettings.UserAccessToken       = authToken.AccessToken;
                            TraktSettings.UserAccessTokenExpiry = DateTime.UtcNow.AddSeconds(authToken.ExpiresIn).ToString();

                            if (!TestAccount(authToken))
                            {
                                return(null);
                            }
                        }
                        #endregion

                        return(authToken);
                    },
                                                                              delegate(bool success, object result)
                    {
                        GUIUtils.SetProperty("#Trakt.Settings.Account.Authorise", "false");

                        if (success)
                        {
                            var authToken = result as TraktAuthenticationToken;
                            if (authToken == null)
                            {
                                TraktSettings.AccountStatus = ConnectionState.Disconnected;
                                GUIUtils.ShowNotifyDialog(Translation.Error, Translation.FailedApplicationAuthorization);
                            }
                            else
                            {
                                GUIUtils.ShowNotifyDialog(Translation.Login, string.Format(Translation.UserLoginSuccess, TraktSettings.Username));
                            }
                        }
                    }, Translation.AuthorizingApplication, false);
                }
                else
                {
                    DisconnectAccount();
                }
                break;

            default:
                break;
            }
            base.OnClicked(controlId, control, actionType);
        }
Ejemplo n.º 18
0
 /// <summary>
 /// Called when a control has been updated
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="control"></param>
 void SceneView_ControlUpdated(object sender, GUIControl control)
 {
     if (Globals.PropertiesView.PropertyGrid.SelectedObject == control)
         Globals.PropertiesView.RefreshProperties();
 }
Ejemplo n.º 19
0
 public override void btnNewGame_OnClick(GUIControl control, MouseButton button)
 {
     DeleteSaveSlot(1);
     RestartGame();
 }
Ejemplo n.º 20
0
 void Awake()
 {
     // initialization
     guiControl = GameObject.Find("GUICanvas").GetComponent<GUIControl>();
 }
Ejemplo n.º 21
0
 public void GiveFocus(GUIControl control)
 {
     var index = this.focusableCollection.IndexOf(control);
     if (index != -1 && this.focusableCollection[index].Focusable)
         this.ChangeFocus(index);
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="view"></param>
 /// <param name="control"></param>
 public AddControlCommand(GUIView view, GUIControl parent, GUIControl control)
 {
     mView = view;
     mParent = parent;
     Controls.Add(control);
 }
Ejemplo n.º 23
0
	public GUIControlValueChangedEventArgs(GUIControl GUIControl, Single CurrentValue, Single PreviousValue)
		: base(GUIControl)
	{
		this.CurrentValue = CurrentValue;
		this.PreviousValue = PreviousValue;
	}
Ejemplo n.º 24
0
	public GUIControlCheckedChangedEventArgs(GUIControl GUIControl, Boolean Checked)
		: base(GUIControl)
	{
		this.Checked = Checked;
	}
Ejemplo n.º 25
0
        protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
        {
            if (control == _btnSkin)
            {
                var dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
                if (dlg == null)
                {
                    return;
                }
                dlg.Reset();
                dlg.SetHeading(166); // menu

                IEnumerable <string> installedSkins = GetInstalledSkins();

                foreach (string skin in installedSkins)
                {
                    dlg.Add(skin);
                }

                dlg.SelectedLabel = _btnSkin.SelectedItem;
                dlg.DoModal(GetID);

                if (dlg.SelectedId == -1)
                {
                    return;
                }

                if (String.Compare(dlg.SelectedLabelText, _btnSkin.Label, StringComparison.OrdinalIgnoreCase) != 0)
                {
                    _btnSkin.Label = dlg.SelectedLabelText;

                    // prevent MP from rendering when resource are disposed during live changing of a skin
                    lock (GUIGraphicsContext.RenderLock)
                    {
                        OnSkinChanged();
                    }
                }

                return;
            }
            if (control == _btnLanguage)
            {
                var dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);

                if (dlg == null)
                {
                    return;
                }

                dlg.Reset();
                dlg.SetHeading(248); // menu
                string[] languages = GUILocalizeStrings.SupportedLanguages();

                foreach (string lang in languages)
                {
                    dlg.Add(lang);
                }

                string currentLanguage = _btnLanguage.Label;
                dlg.SelectedLabel = 0;

                for (int i = 0; i < languages.Length; i++)
                {
                    if (languages[i].ToLowerInvariant() == currentLanguage.ToLowerInvariant())
                    {
                        dlg.SelectedLabel = i;
                        break;
                    }
                }

                dlg.DoModal(GetID);

                if (dlg.SelectedId == -1)
                {
                    return;
                }

                if (String.Compare(dlg.SelectedLabelText, _btnLanguage.Label, StringComparison.OrdinalIgnoreCase) != 0)
                {
                    _btnLanguage.Label = dlg.SelectedLabelText;
                    OnLanguageChanged();
                }

                return;
            }
            if (control == _btnLanguagePrefix)
            {
                SettingsChanged(true);
            }

            base.OnClicked(controlId, control, actionType);
        }
Ejemplo n.º 26
0
        public void ContainerItemRemoved(GUIControl control)
        {
            this.focusableCollection.Remove(control);

            if (this.focusableCollection.Count == 0)
            {
                this.focusedIndex = -1;
            }
            else if (this.focusedIndex == this.focusableCollection.Count)
            {
                this.focusedIndex--;
            }
        }
Ejemplo n.º 27
0
 public Label(GUIControl pmParent)
     : this("", pmParent)
 {
 }
Ejemplo n.º 28
0
        public static bool IsNextControl(this GUIControl control1, GUIControl control2)
        {
            if (control1.Bounds.Top > control2.Bounds.Top)
                return true;
            else if (control1.Bounds.Top == control2.Bounds.Top && control1.Bounds.Right >= control2.Bounds.Right)
                return true;

            return false;
        }
Ejemplo n.º 29
0
 public override void btnCancel_OnClick(GUIControl control, MouseButton button)
 {
     gMenu.Visible = false;
 }
Ejemplo n.º 30
0
        protected override void OnPageLoad()
        {
            base.OnPageLoad();

            // if hyperlink parameter is set (to string ID not actual name)
            // then load that view
            if (_loadParameter != null)
            {
                bool viewFound = false;
                foreach (ViewDefinition v in handler.Views)
                {
                    if (v.Name == _loadParameter)
                    {
                        MusicState.View = v.Name; //don't just set _currentView as this is used below
                        m_iItemSelected = -1;     //remove any selected item from previous selection
                        viewFound       = true;
                    }
                }
                if (!viewFound)
                {
                    // got here as parameter passed from hyperlinkParameter value
                    // did not match to a view name
                    Log.Error("Invalid view load parameter: {0} when loading music genres, using default view", _loadParameter);
                }
            }

            string view = MusicState.View;

            if (view == string.Empty)
            {
                view = ((ViewDefinition)handler.Views[0]).Name;
            }

            if (_currentView != null && _currentView.Name == view)
            {
                ((MusicViewHandler)handler).Restore(_currentView, _currentLevel);
            }
            else
            {
                handler.CurrentView = view;
            }


            // Set views
            if (btnViews != null)
            {
                InitViewSelections();
            }

            LoadDirectory("db_view");

            if (facadeLayout.Count <= 0)
            {
                GUIControl.FocusControl(GetID, btnLayouts.GetID);
            }

            if (_showArtist != string.Empty)
            {
                for (int i = 0; i < facadeLayout.Count; ++i)
                {
                    GUIListItem item = facadeLayout[i];
                    MusicTag    tag  = item.MusicTag as MusicTag;
                    if (tag != null)
                    {
                        if (String.Compare(tag.Artist, _showArtist, true) == 0)
                        {
                            OnClick(i);
                            break;
                        }
                    }
                }
            }
            _showArtist = string.Empty;

            using (Profile.Settings settings = new Profile.MPSettings())
            {
                playlistPlayer.RepeatPlaylist = settings.GetValueAsBool("musicfiles", "repeat", true);
            }

            // When we return from Fullscreen Music (the Visualisation screen), the page is reloaded again
            // The currently playing item will not be focused.
            // So we check here, if we have something playing and will focus the item
            if (g_Player.Playing && g_Player.IsMusic)
            {
                int          currentItem = playlistPlayer.CurrentSong;
                PlayListItem item        = playlistPlayer.GetCurrentItem();
                GUIMessage   msg         = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_FOCUS, 0, 0, 0, currentItem, 0, null);
                msg.Label = item.FileName;
                GUIGraphicsContext.SendMessage(msg);
            }
        }
 private void OnItemSelected(GUIListItem item, GUIControl parent)
 {
 }
Ejemplo n.º 32
0
        /// <summary>
        /// this is actually loading a database view not a directory
        /// and this is done via view handler so parameter is not used
        /// but is needed to override method in base class
        /// </summary>
        /// <param name="strNotUsed">Used to implement method in base class but not used</param>
        protected override void LoadDirectory(string strNotUsed)
        {
            GUIWaitCursor.Show();
            GUIListItem SelectedItem = facadeLayout.SelectedListItem;

            int    previousLevel   = ((MusicViewHandler)handler).PreviousLevel;
            string strSelectedItem = string.Empty;

            if (SelectedItem != null)
            {
                // if there is an item selected and we are loading a new view
                // then store the existing value so when we navigate back up through
                // the view levels we can focus on the item we had selected
                // we can not use current level in the name for the directory history
                // as current level gets updated before LoadDirectory is called
                // therefore use previous level which is set by the music view handler
                // when that returns (ie. that will be level of the view user has
                // made selection from as it has not been cleared yet)
                if (SelectedItem.IsFolder && SelectedItem.Label != "..")
                {
                    m_history.Set(SelectedItem.Label, handler.LocalizedCurrentView + "." +
                                  previousLevel.ToString());
                }
            }

            List <Song> songs;

            if (!((MusicViewHandler)handler).Execute(out songs))
            {
                GUIWaitCursor.Hide();
                Action action = new Action();
                action.wID = Action.ActionType.ACTION_PREVIOUS_MENU;
                GUIGraphicsContext.OnAction(action);
                return;
            }

            GUIControl.ClearControl(GetID, facadeLayout.GetID);
            SwitchLayout();

            List <GUIListItem> itemsToAdd = new List <GUIListItem>();

            TimeSpan totalPlayingTime = new TimeSpan();

            if (previousLevel > handler.CurrentLevel)
            {
                // only need to lookup values when navigating back up through the view
                strSelectedItem = m_history.Get(handler.LocalizedCurrentView + "." + handler.CurrentLevel.ToString());
            }

            #region handle pin protected share

            if (songs.Count > 0) // some songs in there?
            {
                Song song = songs[0];
                if (song.FileName.Length > 0) // does a filename exits
                {
                    foreach (Share share in _shareList)
                    {
                        if (song.FileName.Contains(share.Path)) // compare it with shares
                        {
                            if (share.Pincode != string.Empty)  // does it have a pincode?
                            {
                                GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_GET_PASSWORD, 0, 0, 0, 0, 0, 0);
                                GUIWindowManager.SendMessage(msg); // ask for the userinput

                                if (msg.Label != share.Pincode)
                                {
                                    songs.Clear();
                                }
                                break;
                            }
                        }
                    }
                }
            }

            #endregion

            if (handler.CurrentLevel > 0)
            {
                // add ".." folder item if not at bottom level of view
                GUIListItem pItem = new GUIListItem("..");
                pItem.Path     = string.Empty;
                pItem.IsFolder = true;
                Util.Utils.SetDefaultIcons(pItem);
                itemsToAdd.Add(pItem);
            }

            // Get current Filter used
            var currentFilter = (FilterDefinition)handler.View.Filters[handler.CurrentLevel];

            for (int i = 0; i < songs.Count; ++i)
            {
                Song        song = songs[i];
                GUIListItem item = new GUIListItem();

                MusicTag tag = new MusicTag();
                tag = song.ToMusicTag();
                item.AlbumInfoTag = song;
                item.MusicTag     = tag;

                if (handler.CurrentLevel + 1 < handler.MaxLevels)
                {
                    item.IsFolder = true;
                    item.Label    = MusicViewHandler.GetFieldValue(song, handler.CurrentLevelWhere);

                    // If we are grouping on a specific value, we have in the Duration field the number of items
                    // Use this in the sort field
                    if (currentFilter.SqlOperator == "group")
                    {
                        item.Label2 = tag.Duration.ToString();
                    }
                    else
                    {
                        SetSortLabel(ref item, CurrentSortMethod, handler.CurrentLevelWhere);
                    }
                }
                else
                {
                    item.IsFolder = false;
                    if (!GUIMusicBaseWindow.SetTrackLabels(ref item, CurrentSortMethod))
                    {
                        item.Label = song.Title;
                    }
                }

                if (tag != null)
                {
                    if (tag.Duration > 0)
                    {
                        totalPlayingTime = totalPlayingTime.Add(new TimeSpan(0, 0, tag.Duration));
                    }
                }

                item.Path = song.FileName;

                if (!string.IsNullOrEmpty(_currentPlaying) &&
                    item.Path.Equals(_currentPlaying, StringComparison.OrdinalIgnoreCase))
                {
                    item.Selected = true;
                }

                item.Duration        = song.Duration;
                tag.TimesPlayed      = song.TimesPlayed;
                item.Rating          = song.Rating;
                item.Year            = song.Year;
                item.OnRetrieveArt  += new GUIListItem.RetrieveCoverArtHandler(OnRetrieveCoverArt);
                item.OnItemSelected += new GUIListItem.ItemSelectedHandler(item_OnItemSelected);
                itemsToAdd.Add(item);
            }

            itemsToAdd.Sort(new MusicSort(CurrentSortMethod, CurrentSortAsc));

            int  iItem        = 0; // used to hold index of item to select
            bool itemSelected = false;
            for (int i = 0; i < itemsToAdd.Count; ++i)
            {
                if (!itemSelected && itemsToAdd[i].Label == strSelectedItem)
                {
                    iItem        = i;
                    itemSelected = true;
                }
                facadeLayout.Add(itemsToAdd[i]);
            }

            int iTotalItems = facadeLayout.Count;
            if (iTotalItems > 0)
            {
                GUIListItem rootItem = facadeLayout[0];
                if (rootItem.Label == "..")
                {
                    iTotalItems--;
                }
            }

            //set object count label, total duration
            GUIPropertyManager.SetProperty("#itemcount", Util.Utils.GetObjectCountLabel(iTotalItems));

            if (totalPlayingTime.TotalSeconds > 0)
            {
                GUIPropertyManager.SetProperty("#totalduration",
                                               Util.Utils.SecondsToHMSString((int)totalPlayingTime.TotalSeconds));
            }
            else
            {
                GUIPropertyManager.SetProperty("#totalduration", string.Empty);
            }

            if (itemSelected)
            {
                GUIControl.SelectItemControl(GetID, facadeLayout.GetID, iItem);
            }
            else if (m_iItemSelected >= 0)
            {
                GUIControl.SelectItemControl(GetID, facadeLayout.GetID, m_iItemSelected);
            }
            else
            {
                SelectCurrentItem();
            }

            UpdateButtonStates();
            GUIWaitCursor.Hide();
        }
Ejemplo n.º 33
0
	public GUIControlSelectedIndexChangedEventArgs(GUIControl GUIControl, Int32 CurrentIndex, Int32 PreviousIndex)
		: base(GUIControl)
	{
		this.CurrentIndex = CurrentIndex;
		this.PreviousIndex = PreviousIndex;
	}
        private void TestAccount(TraktAuthentication account)
        {
            TraktUserToken response = null;

            if (NewAccount)
            {
                // No longer supported with v2 API.
                //if (lblTestConnect != null)
                //    GUIControl.SetControlLabel(GetID, lblTestConnect.GetID, Translation.CreatingAccount);

                //GUIWindowManager.Process();
                //response = TraktAPI.v1.TraktAPI.CreateAccount(account);
            }
            else
            {
                if (lblTestConnect != null)
                {
                    GUIControl.SetControlLabel(GetID, lblTestConnect.GetID, Translation.SigningIntoAccount);
                }

                GUIWindowManager.Process();
                response = TraktAPI.TraktAPI.Login(account.ToJSON());
            }

            if (response == null || string.IsNullOrEmpty(response.Token))
            {
                GUIUtils.ShowNotifyDialog(Translation.Error, Translation.FailedLogin);
                if (lblTestConnect != null)
                {
                    GUIControl.SetControlLabel(GetID, lblTestConnect.GetID, string.Empty);
                }
            }
            else
            {
                // Save User Token
                TraktAPI.TraktAPI.UserToken = response.Token;

                // Save New Account Settings
                TraktSettings.Username = account.Username;
                TraktSettings.Password = account.Password;
                if (!TraktSettings.UserLogins.Exists(u => u.Username == TraktSettings.Username))
                {
                    TraktSettings.UserLogins.Add(new TraktAuthentication {
                        Username = TraktSettings.Username, Password = TraktSettings.Password
                    });
                }
                TraktSettings.AccountStatus = ConnectionState.Connected;
                HideAccountControls();
                InitProperties();

                // clear caches
                // watchlists are stored by user so dont need clearing.
                GUINetwork.ClearCache();
                GUICalendar.ClearCache();
                GUIRecommendationsMovies.ClearCache();
                GUIRecommendationsShows.ClearCache();

                // clear any stored user data
                TraktCache.ClearSyncCache();
            }
        }
Ejemplo n.º 35
0
        protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
        {
            // Control
            if (control == btnMasterVolume)
            {
                if (btnMasterVolume.Selected)
                {
                    btnWave.Selected = false;
                }
                else
                {
                    btnWave.Selected = true;
                }
                SettingsChanged(true);
            }
            if (control == btnWave)
            {
                if (btnWave.Selected)
                {
                    btnMasterVolume.Selected = false;
                }
                else
                {
                    btnMasterVolume.Selected = true;
                }
                SettingsChanged(true);
            }
            //Scale
            if (control == btnWinXP)
            {
                if (btnWinXP.Selected)
                {
                    btnClassic.Selected     = false;
                    btnLogarithmic.Selected = false;
                    btnVistaWin7.Selected   = false;
                    btnCustom.Selected      = false;
                    _customVolume           = string.Empty;
                    SetProperties();
                    SettingsChanged(true);
                }
            }
            if (control == btnClassic)
            {
                if (btnClassic.Selected)
                {
                    btnWinXP.Selected       = false;
                    btnLogarithmic.Selected = false;
                    btnVistaWin7.Selected   = false;
                    btnCustom.Selected      = false;
                    _customVolume           = string.Empty;
                    SetProperties();
                    SettingsChanged(true);
                }
            }
            if (control == btnLogarithmic)
            {
                if (btnLogarithmic.Selected)
                {
                    btnWinXP.Selected     = false;
                    btnClassic.Selected   = false;
                    btnVistaWin7.Selected = false;
                    btnCustom.Selected    = false;
                    _customVolume         = string.Empty;
                    SetProperties();
                    SettingsChanged(true);
                }
            }
            if (control == btnVistaWin7)
            {
                if (btnVistaWin7.Selected)
                {
                    btnWinXP.Selected       = false;
                    btnClassic.Selected     = false;
                    btnLogarithmic.Selected = false;
                    btnCustom.Selected      = false;
                    _customVolume           = string.Empty;
                    SetProperties();
                    SettingsChanged(true);
                }
            }
            if (control == btnCustom)
            {
                if (btnCustom.Selected)
                {
                    btnWinXP.Selected       = false;
                    btnClassic.Selected     = false;
                    btnLogarithmic.Selected = false;
                    btnVistaWin7.Selected   = false;

                    string volumeTable = _customVolume;
                    GetStringFromKeyboard(ref volumeTable);
                    ValidateCustomTable(ref volumeTable);

                    if (!string.IsNullOrEmpty(volumeTable))
                    {
                        _customVolume = volumeTable;
                    }

                    SetProperties();
                    SettingsChanged(true);
                }
            }

            base.OnClicked(controlId, control, actionType);
        }
Ejemplo n.º 36
0
        public void Update(GameTime gameTime)
        {
            //Switch States!
            if (_currentState != NextState)
            {
                _transitionManager.Begin(800, _currentState);
                _currentState = NextState;
            }

            _transitionManager.Update(gameTime);

            Input.Update(gameTime);
            GUIControl.Update(Input.mouseLastState, Input.mouseState);

            switch (_currentState)
            {
            case ScreenStates.MainMenu:
            {
                _mainMenuLogic.Update(gameTime);
                break;
            }

            case ScreenStates.RadialBlur:
            {
                _radialBlurLogic.Update(gameTime);
                break;
            }

            case ScreenStates.Pixelizer:
            {
                _pixelizerLogic.Update(gameTime);
                break;
            }

            case ScreenStates.Bokeh:
            {
                _bokehLogic.Update(gameTime);
                break;
            }

            case ScreenStates.ParticlePhysics:
            {
                _particlePhysicsLogic.Update(gameTime);
                break;
            }

            case ScreenStates.Subsurface:
            {
                _ssLogic.Update(gameTime);
                break;
            }

            case ScreenStates.FourierTransform:
            {
                _ftLogic.Update(gameTime);
                break;
            }

            default:
                throw new ArgumentOutOfRangeException();
            }

            _debugScreen.Update(gameTime);

            //Reload
        }
Ejemplo n.º 37
0
        private void Update()
        {
            if (_currentActor == null)
            {
                return;
            }

            // Movie mode
            if (_viewmode == ViewMode.Movies)
            {
                if (tbBiographyArea != null)
                {
                    tbBiographyArea.IsVisible = false;
                }
                if (imgCoverArt != null)
                {
                    imgCoverArt.IsVisible = true;
                }
                if (btnBiography != null)
                {
                    btnBiography.Selected = false;
                }
                if (btnMovies != null)
                {
                    btnMovies.Selected = true;
                    btnMovies.Focus    = false;
                }
                // ListActors
                if (listActorMovies != null)
                {
                    listActorMovies.IsVisible = true;
                    listActorMovies.Selected  = true;
                    GUIControl.FocusControl(GetID, listActorMovies.GetID);
                    if (tbMovieArea != null)
                    {
                        tbMovieArea.IsVisible = false;
                    }
                    if (tbMoviePlot != null)
                    {
                        tbMoviePlot.IsVisible = true;
                    }
                    if (imgMovieCover != null)
                    {
                        imgMovieCover.IsVisible = true;
                    }
                    GUIPropertyManager.SetProperty("#itemcount", Util.Utils.GetObjectCountLabel(_currentActor.Count));
                    listActorMovies.SelectedListItemIndex = _currentSelectedItem;
                    SelectItem();
                }
                else
                {
                    if (tbMovieArea != null)
                    {
                        tbMovieArea.IsVisible = true;
                    }
                }
            }

            // Biography mode
            if (_viewmode == ViewMode.Biography)
            {
                if (tbMovieArea != null)
                {
                    tbMovieArea.IsVisible = false;
                }
                if (tbBiographyArea != null)
                {
                    tbBiographyArea.IsVisible = true;
                    tbBiographyArea.Focus     = true;
                }
                if (imgCoverArt != null)
                {
                    imgCoverArt.IsVisible = true;
                }
                if (btnBiography != null)
                {
                    btnBiography.Selected = true;
                }
                if (btnMovies != null)
                {
                    btnMovies.Selected = false;
                }
                // ListActors
                if (listActorMovies != null)
                {
                    listActorMovies.IsVisible = false;
                    listActorMovies.Selected  = false;
                    listActorMovies.Focus     = false;
                    if (tbMoviePlot != null)
                    {
                        tbMoviePlot.IsVisible = false;
                    }
                    if (imgMovieCover != null)
                    {
                        imgMovieCover.IsVisible = false;
                    }
                    _currentSelectedItem = listActorMovies.SelectedListItemIndex;
                    GUIPropertyManager.SetProperty("#itemcount", string.Empty);
                }
            }
        }
Ejemplo n.º 38
0
 public void UpdateResolution()
 {
     GUIControl.UpdateResolution(GameSettings.g_ScreenWidth, GameSettings.g_ScreenHeight);
     _mainMenuLogic.UpdateResolution();
 }
Ejemplo n.º 39
0
 private void OnItemSelected(GUIListItem item, GUIControl parent)
 {
     if (item != null)
     {
     }
 }
Ejemplo n.º 40
0
        /// <summary>
        /// Sets the control's new parent.  This function will also fix up any
        /// other animations that references the control.
        /// </summary>
        /// <param name="control"></param>
        /// <param name="newParent"></param>
        private static void SetParent(GUIControl control, GUIControl newParent, int index)
        {
            GUIView view = (newParent is GUIView) ? newParent as GUIView : newParent.ParentView;
            Otter.Interface.Matrix invTransform = newParent.FullTransformInv;

            PointF center = PointF.Empty;
            float rotation = 0.0f;
            PointF location = PointF.Empty;

            Matrix oldTransformInv = control.TransformInv;
            Matrix newTransform = control.FullTransform * invTransform;
            Matrix toLocal = oldTransformInv * newTransform;

            GetComponents(control, ref newTransform, out center, out rotation, out location);

            if (control.ParentView == view)
            {
                GUIAnimation currentAnim = view.CurrentAnimation;
                uint currentFrame = currentAnim.Frame;

                foreach (GUIAnimation animation in view.Animations)
                {
                    uint oldFrame = animation.Frame;
                    GUIAnimationChannel channel = animation.GetAnimationChannel(control);

                    if (channel == null)
                        continue;

                    view.CurrentAnimation = animation;

                    foreach (KeyFrame keyFrame in channel.KeyFrames)
                    {
                        // This will update the control
                        view.CurrentAnimation.Frame = keyFrame.Frame;

                        PointF kfCenter = control.Center;
                        float kfRotation = control.Rotation;
                        PointF kfLocation = control.Location;

                        Matrix kfTransform = control.Transform * toLocal;

                        GetComponents(control, ref kfTransform, out kfCenter, out kfRotation, out kfLocation);

                        keyFrame.Layout.Center = kfCenter;
                        keyFrame.Layout.Rotation = kfRotation;
                        keyFrame.Layout.Location = kfLocation;
                    }

                    animation.Frame = oldFrame;
                }

                view.CurrentAnimation = currentAnim;
                view.CurrentAnimation.Frame = currentFrame;

                view.SetNewParent(control, newParent, index);
            }
            else
            {
                control.ParentView.RemoveControl(control);
                view.AddControl(newParent, control);
            }

            control.Center = center;
            control.Rotation = rotation;
            control.Location = location;
        }
Ejemplo n.º 41
0
        private void SendWatchListMoviesToFacade(IEnumerable <TraktWatchListMovie> movies)
        {
            // clear facade
            GUIControl.ClearControl(GetID, Facade.GetID);

            if (movies.Count() == 0)
            {
                GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), string.Format(Translation.NoMovieWatchList, CurrentUser));
                CurrentUser = TraktSettings.Username;
                GUIWindowManager.ShowPreviousWindow();
                return;
            }

            // sort movies
            var movieList = movies.ToList();

            movieList.Sort(new GUIListItemMovieSorter(TraktSettings.SortByWatchListMovies.Field, TraktSettings.SortByWatchListMovies.Direction));

            int itemId = 0;
            List <TraktMovie.MovieImages> movieImages = new List <TraktMovie.MovieImages>();

            // Add each movie
            foreach (var movie in movieList)
            {
                GUITraktWatchListMovieListItem item = new GUITraktWatchListMovieListItem(movie.Title);

                item.Label2          = movie.Year;
                item.TVTag           = movie;
                item.Item            = movie.Images;
                item.ItemId          = Int32.MaxValue - itemId;
                item.IsPlayed        = movie.Watched;
                item.IconImage       = "defaultVideo.png";
                item.IconImageBig    = "defaultVideoBig.png";
                item.ThumbnailImage  = "defaultVideoBig.png";
                item.OnItemSelected += OnMovieSelected;
                Utils.SetDefaultIcons(item);
                Facade.Add(item);
                itemId++;

                // add image for download
                movieImages.Add(movie.Images);
            }

            // Set Facade Layout
            Facade.SetCurrentLayout(Enum.GetName(typeof(Layout), CurrentLayout));
            GUIControl.FocusControl(GetID, Facade.GetID);

            if (PreviousSelectedIndex >= movies.Count())
            {
                Facade.SelectIndex(PreviousSelectedIndex - 1);
            }
            else
            {
                Facade.SelectIndex(PreviousSelectedIndex);
            }

            // set facade properties
            GUIUtils.SetProperty("#itemcount", movies.Count().ToString());
            GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", movies.Count().ToString(), movies.Count() > 1 ? Translation.Movies : Translation.Movie));

            // Download movie images Async and set to facade
            GetImages(movieImages);
        }
Ejemplo n.º 42
0
        /// <summary>
        /// Retrieves the components of the control's new local transform 
        /// </summary>
        /// <param name="contro  l"></param>
        /// <param name="newLocalTransform"></param>
        /// <param name="center"></param>
        /// <param name="rotation"></param>
        /// <param name="location"></param>
        private static void GetComponents(GUIControl control, ref Matrix newLocalTransform, out PointF center, out float rotation, out PointF location)
        {
            center = control.Center;
            rotation = ((float)Math.Atan2(newLocalTransform.M21, newLocalTransform.M11) / (float)Math.PI) * 180.0f;
            // atan2 -> [-pi, pi]

            // If the signs of the new rotation and old one mismatch, we need to add or subtract
            // 2 * pi to get the 'correct' rotation back
            int signA = Math.Sign(rotation);
            int signB = Math.Sign(control.Rotation);

            if (signA != 0 && signB != 0 && signA != signB)
            {
                rotation += 360.0f * Math.Sign(control.Rotation);
            }

            // The original rotation could have been expressed in multiples of 2*pi, so let's figure out what that multiplier
            // is and add that back into the rotation
            float piMult = ((int)(control.Rotation / 360.0f)) * 360.0f;
            rotation += piMult;

            Matrix mtxOffset = Matrix.Translation(-center.X, -center.Y, 0.0f);
            Matrix mtxRotation = Matrix.RotationZ((rotation / 180.0f) * (float)Math.PI);
            Matrix mtxLocation = Matrix.Invert(mtxOffset * mtxRotation) * newLocalTransform;

            Vector4 v4 = Vector4.Transform(new Vector4(0.0f, 0.0f, 0.0f, 1.0f), mtxLocation);
            location = new PointF(v4.X, v4.Y);
        }
Ejemplo n.º 43
0
        /// <summary>
        /// Adds the control to the tree
        /// </summary>
        /// <param name="ancestor"></param>
        /// <param name="control"></param>
        private void AddControlNode(Node parentNode, GUIControl control, int atIndex)
        {
            SceneNode node = new SceneNode(control);

            if (atIndex >= 0)
                 parentNode.Nodes.Insert(atIndex, node);
            else
                parentNode.Nodes.Add(node);

            foreach (GUIControl childControl in control.Controls)
            {
                AddControlNode(node, childControl);
            }
        }
Ejemplo n.º 44
0
 /// <summary>
 /// Called when the selected control has been renamed
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="control"></param>
 void SceneHierarchyView_SelectedControlRenamed(object sender, GUIControl control)
 {
     Globals.TimelineView.Refresh();
     Globals.PropertiesView.RefreshProperties();
 }
Ejemplo n.º 45
0
 public override void btnSave_OnClick(GUIControl control, MouseButton button)
 {
     gMenu.Visible = false;
     SaveGameSlot(1, "1");
     cNar.Say("Game Saved");
 }
Ejemplo n.º 46
0
 /// <summary>
 /// Selects a single control
 /// </summary>
 /// <param name="source"></param>
 /// <param name="view"></param>
 /// <param name="control"></param>
 private void SelectControl(object source, GUIView view, GUIControl control)
 {
     SelectControls(source, view, (control != null) ? new List<GUIControl>(new GUIControl[] { control }) : new List<GUIControl>());
 }
Ejemplo n.º 47
0
 public override void btnAccept_OnClick(GUIControl control, MouseButton button)
 {
     SetDisplayStyle(displayStyle);            SetFullScreen(fullScreen);            ApplyGraphicalChanges();
     gMenu.Visible = false;
 }
Ejemplo n.º 48
0
 public SceneNode(GUIControl control)
     : base(control.Name)
 {
     mControl = control;
     this.Tag = control;
 }
Ejemplo n.º 49
0
 public override void btnQuit_OnClick(GUIControl control, MouseButton button)
 {
     QuitGame(0);
 }
 private void item_OnItemSelected(GUIListItem item, GUIControl parent)
 {
     UpdateSelectedProperties(item);
 }
 protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
 {
     base.OnClicked(controlId, control, actionType);
 }
Ejemplo n.º 52
0
        protected virtual void SetView(int selectedViewId)
        {
            bool isVideoWindow = (this.GetID == (int)Window.WINDOW_VIDEOS || this.GetID == (int)Window.WINDOW_VIDEO_TITLE);

            switch (selectedViewId)
            {
            case 0: // Shares
            {
                int nNewWindow;
                if (isVideoWindow)
                {
                    nNewWindow = (int)Window.WINDOW_VIDEOS;
                }
                else
                {
                    nNewWindow = (int)Window.WINDOW_MUSIC_FILES;
                }
                StateBase.StartWindow = nNewWindow;
                if (nNewWindow != GetID)
                {
                    if (isVideoWindow)
                    {
                        MediaPortal.GUI.Video.GUIVideoFiles.Reset();
                    }
                    GUIWindowManager.ReplaceWindow(nNewWindow);
                }
            }
            break;

            case 4540: // Now playing
            {
                int nPlayingNowWindow = (int)Window.WINDOW_MUSIC_PLAYING_NOW;

                MediaPortal.GUI.Music.GUIMusicPlayingNow guiPlayingNow =
                    (MediaPortal.GUI.Music.GUIMusicPlayingNow)GUIWindowManager.GetWindow(nPlayingNowWindow);

                if (guiPlayingNow != null)
                {
                    guiPlayingNow.MusicWindow = (MediaPortal.GUI.Music.GUIMusicBaseWindow) this;
                    GUIWindowManager.ActivateWindow(nPlayingNowWindow);
                }
            }
            break;

            default: // a db view
            {
                ViewDefinition selectedView = (ViewDefinition)handler.Views[selectedViewId - 1];
                handler.CurrentView = selectedView.Name;
                StateBase.View      = selectedView.Name;
                int nNewWindow;
                if (isVideoWindow)
                {
                    nNewWindow = (int)Window.WINDOW_VIDEO_TITLE;
                    // Reset search variables
                    if (GUIVideoTitle.CurrentViewHistory != handler.CurrentLevelWhere)
                    {
                        GUIVideoTitle.IsActorSearch            = false;
                        GUIVideoTitle.IsMovieSearch            = false;
                        GUIVideoTitle.ActorSearchString        = string.Empty;
                        GUIVideoTitle.MovieSearchString        = string.Empty;
                        GUIVideoTitle.MovieSearchDbFieldString = string.Empty;
                    }
                }
                else
                {
                    nNewWindow = (int)Window.WINDOW_MUSIC_GENRE;
                }
                if (GetID != nNewWindow)
                {
                    StateBase.StartWindow = nNewWindow;
                    if (nNewWindow != GetID)
                    {
                        GUIWindowManager.ReplaceWindow(nNewWindow);
                    }
                }
                else
                {
                    LoadDirectory(string.Empty);
                    if (facadeLayout.Count <= 0)
                    {
                        GUIControl.FocusControl(GetID, btnLayouts.GetID);
                    }
                }
            }
            break;
            }
        }
Ejemplo n.º 53
0
        protected override void OnShowContextMenu()
        {
            var selectedItem = this.Facade.SelectedListItem;

            if (selectedItem == null)
            {
                return;
            }

            var userListItem = selectedItem.TVTag as TraktUserListItem;

            if (userListItem == null)
            {
                return;
            }

            var dlg = (IDialogbox)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }

            dlg.Reset();
            dlg.SetHeading(GUIUtils.PluginName());

            GUIListItem listItem = null;

            if (SelectedType == TraktItemType.movie || SelectedType == TraktItemType.episode)
            {
                // Mark As Watched
                if (!userListItem.Watched)
                {
                    listItem = new GUIListItem(Translation.MarkAsWatched);
                    dlg.Add(listItem);
                    listItem.ItemId = (int)ContextMenuItem.MarkAsWatched;
                }

                // Mark As UnWatched
                if (userListItem.Watched)
                {
                    listItem = new GUIListItem(Translation.MarkAsUnWatched);
                    dlg.Add(listItem);
                    listItem.ItemId = (int)ContextMenuItem.MarkAsUnWatched;
                }
            }

            if (SelectedType != TraktItemType.season)
            {
                // Add/Remove Watch List
                if (!userListItem.InWatchList)
                {
                    listItem = new GUIListItem(Translation.AddToWatchList);
                    dlg.Add(listItem);
                    listItem.ItemId = (int)ContextMenuItem.AddToWatchList;
                }
                else
                {
                    listItem = new GUIListItem(Translation.RemoveFromWatchList);
                    dlg.Add(listItem);
                    listItem.ItemId = (int)ContextMenuItem.RemoveFromWatchList;
                }
            }

            // Add to Custom list
            listItem = new GUIListItem(Translation.AddToList);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.AddToList;

            // Remove from Custom list (Only if current user is the active user)
            if (TraktSettings.Username == CurrentUser)
            {
                listItem = new GUIListItem(Translation.RemoveFromList);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.RemoveFromList;
            }

            if (SelectedType == TraktItemType.movie || SelectedType == TraktItemType.episode)
            {
                // Add to Library
                // Don't allow if it will be removed again on next sync
                // movie could be part of a DVD collection
                if (!userListItem.InCollection && !TraktSettings.KeepTraktLibraryClean)
                {
                    listItem = new GUIListItem(Translation.AddToLibrary);
                    dlg.Add(listItem);
                    listItem.ItemId = (int)ContextMenuItem.AddToLibrary;
                }

                if (userListItem.InCollection)
                {
                    listItem = new GUIListItem(Translation.RemoveFromLibrary);
                    dlg.Add(listItem);
                    listItem.ItemId = (int)ContextMenuItem.RemoveFromLibrary;
                }
            }

            // Related Movies/Shows
            listItem = new GUIListItem(SelectedType == TraktItemType.movie ? Translation.RelatedMovies : Translation.RelatedShows + "...");
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.Related;

            if (SelectedType != TraktItemType.season)
            {
                // Rate
                listItem = new GUIListItem(Translation.Rate + "...");
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.Rate;

                // Shouts
                listItem = new GUIListItem(Translation.Shouts + "...");
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.Shouts;
            }

            // Trailers
            if (TraktHelper.IsOnlineVideosAvailableAndEnabled)
            {
                listItem = new GUIListItem(Translation.Trailers);
                dlg.Add(listItem);
                listItem.ItemId = (int)ContextMenuItem.Trailers;
            }

            // Search with mpNZB
            if (TraktHelper.IsMpNZBAvailableAndEnabled)
            {
                if ((userListItem.Movie != null && !userListItem.Movie.InCollection) || userListItem.Episode != null)
                {
                    listItem = new GUIListItem(Translation.SearchWithMpNZB);
                    dlg.Add(listItem);
                    listItem.ItemId = (int)ContextMenuItem.SearchWithMpNZB;
                }
            }

            // Search with MyTorrents
            if (TraktHelper.IsMyTorrentsAvailableAndEnabled)
            {
                if ((userListItem.Movie != null && !userListItem.Movie.InCollection) || userListItem.Episode != null)
                {
                    listItem = new GUIListItem(Translation.SearchTorrent);
                    dlg.Add(listItem);
                    listItem.ItemId = (int)ContextMenuItem.SearchTorrent;
                }
            }

            // Change Layout
            listItem = new GUIListItem(Translation.ChangeLayout);
            dlg.Add(listItem);
            listItem.ItemId = (int)ContextMenuItem.ChangeLayout;

            // Show Context Menu
            dlg.DoModal(GUIWindowManager.ActiveWindow);
            if (dlg.SelectedId < 0)
            {
                return;
            }

            switch (dlg.SelectedId)
            {
            case ((int)ContextMenuItem.MarkAsWatched):
                MarkItemAsWatched(userListItem);
                if (userListItem.Plays == 0)
                {
                    userListItem.Plays = 1;
                }
                userListItem.Watched  = true;
                selectedItem.IsPlayed = true;
                OnItemSelected(selectedItem, Facade);
                if (SelectedType == TraktItemType.movie)
                {
                    (Facade.SelectedListItem as GUICustomListItem).Images.NotifyPropertyChanged("MoviePoster");
                }
                else
                {
                    (Facade.SelectedListItem as GUICustomListItem).Images.NotifyPropertyChanged("ShowPoster");
                }
                break;

            case ((int)ContextMenuItem.MarkAsUnWatched):
                MarkItemAsUnWatched(userListItem);
                userListItem.Watched  = false;
                selectedItem.IsPlayed = false;
                OnItemSelected(selectedItem, Facade);
                if (SelectedType == TraktItemType.movie)
                {
                    (Facade.SelectedListItem as GUICustomListItem).Images.NotifyPropertyChanged("MoviePoster");
                }
                else
                {
                    (Facade.SelectedListItem as GUICustomListItem).Images.NotifyPropertyChanged("ShowPoster");
                }
                break;

            case ((int)ContextMenuItem.AddToWatchList):
                AddItemToWatchList(userListItem);
                userListItem.InWatchList = true;
                OnItemSelected(selectedItem, Facade);
                if (SelectedType == TraktItemType.movie)
                {
                    (Facade.SelectedListItem as GUICustomListItem).Images.NotifyPropertyChanged("MoviePoster");
                }
                else
                {
                    (Facade.SelectedListItem as GUICustomListItem).Images.NotifyPropertyChanged("ShowPoster");
                }
                GUIWatchListMovies.ClearCache(TraktSettings.Username);
                break;

            case ((int)ContextMenuItem.RemoveFromWatchList):
                RemoveItemFromWatchList(userListItem);
                userListItem.InWatchList = false;
                OnItemSelected(selectedItem, Facade);
                if (SelectedType == TraktItemType.movie)
                {
                    (Facade.SelectedListItem as GUICustomListItem).Images.NotifyPropertyChanged("MoviePoster");
                }
                else
                {
                    (Facade.SelectedListItem as GUICustomListItem).Images.NotifyPropertyChanged("ShowPoster");
                }
                GUIWatchListMovies.ClearCache(TraktSettings.Username);
                break;

            case ((int)ContextMenuItem.AddToList):
                if (SelectedType == TraktItemType.movie)
                {
                    TraktHelper.AddRemoveMovieInUserList(userListItem.Title, userListItem.Year, userListItem.ImdbId, false);
                }
                else if (SelectedType == TraktItemType.show)
                {
                    TraktHelper.AddRemoveShowInUserList(userListItem.Title, userListItem.Year, userListItem.Show.Tvdb, false);
                }
                else if (SelectedType == TraktItemType.season)
                {
                    TraktHelper.AddRemoveSeasonInUserList(userListItem.Title, userListItem.Year, userListItem.SeasonNumber, userListItem.Show.Tvdb, false);
                }
                else if (SelectedType == TraktItemType.episode)
                {
                    TraktHelper.AddRemoveEpisodeInUserList(userListItem.Title, userListItem.Year, userListItem.SeasonNumber, userListItem.EpisodeNumber, userListItem.Show.Tvdb, false);
                }
                break;

            case ((int)ContextMenuItem.RemoveFromList):
                if (!GUIUtils.ShowYesNoDialog(Translation.DeleteListItem, Translation.ConfirmDeleteListItem))
                {
                    break;
                }

                // Only do remove from current list
                // We could do same as Add (ie remove from multile lists) but typically you only remove from the current list
                if (SelectedType == TraktItemType.movie)
                {
                    TraktListItem item = new TraktListItem {
                        Type = "movie", ImdbId = userListItem.ImdbId, Title = userListItem.Title, Year = Convert.ToInt32(userListItem.Year)
                    };
                    TraktHelper.AddRemoveItemInList(CurrentList.Slug, item, true);
                }
                else if (SelectedType == TraktItemType.show)
                {
                    TraktListItem item = new TraktListItem {
                        Type = "show", TvdbId = userListItem.Show.Tvdb, Title = userListItem.Title, Year = Convert.ToInt32(userListItem.Year)
                    };
                    TraktHelper.AddRemoveItemInList(CurrentList.Slug, item, true);
                }
                else if (SelectedType == TraktItemType.season)
                {
                    TraktListItem item = new TraktListItem {
                        Type = "season", TvdbId = userListItem.Show.Tvdb, Title = userListItem.Title, Year = Convert.ToInt32(userListItem.Year), Season = Convert.ToInt32(userListItem.SeasonNumber)
                    };
                    TraktHelper.AddRemoveItemInList(CurrentList.Slug, item, true);
                }
                else if (SelectedType == TraktItemType.episode)
                {
                    TraktListItem item = new TraktListItem {
                        Type = "episode", TvdbId = userListItem.Show.Tvdb, Title = userListItem.Title, Year = Convert.ToInt32(userListItem.Year), Season = Convert.ToInt32(userListItem.SeasonNumber), Episode = Convert.ToInt32(userListItem.EpisodeNumber)
                    };
                    TraktHelper.AddRemoveItemInList(CurrentList.Slug, item, true);
                }

                // Remove from view
                if (Facade.Count > 1)
                {
                    PreviousSelectedIndex = Facade.SelectedListItemIndex;
                    CurrentList.Items.Remove(userListItem);
                    SendListItemsToFacade(CurrentList);
                }
                else
                {
                    CurrentList.Items.Remove(userListItem);

                    // no more items left
                    GUIControl.ClearControl(GetID, Facade.GetID);
                    ClearProperties();
                    GUIWindowManager.Process();

                    // nothing left, exit
                    GUIWindowManager.ShowPreviousWindow();
                    return;
                }
                break;

            case ((int)ContextMenuItem.AddToLibrary):
                AddItemToLibrary(userListItem);
                userListItem.InCollection = true;
                OnItemSelected(selectedItem, Facade);
                if (SelectedType == TraktItemType.movie)
                {
                    (Facade.SelectedListItem as GUICustomListItem).Images.NotifyPropertyChanged("MoviePoster");
                }
                else
                {
                    (Facade.SelectedListItem as GUICustomListItem).Images.NotifyPropertyChanged("ShowPoster");
                }
                break;

            case ((int)ContextMenuItem.RemoveFromLibrary):
                RemoveItemFromLibrary(userListItem);
                userListItem.InCollection = false;
                OnItemSelected(selectedItem, Facade);
                if (SelectedType == TraktItemType.movie)
                {
                    (Facade.SelectedListItem as GUICustomListItem).Images.NotifyPropertyChanged("MoviePoster");
                }
                else
                {
                    (Facade.SelectedListItem as GUICustomListItem).Images.NotifyPropertyChanged("ShowPoster");
                }
                break;

            case ((int)ContextMenuItem.Related):
                if (SelectedType == TraktItemType.movie)
                {
                    RelatedMovie relatedMovie = new RelatedMovie();
                    relatedMovie.IMDbId           = userListItem.Movie.IMDBID;
                    relatedMovie.Title            = userListItem.Movie.Title;
                    GUIRelatedMovies.relatedMovie = relatedMovie;
                    GUIWindowManager.ActivateWindow((int)TraktGUIWindows.RelatedMovies);
                }
                else
                {
                    //series, season & episode
                    RelatedShow relatedShow = new RelatedShow();
                    relatedShow.Title           = userListItem.Show.Title;
                    relatedShow.TVDbId          = userListItem.Show.Tvdb;
                    GUIRelatedShows.relatedShow = relatedShow;
                    GUIWindowManager.ActivateWindow((int)TraktGUIWindows.RelatedShows);
                }
                break;

            case ((int)ContextMenuItem.Rate):
                RateItem(userListItem);
                OnItemSelected(selectedItem, Facade);
                if (SelectedType == TraktItemType.movie)
                {
                    (Facade.SelectedListItem as GUICustomListItem).Images.NotifyPropertyChanged("MoviePoster");
                }
                else
                {
                    (Facade.SelectedListItem as GUICustomListItem).Images.NotifyPropertyChanged("ShowPoster");
                }
                break;

            case ((int)ContextMenuItem.Shouts):
                GUIShouts.ShoutType = (GUIShouts.ShoutTypeEnum)Enum.Parse(typeof(GUIShouts.ShoutTypeEnum), SelectedType.ToString(), true);
                if (SelectedType == TraktItemType.movie)
                {
                    GUIShouts.MovieInfo = new MovieShout {
                        IMDbId = userListItem.ImdbId, TMDbId = userListItem.Movie.TMDBID, Title = userListItem.Title, Year = userListItem.Year
                    }
                }
                ;
                else if (SelectedType == TraktItemType.show)
                {
                    GUIShouts.ShowInfo = new ShowShout {
                        IMDbId = userListItem.ImdbId, TVDbId = userListItem.Show.Tvdb, Title = userListItem.Title
                    }
                }
                ;
                else
                {
                    GUIShouts.EpisodeInfo = new EpisodeShout {
                        IMDbId = userListItem.ImdbId, TVDbId = userListItem.Show.Tvdb, Title = userListItem.Title, SeasonIdx = userListItem.SeasonNumber, EpisodeIdx = userListItem.EpisodeNumber
                    }
                };
                GUIShouts.Fanart = SelectedType == TraktItemType.movie ? userListItem.Movie.Images.Fanart.LocalImageFilename(ArtworkType.MovieFanart) : userListItem.Show.Images.Fanart.LocalImageFilename(ArtworkType.ShowFanart);
                GUIWindowManager.ActivateWindow((int)TraktGUIWindows.Shouts);
                break;

            case ((int)ContextMenuItem.Trailers):
                if (SelectedType == TraktItemType.movie)
                {
                    GUICommon.ShowMovieTrailersMenu(userListItem.Movie);
                }
                else if (SelectedType == TraktItemType.episode)
                {
                    userListItem.Episode.Season = Convert.ToInt32(userListItem.SeasonNumber);
                    userListItem.Episode.Number = Convert.ToInt32(userListItem.EpisodeNumber);

                    GUICommon.ShowTVShowTrailersMenu(userListItem.Show, userListItem.Episode);
                }
                else if (SelectedType == TraktItemType.season && TraktSettings.UseTrailersPlugin && TraktHelper.IsTrailersAvailableAndEnabled)
                {
                    GUICommon.ShowTVSeasonTrailersPluginMenu(userListItem.Show, int.Parse(userListItem.SeasonNumber));
                }
                break;

            case ((int)ContextMenuItem.SearchWithMpNZB):
                string loadingParam = String.Empty;
                if (userListItem.Movie != null)
                {
                    loadingParam = string.Format("search:{0}", userListItem.Movie.Title);
                }
                else if (userListItem.Episode != null)
                {
                    loadingParam = string.Format("search:{0} S{1}E{2}", userListItem.Show.Title, userListItem.Episode.Season.ToString("D2"), userListItem.Episode.Number.ToString("D2"));
                }
                GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MpNZB, loadingParam);
                break;

            case ((int)ContextMenuItem.SearchTorrent):
                string loadPar = String.Empty;
                if (userListItem.Movie != null)
                {
                    loadPar = userListItem.Movie.Title;
                }
                else if (userListItem.Episode != null)
                {
                    loadPar = string.Format("{0} S{1}E{2}", userListItem.Show.Title, userListItem.Episode.Season.ToString("D2"), userListItem.Episode.Number.ToString("D2"));
                }
                GUIWindowManager.ActivateWindow((int)ExternalPluginWindows.MyTorrents, loadPar);
                break;

            case ((int)ContextMenuItem.ChangeLayout):
                CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout, PreviousSelectedIndex);
                break;

            default:
                break;
            }

            base.OnShowContextMenu();
        }
Ejemplo n.º 54
0
        protected override void LoadDirectory(string strNewDirectory)
        {
            GUIWaitCursor.Show();

            currentFolder = strNewDirectory;

            GUIControl.ClearControl(GetID, facadeLayout.GetID);

            ArrayList itemlist = new ArrayList();
            ArrayList movies   = ((VideoViewHandler)handler).Execute();

            if (handler.CurrentLevel > 0)
            {
                GUIListItem listItem = new GUIListItem("..");
                listItem.Path     = string.Empty;
                listItem.IsFolder = true;
                Util.Utils.SetDefaultIcons(listItem);
                itemlist.Add(listItem);
            }

            foreach (IMDBMovie movie in movies)
            {
                GUIListItem item = new GUIListItem();
                item.Label = movie.Title;
                if (handler.CurrentLevel + 1 < handler.MaxLevels)
                {
                    item.IsFolder = true;
                }
                else
                {
                    item.IsFolder = false;
                }

                item.Path = movie.File;

                // Protected movies validation, checks item and if it is inside protected shares.
                // If item is inside PIN protected share, checks if user validate PIN with Unlock
                // command from context menu and returns "True" if all is ok and item will be visible
                // in movie list. Non-protected item will skip check and will be always visible.
                if (!string.IsNullOrEmpty(item.Path) && !CheckItem(item))
                {
                    continue;
                }
                //
                item.Duration     = movie.RunTime * 60;
                item.AlbumInfoTag = movie;
                item.Year         = movie.Year;
                item.DVDLabel     = movie.DVDLabel;
                item.Rating       = movie.Rating;
                item.IsPlayed     = movie.Watched > 0 ? true : false;

                item.OnItemSelected += new GUIListItem.ItemSelectedHandler(item_OnItemSelected);

                itemlist.Add(item);
            }

            int itemIndex = 0;

            foreach (GUIListItem item in itemlist)
            {
                facadeLayout.Add(item);
            }
            // Set selected item history
            string viewFolder;

            if (handler.CurrentLevelWhere.ToLower() == "genre")
            {
                viewFolder = "genre";
            }
            else if (handler.CurrentLevelWhere.ToLower() == "actor")
            {
                viewFolder = "actor";
            }
            else if (handler.CurrentLevelWhere.ToLower() == "year")
            {
                viewFolder = "year";
            }
            else
            {
                viewFolder = "title";
            }

            string selectedItemLabel = m_history.Get(viewFolder);

            // Sort
            OnSort();

            if (string.IsNullOrEmpty(selectedItemLabel) && facadeLayout.SelectedListItem != null)
            {
                selectedItemLabel = facadeLayout.SelectedListItem.Label;
            }

            int itemCount = itemlist.Count;

            if (itemlist.Count > 0)
            {
                GUIListItem rootItem = (GUIListItem)itemlist[0];
                if (rootItem.Label == "..")
                {
                    itemCount--;
                }
            }

            //set object count label
            GUIPropertyManager.SetProperty("#itemcount", Util.Utils.GetObjectCountLabel(itemCount));

            // Clear info for zero result
            if (itemlist.Count == 0)
            {
                GUIListItem item = new GUIListItem();
                item.Label = GUILocalizeStrings.Get(284);
                IMDBMovie movie = item.AlbumInfoTag as IMDBMovie;
                movie             = new IMDBMovie();
                item.AlbumInfoTag = movie;
                movie.SetProperties(false);
                itemlist.Add(item);
                facadeLayout.Add(item);
            }

            SwitchLayout();
            UpdateButtonStates();

            if (handler.CurrentLevel == 0)
            {
                for (int i = 0; i < facadeLayout.Count; ++i)
                {
                    GUIListItem item = facadeLayout[itemIndex];
                    if (item.Label == selectedItemLabel)
                    {
                        currentSelectedItem = itemIndex;
                        SelectItem();
                        break;
                    }
                    itemIndex++;
                }
            }
            // Set thumbs - also do a Item select
            if (handler.CurrentLevel < handler.MaxLevels)
            {
                if (handler.CurrentLevelWhere.ToLower() == "genre")
                {
                    SetGenreThumbs(itemlist);
                    SelectItem();
                }
                else if (handler.CurrentLevelWhere.ToLower() == "actor")
                {
                    SetActorThumbs(itemlist);
                }
                else if (handler.CurrentLevelWhere.ToLower() == "year")
                {
                    SetYearThumbs(itemlist);
                    SelectItem();
                }
                else
                {
                    // Assign thumbnails also for the custom views. Bugfix for Mantis 0001471:
                    // Cover image thumbs missing in My Videos when view Selection is by "watched"
                    SetIMDBThumbs(itemlist);
                }
            }
            else
            {
                SetIMDBThumbs(itemlist);
            }

            GUIWaitCursor.Hide();
        }
        /// <summary>
        /// On Message
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        public override bool OnMessage(GUIMessage message)
        {
            switch (message.Message)
            {
            case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT:
            {
                // fetch settings for the current capture card
                _cropSettings = TvCropManager.CropSettings;
                GUILabelControl cardLabel = GetControl((int)Controls.CONTROL_CARD_LABEL) as GUILabelControl;
                cardLabel.Visible = false;

                foreach (int iCtl in Enum.GetValues(typeof(Controls)))
                {
                    if (GetControl(iCtl) is GUISpinControl)
                    {
                        GUISpinControl cntl = (GUISpinControl)GetControl(iCtl);
                        cntl.ShowRange = false;
                    }
                }
                GUIControl.ClearControl(GetID, (int)Controls.CONTROL_CROP_TOP);
                for (int i = 0; i <= 200; ++i)
                {
                    GUIControl.AddItemLabelControl(GetID, (int)Controls.CONTROL_CROP_TOP, i.ToString());
                }
                GUIControl.SelectItemControl(GetID, (int)Controls.CONTROL_CROP_TOP, _cropSettings.Top);
                GUIControl.ClearControl(GetID, (int)Controls.CONTROL_CROP_BOTTOM);
                for (int i = 0; i <= 200; ++i)
                {
                    GUIControl.AddItemLabelControl(GetID, (int)Controls.CONTROL_CROP_BOTTOM, i.ToString());
                }
                GUIControl.SelectItemControl(GetID, (int)Controls.CONTROL_CROP_BOTTOM, _cropSettings.Bottom);
                GUIControl.ClearControl(GetID, (int)Controls.CONTROL_CROP_LEFT);
                for (int i = 0; i <= 200; ++i)
                {
                    GUIControl.AddItemLabelControl(GetID, (int)Controls.CONTROL_CROP_LEFT, i.ToString());
                }
                GUIControl.SelectItemControl(GetID, (int)Controls.CONTROL_CROP_LEFT, _cropSettings.Left);
                GUIControl.ClearControl(GetID, (int)Controls.CONTROL_CROP_RIGHT);
                for (int i = 0; i <= 200; ++i)
                {
                    GUIControl.AddItemLabelControl(GetID, (int)Controls.CONTROL_CROP_RIGHT, i.ToString());
                }
                GUIControl.SelectItemControl(GetID, (int)Controls.CONTROL_CROP_RIGHT, _cropSettings.Right);

                break;
            }

            case GUIMessage.MessageType.GUI_MSG_CLICKED:
            {
                int iControl = message.SenderControlId;
                if (iControl == (int)Controls.CONTROL_EXIT)
                {
                    Close();
                }
                else if (iControl == (int)Controls.CONTROL_CROP_TOP)
                {
                    // do not use message.Label, because it's empty for "page up/down", causing exceptions
                    _cropSettings.Top = (GetControl(iControl) as GUISpinControl).Value;
                }
                else if (iControl == (int)Controls.CONTROL_CROP_BOTTOM)
                {
                    _cropSettings.Bottom = (GetControl(iControl) as GUISpinControl).Value;
                }
                else if (iControl == (int)Controls.CONTROL_CROP_LEFT)
                {
                    _cropSettings.Left = (GetControl(iControl) as GUISpinControl).Value;
                }
                else if (iControl == (int)Controls.CONTROL_CROP_RIGHT)
                {
                    _cropSettings.Right = (GetControl(iControl) as GUISpinControl).Value;
                }

                // ativate & save settings for the current capture card
                TvCropManager.CropSettings = _cropSettings;

                break;
            }
            }
            return(base.OnMessage(message));
        }
Ejemplo n.º 56
0
	public GUIControlEventArgs(GUIControl GUIControl)
	{
		this.GUIControl = GUIControl;
	}
Ejemplo n.º 57
0
 // Called whenever the keyboard has been pressed
 protected virtual void onKeyboardPress(GUIControl control, KeyboardState keyboard)
 {
     if(tick< tickMax)
         tick++;
     else
     {
         tick=	0;
         for(int i= 0; i< keyboard.keysPressed.Length; i++)
         {
             switch((KKL)(keyboard.keysPressed[i]))
             {
                 case KKL.RIGHT:	onKeyRight(keyboard);	break;
                 case KKL.LEFT:	onKeyLeft(keyboard);	break;
                 case KKL.BACKSPACE:	onBackspace();	break;
                 case KKL.DELETE:	onDelete();	break;
             }
             if(keyboard.keysPressed[i]>= 65 && keyboard.keysPressed[i]<= 90)
                 insertText(((char)(keyboard.keysPressed[i])).ToString());
         }
     }
 }
        protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
        {
            // wait for any background action to finish
            if (GUIBackgroundTask.Instance.IsBusy)
            {
                return;
            }

            switch (controlId)
            {
            // Facade
            case (50):
                if (actionType == Action.ActionType.ACTION_SELECT_ITEM)
                {
                    var item = Facade.SelectedListItem as GUIShowListItem;
                    if (item == null)
                    {
                        return;
                    }

                    if (!item.IsFolder)
                    {
                        if (TraktSettings.EnableJumpToForTVShows)
                        {
                            CheckAndPlayEpisode(true);
                        }
                        else
                        {
                            if (item.Show == null)
                            {
                                return;
                            }
                            GUIWindowManager.ActivateWindow((int)TraktGUIWindows.ShowSeasons, item.Show.ToJSON());
                        }
                    }
                    else
                    {
                        if (item.IsPrevPageItem)
                        {
                            CurrentPage--;
                        }
                        else
                        {
                            CurrentPage++;
                        }

                        if (CurrentPage == 1)
                        {
                            PreviousSelectedIndex = 0;
                        }
                        else
                        {
                            PreviousSelectedIndex = 1;
                        }

                        // load next / previous page
                        LoadTrendingShows(CurrentPage);
                    }
                }
                break;

            // Layout Button
            case (2):
                CurrentLayout = GUICommon.ShowLayoutMenu(CurrentLayout, PreviousSelectedIndex);
                break;

            // Sort Button
            case (8):
                var newSortBy = GUICommon.ShowSortMenu(TraktSettings.SortByTrendingShows);
                if (newSortBy != null)
                {
                    if (newSortBy.Field != TraktSettings.SortByTrendingShows.Field)
                    {
                        TraktSettings.SortByTrendingShows = newSortBy;
                        PreviousSelectedIndex             = CurrentPage == 1 ? 0 : 1;
                        UpdateButtonState();
                        LoadTrendingShows(CurrentPage);
                    }
                }
                break;

            // Hide Watched
            case (9):
                PreviousSelectedIndex = CurrentPage == 1 ? 0 : 1;
                TraktSettings.TrendingShowsHideWatched = !TraktSettings.TrendingShowsHideWatched;
                UpdateButtonState();
                LoadTrendingShows(CurrentPage);
                break;

            // Hide Watchlisted
            case (10):
                PreviousSelectedIndex = CurrentPage == 1 ? 0 : 1;
                TraktSettings.TrendingShowsHideWatchlisted = !TraktSettings.TrendingShowsHideWatchlisted;
                UpdateButtonState();
                LoadTrendingShows(CurrentPage);
                break;

            // Hide Collected
            case (11):
                PreviousSelectedIndex = CurrentPage == 1 ? 0 : 1;
                TraktSettings.TrendingShowsHideCollected = !TraktSettings.TrendingShowsHideCollected;
                UpdateButtonState();
                LoadTrendingShows(CurrentPage);
                break;

            // Hide Rated
            case (12):
                PreviousSelectedIndex = CurrentPage == 1 ? 0 : 1;
                TraktSettings.TrendingShowsHideRated = !TraktSettings.TrendingShowsHideRated;
                UpdateButtonState();
                LoadTrendingShows(CurrentPage);
                break;

            default:
                break;
            }
            base.OnClicked(controlId, control, actionType);
        }
        private void AddAlphaInterpolation(GUIControl control)
        {
            Interpolation i = new Interpolation();
            i.Time = TimeSpan.FromSeconds(2);
            i.elapsed = TimeSpan.Zero;
            i.from = control.BackgroundColor;
            i.to = Color.Orange * 0.6f;
            i.Compleate = false;

            this.interpolations.Add(i);
            i.UpdatedValue += x => control.BackgroundColor = x;

            Interpolation i1 = new Interpolation();
            i1.Time = TimeSpan.FromSeconds(2);
            i1.elapsed = TimeSpan.Zero;
            i1.from = Color.Orange * 0.6f;
            i1.to = control.BackgroundColor;
            i1.Compleate = false;

            this.interpolations.Add(i);
            i1.UpdatedValue += x => control.BackgroundColor = x;

            control.FocusLost += (s, e) =>
            {
                i.Compleate = true;
                this.interpolations.Add(i1);
            };
        }
        private void SendTrendingShowsToFacade(TraktShowsTrending trendingItems)
        {
            // clear facade
            GUIControl.ClearControl(GetID, Facade.GetID);

            if (trendingItems == null)
            {
                GUIUtils.ShowNotifyDialog(Translation.Error, Translation.ErrorGeneral);
                GUIWindowManager.ShowPreviousWindow();
                TrendingShowPages = null;
                return;
            }

            if (trendingItems.Shows.Count() == 0)
            {
                GUIUtils.ShowNotifyDialog(GUIUtils.PluginName(), Translation.NoTrendingShows);
                GUIWindowManager.ShowPreviousWindow();
                TrendingShowPages = null;
                return;
            }

            // filter shows
            var filteredTrendingList = GUICommon.FilterTrendingShows(trendingItems.Shows).Where(s => !string.IsNullOrEmpty(s.Show.Title)).ToList();

            // sort shows
            filteredTrendingList.Sort(new GUIListItemShowSorter(TraktSettings.SortByTrendingShows.Field, TraktSettings.SortByTrendingShows.Direction));

            int itemId     = 0;
            var showImages = new List <GUITmdbImage>();

            // Add Previous Page Button
            if (trendingItems.CurrentPage != 1)
            {
                var prevPageItem = new GUIShowListItem(Translation.PreviousPage, (int)TraktGUIWindows.TrendingShows);
                prevPageItem.IsPrevPageItem  = true;
                prevPageItem.IconImage       = "traktPreviousPage.png";
                prevPageItem.IconImageBig    = "traktPreviousPage.png";
                prevPageItem.ThumbnailImage  = "traktPreviousPage.png";
                prevPageItem.OnItemSelected += OnPreviousPageSelected;
                prevPageItem.IsFolder        = true;
                Facade.Add(prevPageItem);
                itemId++;
            }

            foreach (var trendingItem in filteredTrendingList)
            {
                var item = new GUIShowListItem(trendingItem.Show.Title, (int)TraktGUIWindows.TrendingShows);

                // add image for download
                var image = new GUITmdbImage {
                    ShowImages = new TmdbShowImages {
                        Id = trendingItem.Show.Ids.Tmdb
                    }
                };
                showImages.Add(image);

                item.Label2          = trendingItem.Show.Year.ToString();
                item.TVTag           = trendingItem;
                item.Show            = trendingItem.Show;
                item.Images          = image;
                item.ItemId          = Int32.MaxValue - itemId;
                item.IconImage       = GUIImageHandler.GetDefaultPoster(false);
                item.IconImageBig    = GUIImageHandler.GetDefaultPoster();
                item.ThumbnailImage  = GUIImageHandler.GetDefaultPoster();
                item.OnItemSelected += OnShowSelected;
                Utils.SetDefaultIcons(item);
                Facade.Add(item);
                itemId++;
            }

            // Add Next Page Button
            if (trendingItems.CurrentPage != trendingItems.TotalPages)
            {
                var nextPageItem = new GUIShowListItem(Translation.NextPage, (int)TraktGUIWindows.TrendingShows);
                nextPageItem.IsNextPageItem  = true;
                nextPageItem.IconImage       = "traktNextPage.png";
                nextPageItem.IconImageBig    = "traktNextPage.png";
                nextPageItem.ThumbnailImage  = "traktNextPage.png";
                nextPageItem.OnItemSelected += OnNextPageSelected;
                nextPageItem.IsFolder        = true;
                Facade.Add(nextPageItem);
                itemId++;
            }

            // Set Facade Layout
            Facade.CurrentLayout = CurrentLayout;
            GUIControl.FocusControl(GetID, Facade.GetID);

            Facade.SelectIndex(PreviousSelectedIndex);

            // set facade properties
            GUIUtils.SetProperty("#itemcount", filteredTrendingList.Count().ToString());
            GUIUtils.SetProperty("#Trakt.Items", string.Format("{0} {1}", filteredTrendingList.Count(), filteredTrendingList.Count() > 1 ? Translation.SeriesPlural : Translation.Series));

            GUIUtils.SetProperty("#Trakt.Trending.PeopleCount", trendingItems.TotalWatchers.ToString());
            GUIUtils.SetProperty("#Trakt.Trending.Description", string.Format(Translation.TrendingTVShowsPeople, trendingItems.TotalWatchers.ToString(), trendingItems.TotalItems.ToString()));

            // Page Properties
            GUIUtils.SetProperty("#Trakt.Facade.CurrentPage", trendingItems.CurrentPage.ToString());
            GUIUtils.SetProperty("#Trakt.Facade.TotalPages", trendingItems.TotalPages.ToString());
            GUIUtils.SetProperty("#Trakt.Facade.TotalItemsPerPage", TraktSettings.MaxTrendingShowsRequest.ToString());

            // Download show images Async and set to facade
            GUIShowListItem.GetImages(showImages);
        }