예제 #1
0
        public override bool Init()
        {
            _playlistPlayer           = PlayListPlayer.SingletonPlayer;
            g_Player.PlayBackEnded   += OnPlayBackEnded;
            g_Player.PlayBackChanged += OnPlayBackChanged;
            g_Player.PlayBackStopped += OnPlayBackStopped;
            var mdb         = MusicDatabase.Instance;
            var sessionKey  = mdb.GetLastFMSK();
            var currentUser = mdb.GetLastFMUser();
            var a           = new LastFMLibrary(sessionKey, currentUser); //TODO this is just making _SK get loaded.   No need to actual instansiate

            return(Load(GUIGraphicsContext.GetThemedSkinDirectory(@"\lastFmRadio.xml")));
        }
        public override void FinalizeConstruction()
        {
            base.FinalizeConstruction();
            ImgUpButtonNormal = LoadAnimationControl(WindowId, WindowId + 10000, UpBtnXOffset, UpBtnYOffset, UpBtnWidth,
                                                     UpBtnHeight, TextureMoveUpFileName);
            ImgUpButtonFocused = LoadAnimationControl(WindowId, WindowId + 10001, 0, 0, UpBtnWidth, UpBtnHeight,
                                                      TextureMoveUpFocusedFileName);
            ImgUpButtonNormal.ParentControl  = this;
            ImgUpButtonFocused.ParentControl = this;
            ImgUpButtonNormal.DimColor       = DimColor;
            ImgUpButtonFocused.DimColor      = DimColor;
            ImgUpButtonNormal.BringIntoView();
            ImgUpButtonFocused.BringIntoView();

            ImgDownButtonNormal = LoadAnimationControl(WindowId, WindowId + 10003, DownBtnXOffset, DownBtnYOffset,
                                                       DownBtnWidth, DownBtnHeight, TextureMoveDownFileName);
            ImgDownButtonFocused = LoadAnimationControl(WindowId, WindowId + 10004, 0, 0, DownBtnWidth, DownBtnHeight,
                                                        TextureMoveDownFocusedFileName);
            ImgDownButtonNormal.ParentControl  = this;
            ImgDownButtonFocused.ParentControl = this;
            ImgDownButtonNormal.DimColor       = DimColor;
            ImgDownButtonFocused.DimColor      = DimColor;
            ImgDownButtonNormal.BringIntoView();
            ImgDownButtonFocused.BringIntoView();

            ImgDeleteButtonNormal = LoadAnimationControl(WindowId, WindowId + 10006, DeleteBtnXOffset, DeleteBtnYOffset,
                                                         DeleteBtnWidth, DeleteBtnHeight, TextureDeleteFileName);
            ImgDeleteButtonFocused = LoadAnimationControl(WindowId, WindowId + 10007, 0, 0, DeleteBtnWidth, DeleteBtnHeight,
                                                          TextureDeleteFocusedFileName);
            ImgDeleteButtonNormal.ParentControl  = this;
            ImgDeleteButtonFocused.ParentControl = this;
            ImgDeleteButtonNormal.DimColor       = DimColor;
            ImgDeleteButtonFocused.DimColor      = DimColor;
            ImgDeleteButtonNormal.BringIntoView();
            ImgDeleteButtonFocused.BringIntoView();

            // Keep track of the original NavigateLeft and NavigateRight values...
            _NavigateLeft  = NavigateLeft;
            _NavigateRight = NavigateRight;

            string skinFolderPath = GUIGraphicsContext.GetThemedSkinDirectory(@"\media\");

            ImgUpButtonDisabled = GetDisabledButtonImage(skinFolderPath, TextureMoveUpFileName, WindowId, WindowId + 10002,
                                                         UpBtnXOffset, UpBtnYOffset, UpBtnWidth, UpBtnHeight);

            if (ImgUpButtonDisabled != null)
            {
                ImgDeleteButtonNormal.ParentControl = this;
                ImgUpButtonDisabled.BringIntoView();
            }

            ImgDownButtonDisabled = GetDisabledButtonImage(skinFolderPath, TextureMoveDownFileName, WindowId,
                                                           WindowId + 10005, DownBtnXOffset, DownBtnYOffset, DownBtnWidth,
                                                           DownBtnHeight);

            if (ImgDownButtonDisabled != null)
            {
                ImgDownButtonDisabled.ParentControl = this;
                ImgDownButtonDisabled.BringIntoView();
            }

            ImgDeleteButtonDisabled = GetDisabledButtonImage(skinFolderPath, TextureDeleteFileName, WindowId,
                                                             WindowId + 10008, DeleteBtnXOffset, DeleteBtnYOffset,
                                                             DeleteBtnWidth, DeleteBtnHeight);

            if (ImgDeleteButtonDisabled != null)
            {
                ImgDeleteButtonDisabled.ParentControl = this;
                ImgDeleteButtonDisabled.BringIntoView();
            }
        }
예제 #3
0
        public void LoadDirectory()
        {
            if (_directoryLoaded)
            {
                return;
            }

            // Unload any images from our texture bundle first
            _fileList.Clear();

            // Don't load any images if our path is empty
            if (_newPath.Length == 0)
            {
                return;
            }

            // Check to see if we have a single image or a folder of images
            if (MediaPortal.Util.Utils.IsPicture(_newPath))
            {
                _fileList.Add(_newPath);
            }
            else
            {
                // Folder of images
                try
                {
                    string imageFolder = string.Empty;
                    // Try to use the provided folder as an absolute path
                    if (Directory.Exists(_newPath) && Path.IsPathRooted(_newPath))
                    {
                        imageFolder = _newPath;
                    }

                    // If that didnt work, try to use relative pathing into the skin\Media folder
                    if (imageFolder.Trim().Length == 0)
                    {
                        //Log.Debug("GUIMultiImage - try relative pathing: " + GUIGraphicsContext.GetThemedSkinDirectory(@"\Media\animations\" + _newPath));
                        imageFolder = GUIGraphicsContext.GetThemedSkinDirectory(@"\Media\animations\" + _newPath);

                        // If the folder doesnt exist, we have an invalid field, exit
                        if (!Directory.Exists(imageFolder))
                        {
                            return;
                        }
                    }

                    // Load the image files
                    string[] files = Directory.GetFiles(imageFolder);
                    foreach (string file in files)
                    {
                        if (MediaPortal.Util.Utils.IsPicture(file))
                        {
                            _fileList.Add(file);
                        }
                    }
                }
                // If there was some other error accessing the folder, exit
                catch (UnauthorizedAccessException)
                {
                    return;
                }
                catch (IOException)
                {
                    return;
                }
            }

            // Randomize or sort our images if necessary
            if (_randomized && _fileList.Count > 1)
            {
                Random_Shuffle(ref _fileList);
            }

            // flag as loaded - no point in antly reloading them
            _directoryLoaded = true;

            foreach (string file in _fileList)
            {
                var pImage = new GUIImage(ParentID, GetID, _positionX, _positionY, _width, _height, file, 0)
                {
                    KeepAspectRatio = _keepAspectRatio
                };
                _imageList.Add(pImage);
            }

            // Load in the current image, and reset our timer
            _imageTimer.StartZero();
            _fadeTimer.Stop();
            _currentImage = 0;
            if (_imageList.Count == 0)
            {
                return;
            }
            //LoadImage(_currentImage);
            _isAllocated = true;
        }