Esempio n. 1
0
        /// <summary>
        /// A callback that gets called when the movie is selected
        /// </summary>
        /// <param name="sender">The sender is a MovieItem.</param>
        /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        //public override void ItemSelected(object sender, EventArgs args)
        //{
        //    OMLApplication.ExecuteSafe(delegate
        //    {
        //        MovieItem galleryItem = (MovieItem)sender;

        //        // Navigate to a details page for this item.
        //        MovieDetailsPage page = CreateDetailsPage(galleryItem);
        //        Gallery.JumpInListText.Value = "";
        //        Gallery.ClearJumpValue = true;
        //        OMLApplication.Current.GoToDetails(page);
        //    });
        //}

        /// <summary>
        /// Creates the details page for this movie
        /// </summary>
        /// <param name="item">The movie item.</param>
        /// <returns></returns>
        //public MovieDetailsPage CreateDetailsPage(MovieItem item)
        //{
        //    OMLApplication.DebugLine("[MovieItem] Creating a detailspage for {0}", item);
        //    return new MovieDetailsPage(item);
        //}

        private void IncrementPlayCount()
        {
            OMLApplication.ExecuteSafe(delegate
            {
                TitleCollectionManager.IncrementWatchedCount(this.TitleObject);
            });
        }
Esempio n. 2
0
 private void SaveTrailers()
 {
     OMLApplication.ExecuteSafe(delegate
     {
         OMLSettings.TrailersDefinition = _trailersDefinition.Chosen as string;
     });
 }
Esempio n. 3
0
        public Setup()
        {
            LoadPlugins();
            AllTitlesProcessed = false;
            CurrentTitle       = null;
            CurrentTitleIndex  = 0;
            current            = this;
            //_titleCollection.loadTitleCollection();
            _ImporterSelection = new Choice();
            List <string> _Importers = new List <string>();

            foreach (OMLPlugin _plugin in availablePlugins)
            {
                OMLApplication.DebugLine("[Setup] Adding " + _plugin.Name + " to the list of Importers");
                _Importers.Add(_plugin.Description);
            }

            _ImporterSelection.Options        = _Importers;
            _ImporterSelection.ChosenChanged += delegate(object sender, EventArgs e)
            {
                OMLApplication.ExecuteSafe(delegate
                {
                    Choice c            = (Choice)sender;
                    ImporterDescription = @"Notice: " + GetPlugin().SetupDescription();
                    OMLApplication.DebugLine("Item Chosed: " + c.Options[c.ChosenIndex]);
                });
            };
        }
Esempio n. 4
0
 private void SaveUILanguage()
 {
     OMLApplication.ExecuteSafe(delegate
     {
         OMLSettings.UILanguage = CultureIdFromDisplayName(_uiLanguage.Chosen as string);
     });
 }
Esempio n. 5
0
 private void SaveImpersonationSettings()
 {
     OMLApplication.ExecuteSafe(delegate
     {
         OMLSettings.ImpersonationUsername = _impersonationUsername.Value;
         OMLSettings.ImpersonationPassword = _impersonationPassword.Value;
     });
 }
Esempio n. 6
0
 public void PlayDiskWithOptions()
 {
     OMLApplication.ExecuteSafe(delegate
     {
         // Play the Selected Disk
         _movieDetails.PlayMovie();
         _playClicked = false; // I use the private variable because I don't want to send an event to the MCML page
     });
 }
