This class takes two GUIImage objects so that you can treat them as one. When you assign a new image to this object using the Filename property, the currently active image is hidden and the second is made visibile (with the new image file displayed). This allows for animations on image change, such as a fading transition. This class also uses the AsyncImageResource class for asynchronus image loading, dramtically improving GUI performance. It also takes advantage of the Delay feature of the AsyncImageResource to prevent unnecessary loads when rapid image changes are made.
Example #1
0
        public TVSeriesPlugin()
        {
            m_stepSelections.Add(new string[] { null });
            // disable that dynamic skin adjustment....skinners should have the power to position the elements whereever with the plugin inerveining
            if (DBOption.GetOptions(DBOption.cViewAutoHeight)) DBOption.SetOptions(DBOption.cViewAutoHeight, false);

            int artworkDelay = DBOption.GetOptions(DBOption.cArtworkLoadingDelay);
            int backdropDelay = DBOption.GetOptions(DBOption.cBackdropLoadingDelay);

            backdrop = new ImageSwapper();
            backdrop.ImageResource.Delay = backdropDelay;
            backdrop.PropertyOne = "#TVSeries.Fanart.1";
            backdrop.PropertyTwo = "#TVSeries.Fanart.2";

            seriesbanner = new AsyncImageResource();
            seriesbanner.Property = "#TVSeries.SeriesBanner";
            seriesbanner.Delay = artworkDelay;

            seriesposter = new AsyncImageResource();
            seriesposter.Property = "#TVSeries.SeriesPoster";
            seriesposter.Delay = artworkDelay;

            seasonbanner = new AsyncImageResource();
            seasonbanner.Property = "#TVSeries.SeasonPoster";
            seasonbanner.Delay = artworkDelay;

            MPTVSeriesLog.Write(string.Format("MP-TVSeries Version: v{0}", Settings.Version.ToString()));
            MPTVSeriesLog.Write("MP-TVSeries Build Date: " + Settings.BuildDate);
        }
        public override bool Init()
        {
            logger.Debug("Initializing Importer Screen");

            // create backdrop image swapper
            backdrop = new ImageSwapper();
            backdrop.ImageResource.Delay = MovingPicturesCore.Settings.ArtworkLoadingDelay;
            backdrop.PropertyOne = "#MovingPictures.Importer.Backdrop1";
            backdrop.PropertyTwo = "#MovingPictures.Importer.Backdrop2";

            return Load(GUIGraphicsContext.Skin + @"\movingpictures.importer.xml");
        }
        private void onCoreInitializationProgress(string actionName, int percentDone)
        {
            // Update the progress variables
            if (percentDone == 100) {
                actionName = "Loading GUI ...";
            }
            initProgressLastAction = actionName;
            initProgressLastPercent = percentDone;

            // If the progress dialog exists, update it.
            if (initDialog != null) {
                initDialog.SetLine(2, initProgressLastAction);
                initDialog.SetPercentage(initProgressLastPercent);
                initDialog.Progress();
            }

            // When we are finished initializing
            if (percentDone == 100) {

                // Start the background importer
                if (MovingPicturesCore.Settings.EnableImporterInGUI) {
                    MovingPicturesCore.Importer.Start();
                    MovingPicturesCore.Importer.Progress += new MovieImporter.ImportProgressHandler(Importer_Progress);
                }

                // Load skin based settings from skin file
                skinSettings = new MovingPicturesSkinSettings(_windowXmlFileName);

                // Get Moving Pictures specific autoplay setting
                try {
                    diskInsertedAction = (DiskInsertedAction)Enum.Parse(typeof(DiskInsertedAction), MovingPicturesCore.Settings.DiskInsertionBehavior);
                }
                catch {
                    diskInsertedAction = DiskInsertedAction.DETAILS;
                }

                // setup the image resources for cover and backdrop display
                int artworkDelay = MovingPicturesCore.Settings.ArtworkLoadingDelay;

                // setup the time for the random category backdrop refresh
                activeMovieLookup.Timeout = new TimeSpan(0, 0, MovingPicturesCore.Settings.CategoryRandomArtworkRefreshInterval);

                // create backdrop image swapper
                backdrop = new ImageSwapper();
                backdrop.ImageResource.Delay = artworkDelay;
                backdrop.PropertyOne = "#MovingPictures.Backdrop";
                backdrop.PropertyTwo = "#MovingPictures.Backdrop2";

                // create cover image swapper
                cover = new AsyncImageResource();
                cover.Property = "#MovingPictures.Coverart";
                cover.Delay = artworkDelay;

                // instantiate player
                moviePlayer = new MoviePlayer(this);
                moviePlayer.MovieEnded += new MoviePlayerEvent(onMovieEnded);
                moviePlayer.MovieStopped += new MoviePlayerEvent(onMovieStopped);

                // Listen to the DeviceManager for external media activity (i.e. disks inserted)
                logger.Debug("Listening for device changes.");
                DeviceManager.OnVolumeInserted += new DeviceManager.DeviceManagerEvent(OnVolumeInserted);
                DeviceManager.OnVolumeRemoved += new DeviceManager.DeviceManagerEvent(OnVolumeRemoved);

                // Flag that the GUI is initialized
                initComplete = true;

                // If the initDialog is present close it
                if (initDialog != null) {
                    initDialog.Close();
                }

                // Report that we completed the init
                logger.Info("GUI Initialization Complete");
            }
        }
