コード例 #1
0
        public void nextFile()
        {
            Logger.log(Logger.TYPE.DEBUG, "Try next file from download queue...");
            if (queueFile.Any())
            {
                QueueBlock <Boolean> block = queueFile.Dequeue();
                if (block != null)
                {
                    downloadFileAsync(block.getUrl(), Path.Combine(block.getDestination(),
                                                                   block.getFileName()),
                                      (object sender, AsyncCompletedEventArgs e) => {
                        block.invokeCallback(e.Cancelled);
                        nextFile();
                    }, block);
                }
            }
            else
            {
                totalDownloaded   = 0;
                queueDownloadSize = 0;

                if (queueFileCallback != null)
                {
                    queueFileCallback.onFinished();
                    queueFileCallback = null;
                }
            }
        }
コード例 #2
0
        public void nextString()
        {
            Logger.log(Logger.TYPE.DEBUG, "Try next string from download queue...");
            if (queueString.Any())
            {
                QueueBlock <String> block = queueString.Dequeue();
                if (block != null)
                {
                    downloadStringAsync(block.getUrl(), (object sender, DownloadStringCompletedEventArgs e) => {
                        block.invokeCallback(e.Result);
                        nextString();
                    }, block);
                }
            }
            else
            {
                totalDownloaded   = 0;
                queueDownloadSize = 0;

                if (queueStringCallback != null)
                {
                    queueStringCallback.onFinished();
                    queueStringCallback = null;
                }
            }
        }