Esempio n. 7
0
        private void SaveExternalPlayers()
        {
            OMLApplication.ExecuteSafe(delegate
            {
                List <string> mappings = new List <string>();

                try
                {
                    string chosenBluRayPlayer = _externalPlayerSelectionBluRay.Chosen as string;
                    ExternalPlayer.KnownPlayers bluRayPlayer = (ExternalPlayer.KnownPlayers)Enum.Parse(typeof(ExternalPlayer.KnownPlayers), chosenBluRayPlayer);

                    if (bluRayPlayer != ExternalPlayer.KnownPlayers.None)
                    {
                        if (!string.IsNullOrEmpty(_externalPlayerPathBluRay.Value) &&
                            _externalPlayerPathBluRay.Value.Trim().Length != 0)
                        {
                            mappings.Add(VideoFormat.BLURAY.ToString() + "|" + ((int)bluRayPlayer).ToString() + "|" + _externalPlayerPathBluRay.Value.Trim());
                        }
                    }

                    string chosenHDDVDPlayer = _externalPlayerSelectionHDDVD.Chosen as string;
                    ExternalPlayer.KnownPlayers hddvdPlayer = (ExternalPlayer.KnownPlayers)Enum.Parse(typeof(ExternalPlayer.KnownPlayers), chosenHDDVDPlayer);

                    if (hddvdPlayer != ExternalPlayer.KnownPlayers.None)
                    {
                        if (!string.IsNullOrEmpty(_externalPlayerPathHDDVD.Value) &&
                            _externalPlayerPathHDDVD.Value.Trim().Length != 0)
                        {
                            mappings.Add(VideoFormat.HDDVD.ToString() + "|" + ((int)hddvdPlayer).ToString() + "|" + _externalPlayerPathHDDVD.Value.Trim());
                        }
                    }

                    string chosenAllPlayer = _externalPlayerSelectionAll.Chosen as string;
                    ExternalPlayer.KnownPlayers allPlayer = (ExternalPlayer.KnownPlayers)Enum.Parse(typeof(ExternalPlayer.KnownPlayers), chosenAllPlayer);

                    if (allPlayer != ExternalPlayer.KnownPlayers.None)
                    {
                        if (!string.IsNullOrEmpty(_externalPlayerPathAll.Value) &&
                            _externalPlayerPathAll.Value.Trim().Length != 0)
                        {
                            mappings.Add(VideoFormat.ALL.ToString() + "|" + ((int)allPlayer).ToString() + "|" + _externalPlayerPathAll.Value.Trim());
                        }
                    }

                    OMLSettings.ExternalPlayerMapping = mappings;
                    ExternalPlayer.RefreshExternalPlayerList();
                }
                catch (Exception ex)
                {
                    Utilities.DebugLine("[Settings] Error saving external player settings", ex);
                }
            });
        }
Esempio n. 8
0
 public TreeNode(String title, String fullPath)
 {
     Title    = title;
     FullPath = fullPath;
     Checked.ChosenChanged += delegate(object sender, EventArgs e)
     {
         OMLApplication.ExecuteSafe(delegate
         {
             // this is the one that works
             OMLApplication.DebugLine("Changed: " + this.GetType().ToString());
             Setup.Current.AddCheckedNode(this);
         });
     };
 }
Esempio n. 9
0
        public void PlayAllDisks()
        {
            if (!((bool)_watched.Chosen))
            {
                _watched.Chosen = true;
            }

            OMLApplication.ExecuteSafe(delegate
            {
                // Play the Selected Disk
                PlayClicked = true;
                _movieDetails.PlayAllDisks();
                _playClicked = false; // I use the private variable because I don't want to send an event to the MCML page
            });
        }
Esempio n. 10
0
        public void UpdateWatched()
        {
            OMLApplication.ExecuteSafe(delegate
            {
                bool watched = (bool)_watched.Chosen;

                if (watched && _movieDetails.TitleObject.WatchedCount == 0)
                {
                    TitleCollectionManager.IncrementWatchedCount(_movieDetails.TitleObject);
                }
                else if (!watched && _movieDetails.TitleObject.WatchedCount != 0)
                {
                    TitleCollectionManager.ClearWatchedCount(_movieDetails.TitleObject);
                }
            });
        }
Esempio n. 11
0
        public void SaveSettings()
        {
            SaveMountingTools();
            SaveMovieSettings();
            SaveUILanguage();
            SaveTrailers();
            SaveFilterSettings();
            SaveTranscoding();
            SaveImpersonationSettings();
            SaveExternalPlayers();

            OMLApplication.ExecuteSafe(delegate
            {
                OMLApplication.Current.Startup(null);
            });
        }
Esempio n. 12
0
 void Transport_PropertyChanged(IPropertyObject sender, string property)
 {
     OMLApplication.ExecuteSafe(delegate
     {
         MediaTransport t = (MediaTransport)sender;
         Utilities.DebugLine("MoviePlayerTranscode.Transport_PropertyChanged: movie {0} property {1} playrate {2} state {3} pos {4}", OMLApplication.Current.NowPlayingMovieName, property, t.PlayRate, t.PlayState.ToString(), t.Position.ToString());
         if (property == "PlayState")
         {
             if (t.PlayState == PlayState.Finished || t.PlayState == PlayState.Stopped)
             {
                 transcoder.Stop(false);
                 Utilities.DebugLine("MoviePlayerTranscode.Transport_PropertyChanged: movie {0} Finished", OMLApplication.Current.NowPlayingMovieName);
                 OMLApplication.Current.NowPlayingStatus = PlayState.Finished;
             }
         }
     });
 }
