public ChoosePhotoUndoable(TournamentController controller, PhotoChoice choice) { this.controller = controller; this.choice = choice; this.savedState = controller.Tournament.SaveState(); this.versionIdBefore = controller.memoryVersionId; this.versionIdAfter = ++controller.lastVersionId; }
public async Task <int> CompareAsync(string item, string other, CancellationToken cancellationToken) { Controller.PreloadPhotosAdvicedEvent?.Invoke( Controller.Tournament.PredictItemsWorthPreloading().ToList()); Page page = new Page(item, other); Controller.currentPage = page; Controller.NewPageEvent(page); PhotoChoice best = await page.BetterPhotoPromise.Task; return(best == PhotoChoice.PhotoAIsBetter ? 1 : -1); }
public void Choose(PhotoChoice choice) { BetterPhotoPromise.TrySetResult(choice); }