Example #1
0
 protected void DispatchUpdate(Action <ITVStreamCallback> ClientUpdateMethod)
 {
     try
     {
         if (State == ServerGraphState.Running)
         {
             lock (_clientsCollectionLock)
             {
                 foreach (IndigoServices.CommonStreamService client in this.Clients)
                 {
                     IndigoServices.TVStreamService tvClient = client as IndigoServices.TVStreamService;
                     if (tvClient != null)
                     {
                         if (tvClient.ClientCallback != null)
                         {
                             try
                             {
                                 ClientUpdateMethod(tvClient.ClientCallback);
                             }
                             catch (Exception ex)
                             {
                                 AppLogger.Dump(ex);
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception exc)
     {
         AppLogger.Dump(exc);
     }
 }
Example #2
0
        /// <summary>
        /// When this event is raised, replace our known channel collection, and save it!
        /// </summary>
        private void channelScanWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (!e.Cancelled)
            {
                this.KnownChannels = _foundChannels;
                SaveKnownChannels();
                if (this.KnownChannels.Count > 0)
                {
                    this.Channel = this.KnownChannels.Items[0];
                }
            }

            //if everyone disconnected while we were busy scanning, then we'll just stop
            if (this.NumberOfClients == 0)
            {
                this.Stop();
            }
            else
            {
                ChannelScanCompleteEventArgs channelScanInfo = new ChannelScanCompleteEventArgs();
                channelScanInfo.Cancelled     = e.Cancelled;
                channelScanInfo.ChannelsFound = this.KnownChannels.Count;

                lock (_clientsCollectionLock)
                {
                    foreach (IndigoServices.CommonStreamService client in this.Clients)
                    {
                        IndigoServices.TVStreamService tvClient = client as IndigoServices.TVStreamService;
                        if (tvClient != null)
                        {
                            if (tvClient.ClientCallback != null)
                            {
                                try
                                {
                                    tvClient.ClientCallback.ChannelScanComplete(channelScanInfo);
                                }
                                catch (Exception ex)
                                {
                                    AppLogger.Dump(ex);
                                }
                            }
                        }
                    }
                }
            }
        }
Example #3
0
 /// <summary>
 /// When this event is raised, forward the channel scan progress to all clients
 /// </summary>
 private void channelScanWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
 {
     lock (_clientsCollectionLock)
     {
         foreach (IndigoServices.CommonStreamService client in this.Clients)
         {
             IndigoServices.TVStreamService tvClient = client as IndigoServices.TVStreamService;
             if (tvClient != null)
             {
                 if (tvClient.ClientCallback != null)
                 {
                     try
                     {
                         tvClient.ClientCallback.ChannelScanProgressUpdate(e.ProgressPercentage);
                     }
                     catch (Exception ex)
                     {
                         AppLogger.Dump(ex);
                     }
                 }
             }
         }
     }
 }