Esempio n. 13
0
 private void SaveFilterSettings()
 {
     OMLApplication.ExecuteSafe(delegate
     {
         OMLSettings.ShowFilterUnwatched      = (bool)_showFilterUnwatched.Chosen;
         OMLSettings.ShowFilterActors         = (bool)_showFilterActors.Chosen;
         OMLSettings.ShowFilterCountry        = (bool)_showFilterCountry.Chosen;
         OMLSettings.ShowFilterDateAdded      = (bool)_showFilterDateAdded.Chosen;
         OMLSettings.ShowFilterDirectors      = (bool)_showFilterDirectors.Chosen;
         OMLSettings.ShowFilterFormat         = (bool)_showFilterFormat.Chosen;
         OMLSettings.ShowFilterGenres         = (bool)_showFilterGenres.Chosen;
         OMLSettings.ShowFilterParentalRating = (bool)_showFilterParentalRating.Chosen;
         OMLSettings.ShowFilterRuntime        = (bool)_showFilterRuntime.Chosen;
         OMLSettings.ShowFilterTags           = (bool)_showFilterTags.Chosen;
         OMLSettings.ShowFilterUserRating     = (bool)_showFilterUserRating.Chosen;
         OMLSettings.ShowFilterYear           = (bool)_showFilterYear.Chosen;
         OMLSettings.ShowFilterTrailers       = (bool)_showFilterTrailers.Chosen;
     });
 }
Esempio n. 14
0
        public void PlayDisk(int SelectedDisk)
        {
            // check the checkbox - this is to make it checked when the user clicks the back button
            // this will trigger the save to happen again but since we've already updated the count
            // the save will be a noop
            if (!((bool)_watched.Chosen))
            {
                _watched.Chosen = true;
            }

            OMLApplication.ExecuteSafe(delegate
            {
                // Play the Selected Disk
                PlayClicked = true;
                _movieDetails.TitleObject.SelectedDisk = _movieDetails.Disks[SelectedDisk];
                PlayMovieOrShowDVDContextMenu();
                _playClicked = false; // I use the private variable because I don't want to send an event to the MCML page
            });
        }
Esempio n. 15
0
        static public void Transport_PropertyChanged(IPropertyObject sender, string property)
        {
            OMLApplication.ExecuteSafe(delegate
            {
                MediaTransport t = (MediaTransport)sender;
                OMLApplication.DebugLine("[AppleTrailers] Transport_PropertyChanged: movie {0} property {1} playrate {2} state {3} pos {4}", OMLApplication.Current.NowPlayingMovieName, property, t.PlayRate, t.PlayState.ToString(), t.Position.ToString());
                if (property == "PlayState")
                {
                    OMLApplication.Current.NowPlayingStatus = t.PlayState;
                    OMLApplication.DebugLine("[AppleTrailers] MoviePlayerFactory.Transport_PropertyChanged: movie {0} state {1}", OMLApplication.Current.NowPlayingMovieName, t.PlayState.ToString());

                    if (t.PlayState == PlayState.Finished || t.PlayState == PlayState.Stopped)
                    {
                        OMLApplication.DebugLine("[AppleTrailers] Playstate is stopped, moving to previous page");
                        OMLApplication.Current.Session.BackPage();
                    }
                }
            });
        }
Esempio n. 16
0
        /// <summary>
        /// Handles the play or plause/pause button when click from the top level menu to immediately
        /// play disk 1.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void QuickPlayClicked(object sender, EventArgs e)
        {
            OMLApplication.ExecuteSafe(delegate
            {
                // quick play is only allowed if we're a movie item
                // this needs a cast here because in MCML movieitems are used
                // as gallery items
                MovieItem movie = this as MovieItem;

                // make sure we have a disk to quick play
                if (movie != null &&
                    movie.Disks != null &&
                    movie.Disks.Count > 0 &&
                    movie.TitleObject != null)
                {
                    // play the first disk
                    movie.TitleObject.SelectedDisk = movie.Disks[0];
                    movie.PlayMovie();
                }
            });
        }
