Exemplo n.º 1
0
        /// <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);
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public PauseDownloadCommand(ViewModelBase a_viewModel,
                             SelectedTorrentInfoViewModel a_selectedTorrentViewModel)
 {
     ViewModel = a_viewModel;
     SelectedTorrentViewModel = a_selectedTorrentViewModel;
 }