コード例 #1
0
        public void LoadImage(string imageServerPath, DateTime updatedAt, Action <ImageData> onImageLoaded)
        {
            ImageData data = GetImageData(imageServerPath);

            if (data == null || data.UpdatedAtTime < updatedAt)
            {
                var downloadTask = new DownloadImageBackgroundTask(updatedAt, imageServerPath);
                downloadTask.ContinueWith((task, result) => {
                    if (result != null)
                    {
                        onImageLoaded.Invoke(result);
                    }
                });

                _imageLoader.Add(downloadTask);
            }
            else
            {
                onImageLoaded.Invoke(data);
            }
        }