Esempio n. 1
0
        private void ZapTimerElapsed(object sender, EventArgs eventArgs)
        {
            // Zap to channel
            int number;

            if (!int.TryParse(ChannelNumberOrIndex, out number) || number < 1)
            {
                return;
            }

            IWorkflowManager  workflowManager = ServiceRegistration.Get <IWorkflowManager>();
            SlimTvClientModel model           = workflowManager.GetModel(SlimTvClientModel.MODEL_ID) as SlimTvClientModel;

            if (model == null)
            {
                return;
            }

            SlimTvClientSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <SlimTvClientSettings>();

            if (settings.ZapByChannelIndex)
            {
                // Channel index starts by 0, user enters 1 based numbers
                number--;
                _ = model.TuneByIndex(number);
            }
            else
            {
                _ = model.TuneByChannelNumber(number);
            }

            ClearZapTimer();
        }
        private void ZapTimerElapsed(object sender, EventArgs eventArgs)
        {
            // Zap to channel
            int number;

            if (!int.TryParse(ChannelNumberOrIndex, out number))
            {
                return;
            }

            ClearZapTimer();

#if DEBUG_FOCUS
            ServiceRegistration.Get <MediaPortal.Common.Logging.ILogger>().Debug("EPG: ChannelZapModel goto {0}", number);
#endif
            SlimTvClientSettings settings        = ServiceRegistration.Get <ISettingsManager>().Load <SlimTvClientSettings>();
            IWorkflowManager     workflowManager = ServiceRegistration.Get <IWorkflowManager>();
            if (workflowManager.CurrentNavigationContext.WorkflowModelId == SlimTvMultiChannelGuideModel.MODEL_ID)
            {
                SlimTvMultiChannelGuideModel guide = workflowManager.GetModel(SlimTvMultiChannelGuideModel.MODEL_ID) as SlimTvMultiChannelGuideModel;
                if (guide == null)
                {
                    return;
                }
                if (settings.ZapByChannelIndex)
                {
                    // Channel index starts by 0, user enters 1 based numbers
                    number--;
                    guide.GoToChannelIndex(number);
                }
                else
                {
                    guide.GoToChannelNumber(number);
                }
                return;
            }
            SlimTvClientModel model = workflowManager.GetModel(SlimTvClientModel.MODEL_ID) as SlimTvClientModel;
            if (model == null)
            {
                return;
            }

            // Special case "0", we use it for "zap back" to tune previous watched channel
            if (number == 0)
            {
                _ = model.ZapBack();
                return;
            }

            if (settings.ZapByChannelIndex)
            {
                // Channel index starts by 0, user enters 1 based numbers
                number--;
                _ = model.TuneByIndex(number);
            }
            else
            {
                _ = model.TuneByChannelNumber(number);
            }
        }