Pregunta

I have a TorrentLeech application with ASP.Net MVC 4 and MonoTorrent library. I want to show the progress of downloading. I don't know how can I do that but I just know that page shouldn't stop loading because the action stops working. Can anybody help me?

this is my action but it's still basic:

public ActionResult Tr()
{
    MonoTorrent.Common.Torrent t = null;
    t = MonoTorrent.Common.Torrent.Load(@"E:\Downloads\[isoHunt] Men in Black 3 [ENG] 2012 DVDRip XviD-LPD.torrent");
    MonoTorrent.Client.TorrentManager tm = new MonoTorrent.Client.TorrentManager(t, @"E:\Downloads\[isoHunt] Men in Black 3 [ENG] 2012 DVDRip XviD-LPD\", new MonoTorrent.Client.TorrentSettings(0, 60, 0, 0));

    return View();
}
¿Fue útil?

Solución

You could have a controller action which immediately returns a view in which you would show some spinner animation and kick an AJAX request to another controller action that will perform the actual task.

Otros consejos

The page WILL stop working if the Load function times out. It'll never reach the return View(); line. Try threading the Load function call and your page should load.

Edit: better yet, if any of those 3 lines times out, it'll fail to load.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top