Index: TvNotifyManager.cs =================================================================== --- TvNotifyManager.cs (revision 26803) +++ TvNotifyManager.cs (working copy) @@ -250,12 +250,38 @@ tvProg.EndTime = program.EndTime; _notifiesList.Remove(program); + +#if DEBUG + // new notification code - DEBUG only + + int _notifyTVTimeout = 10; + bool _playNotifyBeep = true; + using (Settings xmlreader = new MPSettings()) + { + _notifyTVTimeout = xmlreader.GetValueAsInt("mytv", "notifyTVTimeout", 10); + _playNotifyBeep = xmlreader.GetValueAsBool("mytv", "notifybeep", true); + } + + TvProgramNotifyDlg dialogNotify2 = new TvProgramNotifyDlg(); + // (Mediaportal.Dialogs.TvProgramNotifyDlg)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); + dialogNotify2.SetLine(1, tvProg.Title); + dialogNotify2.SetLine(2, "Switch to " + tvProg.Channel + " now?"); + dialogNotify2.TimeOut = _notifyTVTimeout; + if (_playNotifyBeep) + { + MediaPortal.Util.Utils.PlaySound("notify.wav", false, true); + } + dialogNotify2.DoModal(GUIWindowManager.ActiveWindow); + +#else Log.Info("send notify"); GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_NOTIFY_TV_PROGRAM, 0, 0, 0, 0, 0, null); msg.Object = tvProg; GUIGraphicsContext.SendMessage(msg); msg = null; Log.Info("send notify done"); + +#endif return; } } @@ -435,4 +461,45 @@ } } } -} \ No newline at end of file +} + + class TvProgramNotifyDlg : MediaPortal.Dialogs.GUIDialogYesNo + { + private int timeOutInSeconds = 0; + private DateTime timeStart = DateTime.Now; + + public TvProgramNotifyDlg() + { + } + + public int TimeOut + { + get { return timeOutInSeconds; } + set { timeOutInSeconds = value; } + } + + public override bool ProcessDoModal() + { + base.ProcessDoModal(); + TimeSpan timeElapsed = DateTime.Now - timeStart; + if (TimeOut > 0) + { + if (timeElapsed.TotalSeconds >= TimeOut) + { + GUIMessage msgConfirmYes = new GUIMessage(); + msgConfirmYes.Message = GUIMessage.MessageType.GUI_MSG_CLICKED; + msgConfirmYes.SenderControlId = base.btnYes.GetID; + base.OnMessage(msgConfirmYes); + // m_bConfirmed = m_DefaultYes; + return false; + } + } + return true; + } + + public override void DoModal(int dwParentId) + { + timeStart = DateTime.Now; + base.DoModal(dwParentId); + } + }