Ejemplo n.º 1
0
        private void _epgBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            RefreshEpgArgs args = e.Argument as RefreshEpgArgs;

            _controller.RefreshEpgData(args.ReloadEpg, args.ChannelGroupId, args.GuideDateTime, this.EpgCancellationPending);
            e.Cancel = _backgroundWorker.CancellationPending;
        }
Ejemplo n.º 2
0
 private void RefreshEpg(bool reloadEpg)
 {
     if (this.Visible &&
         this.MainForm != null &&
         !this.MainForm.Disposing)
     {
         if (_backgroundWorker.IsBusy)
         {
             _backgroundWorker.CancelAsync();
             while (_backgroundWorker.IsBusy)
             {
                 System.Threading.Thread.Sleep(100);
                 Application.DoEvents();
             }
         }
         RefreshEpgArgs args = new RefreshEpgArgs();
         args.GuideDateTime  = _guideDatePicker.Value.Date.AddHours(_model.EpgHoursOffset);
         args.ChannelGroupId = (_model.ChannelType == ChannelType.Television)
             ? ChannelGroup.AllTvChannelsGroupId : ChannelGroup.AllRadioChannelsGroupId;
         if (_channelGroupsComboBox.SelectedItem != null)
         {
             ChannelGroup channelGroup = _channelGroupsComboBox.SelectedItem as ChannelGroup;
             args.ChannelGroupId = channelGroup.ChannelGroupId;
         }
         args.ReloadEpg = reloadEpg;
         MainForm.Session[SessionKey.GuideDate]      = args.GuideDateTime;
         MainForm.Session[SessionKey.ChannelType]    = _model.ChannelType;
         MainForm.Session[SessionKey.ChannelGroupId] = args.ChannelGroupId;
         _loadingPanel.Visible = true;
         _backgroundWorker.RunWorkerAsync(args);
     }
 }
Ejemplo n.º 3
0
 private void RefreshEpg(bool reloadEpg)
 {
     if (this.Visible
         && this.MainForm != null
         && !this.MainForm.Disposing)
     {
         if (_backgroundWorker.IsBusy)
         {
             _backgroundWorker.CancelAsync();
             while (_backgroundWorker.IsBusy)
             {
                 System.Threading.Thread.Sleep(100);
                 Application.DoEvents();
             }
         }
         RefreshEpgArgs args = new RefreshEpgArgs();
         args.GuideDateTime = _guideDatePicker.Value.Date.AddHours(_model.EpgHoursOffset);
         args.ChannelGroupId = (_model.ChannelType == ChannelType.Television)
             ? ChannelGroup.AllTvChannelsGroupId : ChannelGroup.AllRadioChannelsGroupId;
         if (_channelGroupsComboBox.SelectedItem != null)
         {
             ChannelGroup channelGroup = _channelGroupsComboBox.SelectedItem as ChannelGroup;
             args.ChannelGroupId = channelGroup.ChannelGroupId;
         }
         args.ReloadEpg = reloadEpg;
         MainForm.Session[SessionKey.GuideDate] = args.GuideDateTime;
         MainForm.Session[SessionKey.ChannelType] = _model.ChannelType;
         MainForm.Session[SessionKey.ChannelGroupId] = args.ChannelGroupId;
         _loadingPanel.Visible = true;
         _backgroundWorker.RunWorkerAsync(args);
     }
 }