/// <summary> /// loads image from file if it exists, or else by downloading and then loading from file /// </summary> protected override void StartInternal() { numLoadingTasksActive++; try{ if (File.Exists(parent.ThumbnailFilepath)) { bool ok = parent.LoadTextureFromFile(); if (ok) { status = ITaskStatus.SUCCESS; } else { status = ITaskStatus.FAIL; } } else { // first run the base downloading task now. If that is ok, then load from file downloaded. base.StartInternal(); if (File.Exists(parent.ThumbnailFilepath) && IsSuccess()) { bool ok = parent.LoadTextureFromFile(); if (ok) { status = ITaskStatus.SUCCESS; } else { status = ITaskStatus.FAIL; } } else { status = ITaskStatus.FAIL; } } // after a successful load, enable the thumbnail. if (IsSuccess()) { parent.Enable(); } } finally { numLoadingTasksActive--; } }
/// <summary> /// loads image from file if it exists, or else by downloading and then loading from file /// </summary> protected override void StartInternal() { bool ok = parent.LoadTextureFromFile(); if (ok) { status = ITaskStatus.SUCCESS; } else { status = ITaskStatus.FAIL; } // after a successful load, enable the thumbnail. if (IsSuccess()) { parent.Enable(); } }