/* * /// <summary> * /// On close * /// </summary> * private void Close() * { * GUIWindowManager.IsSwitchingToNewWindow = true; * lock (this) * { * GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT, GetID, 0, 0, 0, 0, null); * OnMessage(msg); * * GUIWindowManager.UnRoute(); * _running = false; * _parentWindow = null; * } * GUIWindowManager.IsSwitchingToNewWindow = false; * GUILayerManager.UnRegisterLayer(this); * } */ /// <summary> /// On Message /// </summary> /// <param name="message"></param> /// <returns></returns> public override bool OnMessage(GUIMessage message) { switch (message.Message) { case GUIMessage.MessageType.GUI_MSG_CLICKED: { if (message.SenderControlId == 35 || message.SenderControlId == 37) // listbox { if ((int)Action.ActionType.ACTION_SELECT_ITEM == message.Param1) { // switching logic SelectedChannel = (Channel)lstChannels.SelectedListItem.TVTag; Channel changeChannel = null; if (AutoZap) { if (TVHome.Navigator.Channel.IdChannel != SelectedChannel.IdChannel || !g_Player.IsTimeShifting || g_Player.IsTVRecording) { List <Channel> tvChannelList = GetChannelListByGroup(); if (tvChannelList != null) { changeChannel = (Channel)tvChannelList[lstChannels.SelectedListItemIndex]; } } } _canceled = false; PageDestroy(); //This one shows the zapOSD when changing channel from mini GUIDE, this is currently unwanted. /* * TvFullScreen TVWindow = (TvFullScreen)GUIWindowManager.GetWindow((int)(int)GUIWindow.Window.WINDOW_TVFULLSCREEN); * if (TVWindow != null) TVWindow.UpdateOSD(changeChannel.Name); */ TVHome.UserChannelChanged = true; if (changeChannel != null) { TVHome.ViewChannel(changeChannel); } } } else if (message.SenderControlId == 36) // spincontrol { // switch group OnGroupChanged(); } else if (message.SenderControlId == 34) // exit button { // exit _canceled = true; PageDestroy(); } break; } } return(base.OnMessage(message)); }
/// <summary> /// Checks if it is time to zap to a different channel. This is called during Process(). /// </summary> public bool CheckChannelChange() { if (reentrant) { return(false); } try { reentrant = true; // Zapping to another group or channel? if (m_zapgroup != -1 || m_zapchannel != null) { // Time to zap? if (DateTime.Now >= m_zaptime) { // Zapping to another group? if (m_zapgroup != -1 && m_zapgroup != m_currentgroup) { // Change current group and zap to the first channel of the group m_currentgroup = m_zapgroup; if (CurrentGroup != null && CurrentGroup.ReferringGroupMap().Count > 0) { GroupMap gm = (GroupMap)CurrentGroup.ReferringGroupMap()[0]; Channel chan = (Channel)gm.ReferencedChannel(); m_zapchannel = chan; } } m_zapgroup = -1; //if (m_zapchannel != m_currentchannel) // lastViewedChannel = m_currentchannel; // Zap to desired channel if (m_zapchannel != null) // might be NULL after tuning failed { Channel zappingTo = m_zapchannel; //remember to apply the new group also. if (m_zapchannel.CurrentGroup != null) { m_currentgroup = GetGroupIndex(m_zapchannel.CurrentGroup.GroupName); Log.Info("Channel change:{0} on group {1}", zappingTo.DisplayName, m_zapchannel.CurrentGroup.GroupName); } else { Log.Info("Channel change:{0}", zappingTo.DisplayName); } m_zapchannel = null; TVHome.ViewChannel(zappingTo); } m_zapChannelNr = -1; reentrant = false; return(true); } } } finally { reentrant = false; } return(false); }
private void OnClick(int iItem) { m_iSelectedItem = GetSelectedItemNo(); GUIListItem item = GetItem(iItem); if (item == null) { return; } Schedule rec = (Schedule)item.TVTag; GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(rec.ProgramName); if (rec.Series == false) { dlg.AddLocalizedString(618); //delete } else { dlg.AddLocalizedString(981); //Delete this recording dlg.AddLocalizedString(982); //Delete series recording dlg.AddLocalizedString(888); //Episodes management } VirtualCard card; TvServer server = new TvServer(); if (server.IsRecordingSchedule(rec.IdSchedule, out card)) { dlg.AddLocalizedString(979); //Play recording from beginning dlg.AddLocalizedString(980); //Play recording from live point } else { IList <TuningDetail> details = Channel.Retrieve(rec.IdChannel).ReferringTuningDetail(); foreach (TuningDetail detail in details) { if (detail.ChannelType == 0) { dlg.AddLocalizedString(882); //Quality settings break; } } } dlg.DoModal(GetID); if (dlg.SelectedLabel == -1) { return; } switch (dlg.SelectedId) { case 888: ////Episodes management OnSetEpisodesToKeep(rec); break; case 882: OnSetQuality(rec); break; case 981: //Delete this recording only { if (server.IsRecordingSchedule(rec.IdSchedule, out card)) { GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO); if (null != dlgYesNo) { dlgYesNo.SetHeading(GUILocalizeStrings.Get(653)); //Delete this recording? dlgYesNo.SetLine(1, GUILocalizeStrings.Get(730)); //This schedule is recording. If you delete dlgYesNo.SetLine(2, GUILocalizeStrings.Get(731)); //the schedule then the recording is stopped. dlgYesNo.SetLine(3, GUILocalizeStrings.Get(732)); //are you sure dlgYesNo.DoModal(GUIWindowManager.ActiveWindow); if (dlgYesNo.IsConfirmed) { server.StopRecordingSchedule(rec.IdSchedule); CanceledSchedule schedule = new CanceledSchedule(rec.IdSchedule, rec.IdChannel, rec.StartTime); rec.Persist(); server.OnNewSchedule(); } } } else { server.StopRecordingSchedule(rec.IdSchedule); CanceledSchedule schedule = new CanceledSchedule(rec.IdSchedule, rec.IdChannel, rec.StartTime); rec.Persist(); server.OnNewSchedule(); } LoadDirectory(); } break; case 982: //Delete series recording goto case 618; case 618: // delete entire recording { if (server.IsRecordingSchedule(rec.IdSchedule, out card)) { GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO); if (null != dlgYesNo) { dlgYesNo.SetHeading(GUILocalizeStrings.Get(653)); //Delete this recording? dlgYesNo.SetLine(1, GUILocalizeStrings.Get(730)); //This schedule is recording. If you delete dlgYesNo.SetLine(2, GUILocalizeStrings.Get(731)); //the schedule then the recording is stopped. dlgYesNo.SetLine(3, GUILocalizeStrings.Get(732)); //are you sure dlgYesNo.DoModal(GUIWindowManager.ActiveWindow); if (dlgYesNo.IsConfirmed) { server.StopRecordingSchedule(rec.IdSchedule); rec.Delete(); server.OnNewSchedule(); } } } else { rec.Delete(); server.OnNewSchedule(); } LoadDirectory(); } break; case 979: // Play recording from beginning if (g_Player.Playing && g_Player.IsTVRecording) { g_Player.Stop(true); } //TVHome.IsTVOn = true; TVHome.ViewChannel(rec.ReferencedChannel()); g_Player.SeekAbsolute(0); if (TVHome.Card.IsTimeShifting) { g_Player.ShowFullScreenWindow(); return; } break; case 980: // Play recording from live point //TVHome.IsTVOn = true; TVHome.ViewChannel(rec.ReferencedChannel()); if (TVHome.Card.IsTimeShifting) { if (g_Player.Playing) { g_Player.SeekAsolutePercentage(99); } g_Player.ShowFullScreenWindow(); return; } break; } while (m_iSelectedItem >= GetItemCount() && m_iSelectedItem > 0) { m_iSelectedItem--; } GUIControl.SelectItemControl(GetID, listPriorities.GetID, m_iSelectedItem); }