Example #1
0
        private static void OnTorrentUpdateAlert(Core.state_update_alert a)
        {
            foreach (Core.TorrentStatus ts in a.status)
            {
                var stat = "Paused";
                if (!ts.paused)
                {
                    stat = Utils.GiveMeStateFromEnum(ts.state);
                }
                var evnt = new EventsArgs.OnTorrentUpdatedEventArgs(ts);
                evnt.State = stat;
                //log.Trace("torrent: name {0}; status {1}; progress {2}", ts.name, ts.state.ToString(), ts.progress);

                if (webServer != null)
                {
                    var context = Microsoft.AspNet.SignalR.GlobalHost.ConnectionManager.GetHubContext <www.SignalRHub>();
                    context.Clients.All.notifyUpdateProgress(evnt);
                }

                TorrentUpdated?.Invoke(null, evnt);
            }
        }
        private static void OnTorrentUpdateAlert(Core.state_update_alert a)
        {
            foreach (Core.TorrentStatus ts in a.status)
            {
                var stat = "Paused";
                if (!ts.paused)
                {
                    stat = Utils.GiveMeStateFromEnum(ts.state);
                }
                var evnt = new EventsArgs.OnTorrentUpdatedEventArgs(ts);
                evnt.State = stat;
                //log.Trace("torrent: name {0}; status {1}; progress {2}", ts.name, ts.state.ToString(), ts.progress);

                if (webServer != null)
                {
                    var context = Microsoft.AspNet.SignalR.GlobalHost.ConnectionManager.GetHubContext<www.SignalRHub>();
                    context.Clients.All.notifyUpdateProgress(evnt);
                }

                TorrentUpdated?.Invoke(null, evnt);
            }
        }