Example #4
0
        void doLoad()
        {
            MP1Options options = MP1Utils.Options;
            options.EnterReadLock();
            if (firstLoad)
            {
                firstLoad = false;

                GUIPropertyManager.SetProperty("#Emulators2.PreviewVideo.playing", "no");
                //Image Handlers
                backdrop = new ImageSwapper();
                backdrop.ImageResource.Delay = options.FanartDelay;
                backdrop.PropertyOne = "#Emulators2.CurrentItem.fanartpath";
                backdrop.PropertyTwo = "#Emulators2.CurrentItem.fanartpath2";

                guiHandler = new GUIPresenter();
                guiHandler.OnSortAscendingChanged += new GUIPresenter.SortAscendingChanged(newGUIHandler_OnSortAscendingChanged);
                guiHandler.OnPreviewVideoStatusChanged += new GUIPresenter.PreviewVideoStatusChanged(newGUIHandler_OnPreviewVideoStatusChanged);
                GUIPropertyManager.SetProperty("#Emulators2.plugintitle", options.PluginDisplayName);

                onVideoStopped = new g_Player.StoppedHandler(g_Player_PlayBackStopped);
                onVideoEnded = new g_Player.EndedHandler(g_Player_PlayBackEnded);
            }
            
            DBItem startupItem = null;
            bool launch = false;
            getStartupSettings(ref startupItem, ref launch);

            if (buttonSort != null)
            {
                buttonSort.IsAscending = guiHandler.SortAscending;
                buttonSort.SortChanged += new SortEventHandler(guiHandler.OnSort);
            }

            if (options.ShowFanart)
            {
                backdrop.GUIImageOne = fanartControl1;
                backdrop.GUIImageTwo = fanartControl2;
            }

            if (gameArtEnabled != null)
                gameArtEnabled.Visible = options.ShowVideoPreview; //update gameart dummy control visibility

            if (options.ShowVideoPreview)
            {
                if (videoPreviewEnabled != null)
                    videoPreviewEnabled.Visible = true; //videoPreview dummy
            }

            options.ExitReadLock();

            g_Player.PlayBackStopped += onVideoStopped;
            g_Player.PlayBackEnded += onVideoEnded;

            guiHandler.Load(facade, backdrop, startupItem, launch, showVideoPreviewControl, goodmergeList, details_play);
        }