Ejemplo n.º 1
0
        /// <summary>This is used to check for keyboard channel input</summary>
        private void TimerKeyboardEntry()
        {
            if (_numberEntryMode && _numberEntryModeTimeout == 1)
            {
                channelLabel.Text     = string.Empty;
                channelNameLabel.Text = string.Empty;

                var newChannelNumber = uint.Parse(string.Join(string.Empty, _numberEntryDigits.Select(x => x.ToString()).ToArray()));

                _numberEntryMode        = false;
                _numberEntryModeTimeout = 0;
                _numberEntryDigits.Clear();

                if (!TvCore.ChannelIndexList.Contains(newChannelNumber))
                {
                    return;
                }

                TvCore.SetChannel((uint)TvCore.ChannelIndexList.IndexOf(newChannelNumber));
            }
            else if (_numberEntryMode && _numberEntryModeTimeout > 0)
            {
                _numberEntryModeTimeout--;
            }
        }
Ejemplo n.º 2
0
        /// <summary>Initialize the channel editor</summary>
        private void Initialize()
        {
            LoadAll();

            treeViewAllChannels.AfterSelect += (s, a) =>
            {
                if (_isChannelChanging || !_isInitialized)
                {
                    return;
                }

                if (a.Node.Name == "NodeRoot" || a.Node.Name.StartsWith("NodeCat"))
                {
                    if (a.Node.Name.StartsWith("NodeCat"))
                    {
                        a.Node.Expand();

                        treeViewAllChannels.SelectedNode = treeViewAllChannels.Nodes[0].Nodes[a.Node.Name].Nodes[0];
                    }

                    UpdateGui();
                }
                else
                {
                    TvCore.SetChannel(uint.Parse(a.Node.Name));
                }
            };

            treeViewFavoriteChannels.AfterSelect += (s, a) => buttonFavoriteRemove.Enabled = a.Node.Name != "NodeRoot";

            treeViewFavoriteChannels.NodeMouseDoubleClick += (s, a) =>
            {
                if (_isChannelChanging || !_isInitialized)
                {
                    return;
                }

                TvCore.SetChannel(uint.Parse(a.Node.Name));
            };

            TvCore.ChannelChanged += newChannel =>
            {
                if (!_isInitialized)
                {
                    return;
                }

                _isChannelChanging = true;

                UpdateGui();

                _isChannelChanging = false;
            };

            _isInitialized = true;
        }
Ejemplo n.º 3
0
        /// <summary>The Form Load handler, which starts TVCore's functionality</summary>
        /// <param name="sender">The object that triggered the event</param>
        /// <param name="e">The event arguments</param>
        private async void TvForm_Load(object sender, EventArgs e)
        {
            TvCore.ChannelLoadPercentageChanged += percentage => this.InvokeIfRequired(() =>
            {
                channelStatusProgressBar.Value = percentage;
                labelStatus.Text = string.Format(Resources.TvForm_LoadingBarMessage, channelStatusProgressBar.Value, guideStatusProgressBar.Value);
            });

            TvCore.GuideLoadPercentageChanged += percentage => this.InvokeIfRequired(() =>
            {
                guideStatusProgressBar.Value = percentage;
                labelStatus.Text             = string.Format(Resources.TvForm_LoadingBarMessage, channelStatusProgressBar.Value, guideStatusProgressBar.Value);
            });

            await TvCore.Start();

            channelStatusLabel.Text = Resources.TvForm_ChannelsLoaded;

            guideStatusLabel.Text = Resources.TvForm_GuideLoaded;

            guideStatusProgressBar.Visible = channelStatusProgressBar.Visible = false;

            labelStatus.Visible = false;

            _isInitialized = true;

            if (TvCore.Settings.ChannelEditorOpen)
            {
                _channelsForm.Show(this);
            }

            if (TvCore.Settings.GuideOpen)
            {
                _guideForm.Show(this);
            }

            TvCore.SetChannel(TvCore.Settings.Channel);
        }