Пример #1
0
        public async void TorrentChanged(ListView obj, TorrentInfo inf)
        {
            try
            {
                SelectedTorrents = obj.SelectedItems.Cast <TorrentInfo>().ToArray();

                _moreInfoCancelTokeSource?.Cancel();
                _moreInfoCancelTokeSource = new CancellationTokenSource();

                await Task.Delay(250, _moreInfoCancelTokeSource.Token);

                if (_moreInfoCancelTokeSource.Token.IsCancellationRequested)
                {
                    return;
                }
                selectedIDs = SelectedTorrents.Select(x => x.Id).ToArray();

                if (ConfigService.Instanse.MoreInfoShow)
                {
                    UpdateMoreInfoPosition(SelectedTorrents.Any());
                    UpdateMoreInfoView(_moreInfoCancelTokeSource.Token);
                }
            }
            catch (TaskCanceledException)
            {
            }
        }
Пример #2
0
 /// <summary>
 /// Open torrent properties popUp by double click on grid or RightClickMenu on torrent row.
 /// </summary>
 /// <param name="sender">sender...</param>
 /// <param name="torrentRow">Torrent..</param>
 public void Properties(object?sender, TorrentInfo?torrentRow)
 {
     if (_transmissionClient != null)
     {
         if (selectedIDs != null)
         {
             if (selectedIDs.Length > 1)
             {
                 manager.ShowDialogAsync(new TorrentPropsViewModel(_transmissionClient,
                                                                   SelectedTorrents.Select(x => x.Id).ToArray(), manager));
             }
             else
             {
                 manager.ShowDialogAsync(new TorrentPropsViewModel(
                                             _transmissionClient,
                                             new[] { SelectedTorrents.Select(x => x.Id).First() },
                                             manager));
             }
         }
         else if (sender is ListView && torrentRow is TorrentInfo selectedTorrent)
         {
             manager.ShowDialogAsync(new TorrentPropsViewModel(_transmissionClient, new[] { torrentRow.Id }, manager));
         }
     }
 }