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");
            }
        }
 public static void PlayMovie(DBMovieInfo movie)
 {
     if (player == null) player = new MoviePlayer(new MovingPicturesGUI());
     player.Play(movie);
 }
示例#3
0
        /// <summary>
        /// Start playing a movie on a seperate thread
        /// </summary>
        /// <param name="movie">Movie to play</param>
        /// <param name="resume">Ask user to resume?</param>
        private static void DoPlayMovie(DBMovieInfo movie, bool resume, int startPosition)
        {
            if (GUIGraphicsContext.form.InvokeRequired)
            {
                PlayMovieAsyncDelegate d = new PlayMovieAsyncDelegate(DoPlayMovie);
                GUIGraphicsContext.form.Invoke(d, new object[] { movie, resume, startPosition });
                return;
            }
            WifiRemote.LogMessage("Play movie (resume: " + resume + ", pos: " + startPosition, WifiRemote.LogType.Debug);

            // Clear resume
            if (!resume && movie.UserSettings != null && movie.UserSettings.Count > 0)
            {
                DBUserMovieSettings userSetting = movie.ActiveUserSettings;
                userSetting.ResumePart = 0;
                userSetting.ResumeTime = 0;
                userSetting.ResumeData = null;
                userSetting.Commit();
            }

            if (player == null) player = new MoviePlayer(new MovingPicturesGUI());
            player.Play(movie);

            if (!resume && startPosition > 0)
            {
                g_Player.SeekAbsolute(startPosition);
            }
        }