Esempio n. 1
0
        void HookEvents()
        {
            var torrentController = ServiceManager.Get <TorrentController> ();

            torrentController.Added += delegate(object sender, DownloadAddedEventArgs e) {
                All.AddTorrent(e.Download);
                e.Download.StateChanged += HandleStateChanged;
            };

            torrentController.Removed += delegate(object sender, DownloadAddedEventArgs e) {
                All.RemoveTorrent(e.Download);
                e.Download.StateChanged -= HandleStateChanged;

                foreach (TorrentLabel label in Labels)
                {
                    label.RemoveTorrent(e.Download);
                }
            };
        }