Esempio n. 17
0
 private void SaveMovieSettings()
 {
     OMLApplication.ExecuteSafe(delegate
     {
         OMLSettings.MovieSort                     = _movieSort.Chosen as string;
         OMLSettings.StartPage                     = _startPage.Chosen as string;
         OMLSettings.StartPageSubFilter            = _startPageSubFilter.Chosen as string;
         OMLSettings.GalleryCoverArtRows           = System.Convert.ToInt32(_coverArtRows.Chosen as string);
         OMLSettings.CoverArtSpacingVertical       = System.Convert.ToInt32(_coverArtSpacing.Chosen as string);
         OMLSettings.CoverArtSpacingHorizontal     = System.Convert.ToInt32(_coverArtSpacing.Chosen as string);
         OMLSettings.MovieView                     = _movieView.Chosen as string;
         OMLSettings.DetailsView                   = _detailsView.Chosen as string;
         OMLSettings.ShowMovieDetails              = (bool)_showMovieDetails.Chosen;
         OMLSettings.DimUnselectedCovers           = (bool)_dimUnselectedCovers.Chosen;
         OMLSettings.UseOriginalCoverArt           = (bool)_useOriginalCoverArt.Chosen;
         OMLSettings.UseOnScreenAlphaJumper        = (bool)_useOnScreenAlpha.Chosen;
         OMLSettings.ShowWatchedIcon               = (bool)_showWatchedIcon.Chosen;
         OMLSettings.MainPageBackDropAlphaValue    = (float)_mainPageBackDropAlpha.Chosen;
         OMLSettings.MainPageBackDropIntervalValue = (int)_mainPageBackDropInterval.Chosen;
         OMLSettings.DetailsPageBackDropAlphaValue = (float)_detailsPageBackDropAlpha.Chosen;
     });
 }
Esempio n. 18
0
 private void SaveTranscoding()
 {
     OMLApplication.ExecuteSafe(delegate
     {
         OMLSettings.TranscodeAVIFiles        = (bool)_transcodeAVIFiles.Chosen;
         OMLSettings.TranscodeMKVFiles        = (bool)_transcodeMKVFiles.Chosen;
         OMLSettings.TranscodeOGMFiles        = (bool)_transcodeOGMFiles.Chosen;
         OMLSettings.PreserveAudioOnTranscode = (bool)_preserveAudioOnTranscode.Chosen;
         OMLSettings.DebugTranscoding         = (bool)_debugTranscoding.Chosen;
         OMLSettings.FlipFourCCCode           = (bool)_flipFourCCCode.Chosen;
         int transcodeBufferDelay             = 7;
         try
         {
             Int32.TryParse(_transcodeBufferDelay.Value, out transcodeBufferDelay);
         }
         catch { }
         if (transcodeBufferDelay != 7)
         {
             OMLSettings.TranscodeBufferDelay = transcodeBufferDelay;
         }
     });
 }
Esempio n. 19
0
        private void SaveMountingTools()
        {
            OMLApplication.ExecuteSafe(delegate
            {
                OMLSettings.MountingToolPath = _mountingToolPath.Value;


                try
                {
                    MountingTool.Tool tool;
                    string ChosenMountingSelection = _ImageMountingSelection.Chosen as string;
                    tool = (MountingTool.Tool)Enum.Parse(typeof(MountingTool.Tool), ChosenMountingSelection);
                    OMLSettings.MountingToolSelection = tool;
                }
                catch (Exception ex)
                {
                    Utilities.DebugLine("[Settings] Error saving Mounting selection: {0}", ex);
                }

                OMLSettings.VirtualDiscDrive = _virtualDrive.Chosen as string;
            });
        }
Esempio n. 20
0
        static public void Transport_PropertyChanged(IPropertyObject sender, string property)
        {
            OMLApplication.ExecuteSafe(delegate
            {
                MediaTransport t = (MediaTransport)sender;
                Utilities.DebugLine("[MoviePlayerFactory] Transport_PropertyChanged: movie {0} property {1} playrate {2} state {3} pos {4}", OMLApplication.Current.NowPlayingMovieName, property, t.PlayRate, t.PlayState.ToString(), t.Position.ToString());
                if (property == "PlayState")
                {
                    OMLApplication.Current.NowPlayingStatus = t.PlayState;
                    Utilities.DebugLine("[MoviePlayerFactory] MoviePlayerFactory.Transport_PropertyChanged: movie {0} state {1}", OMLApplication.Current.NowPlayingMovieName, t.PlayState.ToString());

                    //if (t.PlayState == PlayState.Finished || t.PlayState == PlayState.Stopped)
                    //{
                    //    if (AddInHost.Current.ApplicationContext.IsForegroundApplication && AddInHost.Current.MediaCenterEnvironment.MediaExperience.IsFullScreen)
                    //    {
                    //        AddInHost.Current.ApplicationContext.ReturnToApplication();
                    //        OMLApplication.DebugLine("[MoviePlayer] Playstate is stopped, moving to previous page");
                    //        //OMLApplication.Current.Session.BackPage();
                    //    }
                    //}
                }
            });
        }
