/// <summary> /// This will bring up the AddTorrentDialog, ask the user about the download path /// and enable file selection. This will only work if the torrent has metadata. /// </summary> /// <param name="ti"></param> private void handle_torrent_file_selection(TorrentInfo ti) { uiContext.Send(x => { App.Current.MainWindow.Activate(); AddTorrentDialog atd = new AddTorrentDialog(ti) { Owner = App.Current.MainWindow, Icon = App.Current.MainWindow.Icon }; atd.ShowDialog(); if (atd.UserOK) { ti.Name = atd.TorrentName; if (atd.TorrentSavePath != ti.SavePath) { ti.ChangeSavePath(atd.TorrentSavePath); } if (atd.AutoStartTorrent) { ti.Start(); } else { ti.Stop(); } ti.RatioLimit = atd.RatioLimit; if (!this._torrents.ContainsKey(ti.InfoHash)) { this._torrents.Add(ti.InfoHash, ti); this.Torrents.Add(ti); } } else { this.Torrents.Remove(ti); this._torrents.Remove(ti.InfoHash); this.LibtorrentSession.RemoveTorrent(ti.Torrent, true); this.DeleteTorrentStateData(ti.InfoHash); ti.OffMyself(); } }, null); }