public CancellableTask<Pixbuf> FindBestPreview (int width, int height) { EnsureMipMap (); var source = new CancellationTokenSource (); var task = new ChildCancellableTask<MipMapFile, Pixbuf> (MipMapLoader, () => { source.Token.ThrowIfCancellationRequested (); return MipMapLoader.Result.FindBest (width, height); }, source); MipMapLoader.Request (); task.Start (); return task; }
public Task<bool> IsBestPreview (int have_width, int have_height, int desired_width, int desired_height) { EnsureMipMap (); var source = new CancellationTokenSource (); var task = new ChildCancellableTask<MipMapFile, bool> (MipMapLoader, () => { source.Token.ThrowIfCancellationRequested (); return MipMapLoader.Result.IsBestSize (have_width, have_height, desired_width, desired_height); }, source); task.Start (); return task; }