Ejemplo n.º 1
0
        private void ReDrawGrid()
        {
            //Empty the grid
            Puzzle.ClearGrid(true);
            lbClues.SelectedIndex = -1;

            Puzzle.DrawPuzzle(true);

            Puzzle.TheGrid.IsEnabled = false;

            if (Puzzle.InvalidWords.Count() > 0)
            {
                MessageBox.Show("Some words weren't drawn because they were invalid");
            }
        }
Ejemplo n.º 2
0
        private void mnuLoad_Click(object sender, RoutedEventArgs e)
        {
            tabWindow.SelectedItem = tbiSolvePuzzle;

            if (Puzzle != null)
            {
                //Can't just remove Puzzle.TheGrid because it might be a new instance

                //Find the location of the button just before the grid
                var cluesIndex = spMain.Children.IndexOf(lbClues2);
                //Remove everything after this button
                spMain.Children.RemoveRange(cluesIndex + 1, 4);
                lbClues2.ItemsSource = null;
            }

            OpenFileDialog openFile = new OpenFileDialog();

            openFile.Title  = "Open CrossWord";
            openFile.Filter = "eXtensible Markup Language file|*.xml";

            if ((bool)openFile.ShowDialog())
            {
                var file = new FileInfo(openFile.FileName);
                Puzzle = new CrossWord(file, 50);
                Puzzle.Sort();

                spMain.Children.Add(Puzzle.TheGrid);

                Puzzle.DrawPuzzle(false);

                if (Puzzle.InvalidWords.Count() > 0)
                {
                    MessageBox.Show("Some words weren't drawn because they were invalid");
                }

                lbClues2.ItemsSource = Puzzle.Words;
            }
        }