Exemple #1
0
        /// <summary>
        /// Do the operations without waiting
        /// </summary>
        private void LoadSerialSync()
        {
            int count = 0;

            foreach (var url in urls)
            {
                UrlLoader urlLoader = new UrlLoader(url);

                urlLoader.OnCompleted.AddListener((isSuccess, text, elapsedTime) =>
                {
                    LogResults(url, count++, text, elapsedTime);
                });

                urlLoader.Load();
            }
        }
Exemple #2
0
        private async Task <UrlLoader> LoadUrlLoaderTask(string url, int count)
        {
            UrlLoader urlLoader = new UrlLoader(url);

            bool isComplete = false;

            urlLoader.OnCompleted.AddListener((isSuccess, text, elapsedTime) =>
            {
                isComplete = true;
                LogResults(url, count, text, elapsedTime);
            });

            urlLoader.Load();

            while (!isComplete)
            {
                await Task.Delay(100);
            }

            return(urlLoader);
        }