/// <summary> /// Updates the selected torrent views. /// </summary> /// <param name="a_torrent">The selected torrent.</param> /// <remarks> /// UpdateSelectedTorrentViews() /// /// SYNOPSIS /// /// UpdateSelectedTorrentViews(object a_torrent); /// /// DESCRIPTION /// /// This function will update the selected torrent views. This /// includes the files, info, peers, and tracker views. /// /// </remarks> public void UpdateSelectedTorrentViews(object a_torrent) { m_selectedTorrent = a_torrent as Torrent; // Updates file tab. SelectedTorrentFilesViewModel.Clear(); foreach (FileWrapper file in m_selectedTorrent.Files) { SelectedTorrentFilesViewModel.Add(file); } // Updates info tab. SelectedTorrentInfoViewModel.Clear(); SelectedTorrentInfoViewModel.Add(m_selectedTorrent); // Updates peers tab. SelectedTorrentPeersViewModel.Clear(); foreach (var peer in m_selectedTorrent.Peers) { SelectedTorrentPeersViewModel.Add(peer.Value); } // Updates tracker tab. SelectedTorrentTrackersViewModel.Clear(); foreach (Tracker tracker in m_selectedTorrent.Trackers) { SelectedTorrentTrackersViewModel.Add(tracker); } }
public ViewModelBase() { SelectedTorrentFilesViewModel = new SelectedTorrentFilesViewModel(); SelectedTorrentInfoViewModel = new SelectedTorrentInfoViewModel(); SelectedTorrentPeersViewModel = new SelectedTorrentPeersViewModel(); SelectedTorrentTrackersViewModel = new SelectedTorrentTrackersViewModel(); TorrentViewModel = new TorrentViewModel(); OpenFileDialogCommand = new OpenFileDialogCommand(this, new OpenFileDialogViewModel()); SelectionChangedCommand = new SelectionChangedCommand(this); StartDownloadCommand = new StartDownloadCommand(this, SelectedTorrentInfoViewModel); PauseDownloadCommand = new PauseDownloadCommand(this, SelectedTorrentInfoViewModel); }