/// <summary> /// Creates an stage, north of the current stage. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ButtonUpStage_Click(object sender, RoutedEventArgs e) { try { if (currentID < 0) { throw new Exception(); } if ((string)ButtonUpStage.Content == "↑") { currentID = manager.GetStage(currentID).ExitUp; CheckExits(); LoadStageCanvas(); } else { int previousID = manager.ID; StageWindow stageWindow = new StageWindow(manager, false, null); stageWindow.ShowDialog(); if (previousID != manager.ID) { Stage previous = manager.GetStage(currentID); previous.ExitUp = manager.ID; Stage current = manager.GetStage(manager.ID); current.ExitDown = currentID; currentID = manager.ID; LoadStageCanvas(); CheckExits(); } } } catch (Exception) { MessageBox.Show("You have to create the first stage.", "Attention", MessageBoxButton.OK, MessageBoxImage.Information); } }
/// <summary> /// Lets you create the first level, and modify any level after the first is created. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ButtonModifyStage_Click(object sender, RoutedEventArgs e) { if ((string)ButtonModifyStage.Content == "Create") { StageWindow stageWindow = new StageWindow(manager, false, null); stageWindow.ShowDialog(); if (manager.ID == 0) { currentID = 0; ButtonModifyStage.Content = "Modify"; LoadStageCanvas(); } } else { StageWindow stageWindow = new StageWindow(manager, true, manager.GetStage(currentID)); stageWindow.ShowDialog(); LoadStageCanvas(); } }