示例#1
0
        private void CheckFirstRun(AddInHost host)
        {
            if (Properties.Settings.Default.ShowFirstRunPrompt == true)
            {
                List <string> buttons = new List <string>();
                buttons.Add("Configure OML");
                buttons.Add("No Thanks");
                Microsoft.MediaCenter.MediaCenterEnvironment env = host.MediaCenterEnvironment;
                string dialogText = "Would you like to configure Open Media Library now? To run this wizard later you can access OML from the program library.";
                Microsoft.MediaCenter.DialogResult res = env.Dialog(dialogText, "OPEN MEDIA LIBRARY", buttons, -1, true, null, delegate(Microsoft.MediaCenter.DialogResult dialogResult) { });
                if ((int)res == 100)
                {
                    //tmp until firstrun page
                    Properties.Settings.Default.ShowFirstRunPrompt = false;
                    Properties.Settings.Default.Save();

                    //run setup
                    s_session = new Library.Code.V3.HistoryOrientedPageSessionEx();
                    GoToLoader();
                    Microsoft.MediaCenter.UI.Application.DeferredInvoke(new Microsoft.MediaCenter.UI.DeferredHandler(this.BeginStart), (object)host, new TimeSpan(1));
                }
                else
                {
                    Properties.Settings.Default.ShowFirstRunPrompt = false;
                    Properties.Settings.Default.Save();
                    //env.Dialog("You can access OML from the program library.", "OPEN MEDIA LIBRARY", Microsoft.MediaCenter.DialogButtons.Ok, -1, true);
                }
            }
        }
示例#2
0
 public void Play(PlaybackStatus playstate, bool resume)
 {
     this.PlayState = playstate;
     this.Prepare(resume);
     if (this is PlayableCollection && (this.PlayableItems == null || this.PlayableItems.Count() < 1))
     {
         Microsoft.MediaCenter.MediaCenterEnvironment ev = Microsoft.MediaCenter.Hosting.AddInHost.Current.MediaCenterEnvironment;
         ev.Dialog(Application.CurrentInstance.StringData("NoContentDial"), Application.CurrentInstance.StringData("Playstr"), Microsoft.MediaCenter.DialogButtons.Ok, 500, true);
     }
     else
     {
         PlayInternal(resume);
     }
 }
示例#3
0
        internal void Play()
        {
            if (Microsoft.MediaCenter.UI.Application.ApplicationThread != System.Threading.Thread.CurrentThread)
            {
                Application.UIDeferredInvokeIfRequired(() => Play());
                return;
            }
            System.Diagnostics.Debug.Assert(Microsoft.MediaCenter.UI.Application.ApplicationThread == Thread.CurrentThread);
            Prepare();

            if (!MediaItems.Any() && !Files.Any())
            {
                Microsoft.MediaCenter.MediaCenterEnvironment ev = Application.MediaCenterEnvironment;
                ev.Dialog(Application.CurrentInstance.StringData("NoContentDial"), Application.CurrentInstance.StringData("Playstr"), Microsoft.MediaCenter.DialogButtons.Ok, 500, true);
                return;
            }
            if (CurrentMedia != null)
            {
                Logger.ReportInfo(string.Format("{0} about to play {1}({2}) ", PlaybackController.ControllerName, DisplayName, CurrentMedia.Files.FirstOrDefault()));
            }

            // If the controller already has active playable items, stop it and wait for it to flush out
            if (!QueueItem)
            {
                PlaybackController.StopAndWait();
            }

            // Run all pre-play processes
            RunPrePlayProcesses();

            if (!QueueItem && StopAllPlaybackBeforePlaying)
            {
                StopAllApplicationPlayback();
            }

            if (UseAutoPlay)
            {
                Logger.ReportVerbose("Playing with autoplay. Marking watched since we have no way of getting status on this.");

                MarkWatchedIfNeeded();
            }
            else
            {
                //AdjustRefreshRate();
                PlaybackController.Play(this);
            }
        }
示例#4
0
        internal void Play()
        {
            Prepare();

            if (!HasMediaItems && !Files.Any())
            {
                Microsoft.MediaCenter.MediaCenterEnvironment ev = Microsoft.MediaCenter.Hosting.AddInHost.Current.MediaCenterEnvironment;
                ev.Dialog(Application.CurrentInstance.StringData("NoContentDial"), Application.CurrentInstance.StringData("Playstr"), Microsoft.MediaCenter.DialogButtons.Ok, 500, true);
                return;
            }

            Logger.ReportInfo(PlaybackController.ControllerName + " about to play " + DisplayName);

            // If the controller already has active playable items, stop it and wait for it to flush out
            if (!QueueItem)
            {
                PlaybackController.StopAndWait();
            }

            // Run all pre-play processes
            RunPrePlayProcesses();

            if (!QueueItem && StopAllPlaybackBeforePlaying)
            {
                StopAllApplicationPlayback();
            }

            if (UseAutoPlay)
            {
                Logger.ReportVerbose("Playing with autoplay. Marking watched since we have no way of getting status on this.");

                MarkWatchedIfNeeded();
            }
            else
            {
                PlaybackController.Play(this);
            }
        }
        internal void Play()
        {
            Prepare();

            if (!MediaItems.Any() && !Files.Any())
            {
                Microsoft.MediaCenter.MediaCenterEnvironment ev = Microsoft.MediaCenter.Hosting.AddInHost.Current.MediaCenterEnvironment;
                ev.Dialog(Application.CurrentInstance.StringData("NoContentDial"), Application.CurrentInstance.StringData("Playstr"), Microsoft.MediaCenter.DialogButtons.Ok, 500, true);
                return;
            }
            if (CurrentMedia != null)
            {
                Logger.ReportInfo(string.Format("{0} about to play {1}({2}) ", PlaybackController.ControllerName, DisplayName, CurrentMedia.Files.FirstOrDefault()));
            }

            // If the controller already has active playable items, stop it and wait for it to flush out
            if (!QueueItem)
            {
                PlaybackController.StopAndWait();
            }

            // Run all pre-play processes
            RunPrePlayProcesses();

            if (!QueueItem && StopAllPlaybackBeforePlaying)
            {
                StopAllApplicationPlayback();
            }

            // Play Intros if specified
            if (PlayIntros && HasMediaItems)
            {
                var item = MediaItems.First();
                if (item is Movie && (item.DisplayMediaType == null || !item.DisplayMediaType.Equals("trailer", StringComparison.OrdinalIgnoreCase)))
                {
                    // Get intros for this item
                    var introItems = Kernel.Instance.MB3ApiRepository.RetrieveIntros(MediaItems.First().ApiId).OfType <Video>().ToList();
                    var intros     = introItems.Select(i => i.Files.FirstOrDefault()).ToList();

                    // Kick off our intro playback controller
                    if (intros.Any())
                    {
                        Application.CurrentInstance.IntroController.Init(intros);
                        Application.CurrentInstance.IntroController.Play();
                        //mark them watched
                        Async.Queue("Mark watched", () => { foreach (var i in introItems)
                                                            {
                                                                Kernel.ApiClient.UpdatePlayedStatus(i.ApiId, Kernel.CurrentUser.Id, true);
                                                            }
                                    });
                    }
                }
            }

            if (UseAutoPlay)
            {
                Logger.ReportVerbose("Playing with autoplay. Marking watched since we have no way of getting status on this.");

                MarkWatchedIfNeeded();
            }
            else
            {
                PlaybackController.Play(this);
            }
        }