Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private bool NotifyChannelChange(TVProgramDescription tvProg)
- {
- // TvHome.cs @ 1885
- TVNotifyYesNoDialog tvNotifyDlg = (TVNotifyYesNoDialog)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_TVNOTIFYYESNO);
- TVProgramDescription notify = tvProg;
- if (tvNotifyDlg == null || notify == null)
- {
- return false;
- }
- int minUntilStart = _preNotifyConfig / 60;
- if (notify.StartTime > DateTime.Now)
- {
- if (minUntilStart > 1)
- {
- tvNotifyDlg.SetHeading(String.Format(GUILocalizeStrings.Get(1018), minUntilStart));
- }
- else
- {
- tvNotifyDlg.SetHeading(1019); // Program is about to begin
- }
- }
- else
- {
- tvNotifyDlg.SetHeading(String.Format(GUILocalizeStrings.Get(1206), (DateTime.Now - notify.StartTime).Minutes.ToString()));
- }
- tvNotifyDlg.SetHeading("Switch to " + tvProg.Channel.DisplayName);
- tvNotifyDlg.SetLine(1, notify.Title);
- tvNotifyDlg.SetLine(2, notify.Description);
- tvNotifyDlg.SetLine(4, String.Format(GUILocalizeStrings.Get(1207), notify.Channel.DisplayName));
- Channel c = notify.Channel;
- string strLogo = string.Empty;
- if (c.IsTv)
- {
- strLogo = MediaPortal.Util.Utils.GetCoverArt(Thumbs.TVChannel, c.DisplayName);
- }
- else if (c.IsRadio)
- {
- strLogo = MediaPortal.Util.Utils.GetCoverArt(Thumbs.Radio, c.DisplayName);
- }
- tvNotifyDlg.SetImage(strLogo);
- tvNotifyDlg.TimeOut = 30;
- //if (_playNotifyBeep)
- {
- MediaPortal.Util.Utils.PlaySound("notify.wav", false, true);
- }
- tvNotifyDlg.SetDefaultToYes(true);
- tvNotifyDlg.DoModal(GUIWindowManager.ActiveWindow);
- if (tvNotifyDlg.IsConfirmed)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- private void ProcessNotifies(DateTime preNotifySecs)
- {
- if (_notifiesListChanged)
- {
- LoadNotifies();
- _notifiesListChanged = false;
- }
- if (_notifiesList != null && _notifiesList.Count > 0)
- {
- foreach (Program program in _notifiesList)
- {
- // switching now, so switch at program start time
- //if (preNotifySecs > program.StartTime)
- if (System.DateTime.Now.AddSeconds(60) > program.StartTime)
- {
- Log.Info("Notify {0} on {1} start {2}", program.Title, program.ReferencedChannel().DisplayName,
- program.StartTime);
- program.Notify = false;
- program.Persist();
- TVProgramDescription tvProg = new TVProgramDescription();
- tvProg.Channel = program.ReferencedChannel();
- tvProg.Title = program.Title;
- tvProg.Description = program.Description;
- tvProg.Genre = program.Genre;
- tvProg.StartTime = program.StartTime;
- tvProg.EndTime = program.EndTime;
- _notifiesList.Remove(program);
- ////message = null;
- //MediaPortal.Util.Utils.PlaySound("notify.wav", false, true);
- //GUIDialogNotify dlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)TVHome.Window.WINDOW_DIALOG_NOTIFY);
- //dlgNotify.Reset();
- //dlgNotify.SetHeading("Changing Channel");
- //dlgNotify.SetText("Changing to: " + tvProg.Channel.DisplayName);
- //dlgNotify.TimeOut = 10;
- //dlgNotify.DoModal(GUIWindowManager.ActiveWindow);
- //Channel channel = tvProg.Channel;
- //if (channel.IsTv)
- //{
- // //MediaPortal.GUI.Library.GUIWindowManager.ActivateWindow((int)MediaPortal.GUI.Library.GUIWindow.Window.WINDOW_TV);
- // TVHome.ViewChannel(channel);
- // g_Player.ShowFullScreenWindow();
- //}
- //else if (channel.IsRadio)
- //{
- // MediaPortal.GUI.Library.GUIWindowManager.ActivateWindow((int)MediaPortal.GUI.Library.GUIWindow.Window.WINDOW_RADIO);
- // Radio.CurrentChannel = channel;
- // Radio.Play();
- //}
- if (NotifyChannelChange(tvProg))
- {
- Channel channel = tvProg.Channel;
- if (channel.IsTv)
- {
- MediaPortal.GUI.Library.GUIWindowManager.ActivateWindow((int)MediaPortal.GUI.Library.GUIWindow.Window.WINDOW_TVFULLSCREEN);
- if (g_Player.Paused)
- {
- TVHome.ViewChannel(channel);
- g_Player.ShowFullScreenWindow();
- int tickCount = 0;
- while (!g_Player.Paused)
- {
- Thread.Sleep(10);
- // if after 10 seconds and every second thereafter...
- if ((tickCount > 100) && ((tickCount % 100) == 0))
- {
- g_Player.Pause();
- // sleep to give the pause a chance to complete...
- Thread.Sleep(250);
- }
- tickCount++;
- }
- }
- else
- {
- TVHome.ViewChannel(channel);
- g_Player.ShowFullScreenWindow();
- }
- }
- else if (channel.IsRadio)
- {
- MediaPortal.GUI.Library.GUIWindowManager.ActivateWindow((int)MediaPortal.GUI.Library.GUIWindow.Window.WINDOW_RADIO);
- Radio.CurrentChannel = channel;
- Radio.Play();
- }
- }
- return;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement