public void Execute(object parameter) { PuzzleEditScreen screen = (PuzzleEditScreen)parameter; screen.Editor.ResolveAmbiguity(); var facade = new PiCrossFacade(); bool am = false; foreach (IPuzzleEditorSquare square in screen.Editor.Grid.Items) { if (square.Ambiguity.Value == Ambiguity.Ambiguous) { am = true; break; } } if (!am) { IGameData gameData = facade.LoadGameData("../../../../python/picross.zip", true); Puzzle puzzle = screen.Editor.BuildPuzzle(); IPuzzleLibraryEntry entry = gameData.PuzzleLibrary.Create(puzzle, "Jonas"); screen.navigator.selectionScreen.cell.Value.Add(new PuzzleViewModel(entry)); screen.navigator.selectionScreen.PuzzleSizes.Add(puzzle.Size); screen.SwitchTo(new MenuScreen(screen.navigator)); } }
public SelectionScreen(Navigator navigator) : base(navigator) { var facade = new PiCrossFacade(); cell = Cell.Create <IList <PuzzleViewModel> >(facade.LoadGameData("../../../../python/picross.zip").PuzzleLibrary.Entries.Select(entry => new PuzzleViewModel(entry)).ToList()); backup = this.Puzzles.Select(puzzle => puzzle).ToList(); PuzzleSizes = this.Puzzles.Select(puzzle => puzzle.Entry.Puzzle.Size).Distinct().ToList(); GoToPuzzle = new GoToPuzzleCommand(navigator, this); GoToMenu = new EasyCommand(() => SwitchTo(new MenuScreen(navigator))); FilterUnsolved = new FilterUnsolvedCommand(); FilterSize = new FilterSizeCommand(); ClearFilters = new ClearFiltersCommand(); OrderBySolved = new OrderBySolvedCommand(); OrderByUnsolved = new OrderByUnsolvedCommand(); OrderBySize = new OrderBySizeCommand(); }