Commits

Paul Barbu - Gheorghe committed b39660d

don't allow solving the cube while a scrambling or solving is in progress

Comments (0)

Files changed (2)

magic-cube/MainWindow.xaml

         <MenuItem Header="Hard" Click="NewGame_Click" Tag="Hard"  />
         <MenuItem Header="Very Hard" Click="NewGame_Click" Tag="Very Hard"  />
     </MenuItem>
-            <MenuItem Header="Solve it!" Name="solveMenu" Click="solveMenu_Click" />
+            <MenuItem Header="Solve it!" Name="solveMenu" Click="solveMenu_Click" IsEnabled="False" />
         </Menu>
     <Viewport3D Name="mainViewport" ClipToBounds="True">
     <ModelVisual3D>

magic-cube/MainWindow.xaml.cs

             InitializeComponent();
         }
 
-        //TODO: implement those different sizes
-
         private enum Difficulty {
             Easy = 10,
             Normal = 20,
                 }
                 
                 Debug.Print("Move: {0} {1}", moveList[index].ToString(), direction.ToString());
-                
+
                 moves.Add(new KeyValuePair<Move, RotationDirection>(moveList[index], direction));
                 doneMoves.Add(new KeyValuePair<Move, RotationDirection>(moveList[index], direction));
             }
 
         private void Window_ContentRendered(object sender, EventArgs e) {
             init(currentDifficulty, defaultTitle + "Normal");
+            solveMenu.IsEnabled = true;
         }
 
         private void NewGame_Click(object sender, RoutedEventArgs e) {
+            solveMenu.IsEnabled = false;
             string d = ((MenuItem)sender).Tag.ToString();
 
             switch(d){
 
         private void Window_KeyUp(object sender, KeyEventArgs e) {
             if (e.Key == Key.F5) {
+                solveMenu.IsEnabled = false;
                 init(currentDifficulty, this.Title);
+                solveMenu.IsEnabled = true;
             }
         }
 
             List<KeyValuePair<Move, RotationDirection>> m = new List<KeyValuePair<Move, RotationDirection>>();
 
             for (int i = doneMoves.Count - 1; i >= 0; i--) {
-                //c.rotate(new KeyValuePair<Move, RotationDirection>(doneMoves[i].Key, (RotationDirection)(-1 * (int)doneMoves[i].Value)));
                 m.Add(new KeyValuePair<Move, RotationDirection>(doneMoves[i].Key, (RotationDirection)(-1 * (int)doneMoves[i].Value)));
             }