示例#1
0
 private void RaiseTorrentLost(RssFilter filter, RssItem item)
 {
     if (TorrentLost != null)
     {
         TorrentLost(this, new TorrentRssWatcherEventArgs(filter, item));
     }
 }
		public TorrentRssWatcherEventArgs(RssFilter matchedFilter, RssItem item) : base(item.Link)
		{
			this.matchedFilter = matchedFilter;
			this.item = item;
		}
 public TorrentRssWatcherEventArgs(RssFilter matchedFilter, RssItem item) : base(item.Link)
 {
     this.matchedFilter = matchedFilter;
     this.item          = item;
 }
		private void AddFilterBtn_Click (object sender, EventArgs e)
		{
			RssFilter rssfilter = new RssFilter ();
			//filter.SavePath = controler.engine.Settings.SavePath;
			FilterListbox.Items.Add (rssfilter);
			controller.AddFilter (rssfilter);
		}
		public void RemoveFilter(RssFilter filter){
			if(Filters.Contains(filter)){
				Filters.Remove(filter);
				RefreshWatchers();
			}
		}
		public void AddFilter(RssFilter filter){
			if(!Filters.Contains(filter)){
				Filters.Add(filter);
				RefreshWatchers();
			}
		}
		// FIXME: Adding torrents not on the main loop, will throw up!
		// Solutions: Pop every add onto main loop resulting in blocking
		// or add async Load(uri, location) to library, or let the GUI
		// program handle downloading the torrent file 
		public void AddTorrent(RssItem item, RssFilter filter)
		{
			history.Add(item);
			
			if(filter == null){
				Console.Out.WriteLine("About to add with default savepath, URL: " + item.Link);
				try {
					controller.Add(item.Link);
				} catch {
					//logger.Error("RSS Manager: Unable to add - " + item.Title);
				}
			}
			else {
				Console.Out.WriteLine("About to add with custom savepath, Path: " + filter.SavePath);
				try{
					controller.Add(item.Link, new TorrentSettings(), filter.SavePath);
				} catch {
					//logger.Error("RSS Manager: Unabled to add - " + item.Title);
				}
			}
		}
		private void RaiseTorrentLost(RssFilter filter, RssItem item)
		{
			if(TorrentLost != null)
				TorrentLost(this, new TorrentRssWatcherEventArgs(filter, item));
		}