Example #1
0
        private void ChannelTuneFailedNotifyUser(LiveStreamResult result, Channel channel)
        {
            string TuningResult = string.Empty;

            switch (result)
            {
            case LiveStreamResult.ChannelTuneFailed:
                TuningResult = (Utility.GetLocalizedText(TextId.ChannelTuneFailed));
                break;

            case LiveStreamResult.NoFreeCardFound:
                TuningResult = (Utility.GetLocalizedText(TextId.NoFreeCardFound));
                break;

            case LiveStreamResult.NotSupported:
                TuningResult = (Utility.GetLocalizedText(TextId.NotSupported));
                break;

            case LiveStreamResult.NoRetunePossible:
                TuningResult = (Utility.GetLocalizedText(TextId.NoRetunePossible));
                break;

            case LiveStreamResult.IsScrambled:
                TuningResult = (Utility.GetLocalizedText(TextId.IsScrambled));
                break;

            case LiveStreamResult.UnknownError:
                TuningResult = (Utility.GetLocalizedText(TextId.UnknownError));
                break;
            }

            if (GUIWindowManager.ActiveWindow == (int)(int)GUIWindow.Window.WINDOW_TVFULLSCREEN)
            {
                // If failed and wasPlaying TV, left screen as it is and show zaposd with error message
                GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_TV_ERROR_NOTIFY, GUIWindowManager.ActiveWindow, 0,
                                                0, 0, 0,
                                                null);

                msg.SendToTargetWindow = true;
                msg.Object             = TuningResult; // forward error info object
                msg.TargetWindowId     = (int)(int)GUIWindow.Window.WINDOW_TVFULLSCREEN;
                GUIGraphicsContext.SendMessage(msg);
            }
            else
            {
                // if not fulscreen, show notify dialog with the error message
                string caption = string.Empty;
                string tvlogo  = string.Empty;
                if (channel != null)
                {
                    _navigatorChannels[_currentChannel.ChannelType].PreviousChannel = channel;
                    _currentChannel = null;

                    tvlogo = Utility.GetLogoImage(channel);

                    if (channel.ChannelType == ChannelType.Television)
                    {
                        caption = GUILocalizeStrings.Get(605) + " - " + channel.DisplayName;
                    }
                    else
                    {
                        caption = GUILocalizeStrings.Get(665) + " - " + channel.DisplayName;
                    }
                }

                GUIDialogNotify pDlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY);
                if (pDlgNotify != null)
                {
                    pDlgNotify.Reset();
                    pDlgNotify.ClearAll();
                    pDlgNotify.SetHeading(caption);
                    if (!string.IsNullOrEmpty(TuningResult))
                    {
                        pDlgNotify.SetText(TuningResult);
                    }
                    pDlgNotify.SetImage(tvlogo);
                    pDlgNotify.TimeOut = 5;
                    pDlgNotify.DoModal(GUIWindowManager.ActiveWindow);
                }
            }
        }