internal static void DownloadVolume( BookItem ThisBook, Volume Vol )
{
if ( ThisBook is BookInstruction )
{
Chapter[] Chs = Vol.ChapterList;
int i = 0; int l = Chs.Length;
ChapterLoader Loader = null;
Loader = new ChapterLoader( ThisBook, C => {
C.UpdateStatus();
if ( i < l )
{
Loader.Load( Chs[ i++ ] );
}
} );
Loader.Load( Chs[ i++ ] );
return;
}
Worker.ReisterBackgroundWork( () =>
{
string id = ThisBook.Id;
string CVid = Vol.vid;
foreach ( Chapter c in Vol.ChapterList )
{
if ( !c.IsCached )
{
Logger.Log( ID, "Registering: " + c.ChapterTitle, LogType.DEBUG );
App.RuntimeTransfer.RegisterRuntimeThread(
X.Call<XKey[]>( XProto.WRequest, "GetBookContent", id, c.cid )
, c.ChapterPath, Guid.NewGuid()
, Uri.EscapeDataString( ThisBook.Title ) + "&" + Uri.EscapeDataString( Vol.VolumeTitle ) + "&" + Uri.EscapeDataString( c.ChapterTitle )
, c.IllustrationPath
);
}
}
App.RuntimeTransfer.StartThreadCycle( ( a, b ) =>
{
LoadComplete( a, b );
Worker.UIInvoke( () => { foreach ( Chapter C in Vol.ChapterList ) C.UpdateStatus(); } );
} );
App.RuntimeTransfer.ResumeThread();
} );
}