Esempio n. 21
0
        void Transport_PropertyChanged(Microsoft.MediaCenter.UI.IPropertyObject sender, string property)
        {
            OMLApplication.ExecuteSafe(delegate
            {
                MediaTransport t = (MediaTransport)sender;
                Utilities.DebugLine("[MoviePlayerExtenderDVD] Transport_PropertyChanged: movie {0} property {1} playrate {2} state {3} pos {4}", OMLApplication.Current.NowPlayingMovieName, property, t.PlayRate, t.PlayState.ToString(), t.Position.ToString());
                if (property == "PlayState")
                {
                    switch (t.PlayState)
                    {
                    case PlayState.Finished:
                        Utilities.DebugLine("[MoviePlayerExtenderDVD] (Finished): clear resume time");
                        this._source.ClearResumeTime();
                        break;

                    case PlayState.Stopped:
                    case PlayState.Paused:
                        Utilities.DebugLine("[MoviePlayerExtenderDVD] ({0}): set resume time: {1}", t.PlayState, t.Position);
                        this._source.SetResumeTime(t.Position);
                        break;
                    }
                }
            });
        }
Esempio n. 22
0
        /// <summary>
        /// Launches the external player
        /// </summary>
        /// <returns></returns>
        public bool PlayMovie()
        {
            ExternalPlayerItem player = GetExternalForFormat(_videoFormat);

            string path = player.Path;

            // make sure the external player really cares about this
            if (string.IsNullOrEmpty(path))
            {
                return(false);
            }

            // validate the player exists
            if (!File.Exists(path))
            {
                return(false);
            }

            // setup the special rules per player type
            bool useMaximizer = false;

            switch (player.PlayerType)
            {
            case KnownPlayers.PowerDVD8:
                useMaximizer = true;

                if (_videoFormat == VideoFormat.DVD)
                {
                    _mediaPath = GetIfoPath(_mediaPath);
                }
                else if (_videoFormat == VideoFormat.BLURAY)
                {
                    _mediaPath = GetLargestM2TSPath(_mediaPath);
                }

                break;

            case KnownPlayers.TotalMediaTheater:
                useMaximizer = false;

                if (_videoFormat == VideoFormat.BLURAY &&
                    !File.Exists(Path.Combine(_mediaPath, "index.bdmv")) &&
                    File.Exists(Path.Combine(_mediaPath, "BDMV\\index.bdmv")))
                {
                    _mediaPath = Path.Combine(_mediaPath, "BDMV");
                }
                else if (_videoFormat == VideoFormat.HDDVD &&
                         Directory.Exists(_mediaPath) &&
                         !_mediaPath.EndsWith("\\"))
                {
                    _mediaPath += "\\";
                }
                break;

            case KnownPlayers.Other:
                useMaximizer = true;
                break;

            case KnownPlayers.WinDVD9:
                useMaximizer = true;
                break;
            }

            OMLApplication.ExecuteSafe(delegate
            {
                // if the maximizer app can be found use that
                string maximizerPath = Path.Combine(OMLEngine.FileSystemWalker.RootDirectory, "Maximizer.exe");

                if (useMaximizer && File.Exists(maximizerPath))
                {
                    OMLApplication.DebugLine("Calling Maximizer application \"" + path + "\" \"" + _mediaPath + "\"");
                    Process process                  = new Process();
                    process.StartInfo.FileName       = maximizerPath;
                    process.StartInfo.Arguments      = string.Format("\"{0}\" \"{1}\"", path, _mediaPath);
                    process.StartInfo.CreateNoWindow = true;
                    process.StartInfo.WindowStyle    = ProcessWindowStyle.Hidden;
                    process.Start();
                }
                else
                {
                    OMLApplication.DebugLine("Calling external application \"" + path + "\" \"" + _mediaPath + "\"");
                    Process process             = new Process();
                    process.StartInfo.FileName  = path;
                    process.StartInfo.Arguments = "\"" + _mediaPath + "\"";
                    process.Start();
                }
            });

            return(true);
        }