Beispiel #1
0
        private void DownloadsAction(ActionDownloader action)
        {
            if (NodeSelection.SelectedNodes.Length > 0)
            {
                try
                {
                    NodeSelection.Changed -= lvwDownloads_ItemSelectionChanged;

                    for (int i = NodeSelection.SelectedNodes.Length - 1; i >= 0; i--)
                    {
                        DownloadListNode item = (DownloadListNode)NodeSelection.SelectedNodes[i];
                        action((Downloader)mapItemToDownload[item], item);
                    }

                    NodeSelection.Changed += lvwDownloads_ItemSelectionChanged;
                    lvwDownloads_ItemSelectionChanged(null, null);
                }
                finally
                {
                    Application.Invoke((s, e) =>
                    {
                        QueueDraw();
                    });
                    //UpdateSegments();
                }
            }
        }
Beispiel #2
0
        private void AddDownload(Downloader d)
        {
            d.RestartingSegment += download_RestartingSegment;
            d.SegmentStoped     += download_SegmentEnded;
            d.SegmentFailed     += download_SegmentFailed;
            d.SegmentStarted    += download_SegmentStarted;
            d.InfoReceived      += download_InfoReceived;
            d.SegmentStarting   += Downloader_SegmentStarting;

            string ext = System.IO.Path.GetExtension(d.LocalFile);

            DownloadListNode item = new DownloadListNode(d);

            mapDownloadToItem[d]    = item;
            mapItemToDownload[item] = d;

            NodeStore.AddNode(item);
        }
Beispiel #3
0
        void Instance_DownloadRemoved(object sender, DownloaderEventArgs e)
        {
            Application.Invoke((s, ea) =>
            {
                if (mapDownloadToItem[e.Downloader] is DownloadListNode item)
                {
                    if (lastSelection == item)
                    {
                        lastSelection = null;
                    }

                    mapDownloadToItem[e.Downloader] = null;
                    mapItemToDownload[item]         = null;

                    NodeStore.RemoveNode(item);
                }
            }
                               );
        }