/// <summary> /// Opens the level selection when the button is clicked /// </summary> /// <param name="sender">not use</param> /// <param name="e">not used</param> private void customButton_Click(object sender, RoutedEventArgs e) { try { LevelSelection selection = new LevelSelection("Maps"); if (selection.Ready) { selection.Owner = this; Hide(); selection.ShowDialog(); } } catch (Exception) { InitializeDirectories(); MessageBox.Show("The folder was deleted. It was recreated, but no maps exist."); } }
/// <summary> /// Begins the default levels /// </summary> /// <param name="sender">not used</param> /// <param name="e">not used</param> private void startButton_Click(object sender, RoutedEventArgs e) { string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\TowerHaven\\Campaign"; InitializeDirectories(); string[] files = Directory.GetFiles(path); foreach (string file in files) try { File.Delete(file); } catch (Exception) { } SaveCampaignMap("1 - Beginning", Properties.Resources._1___Beginning); SaveCampaignMap("2 - Conflict", Properties.Resources._2___Conflict); SaveCampaignMap("Endless Mode", Properties.Resources.Endless_Mode); LevelSelection levelSelection = new LevelSelection("Campaign"); levelSelection.Owner = this; Hide(); levelSelection.ShowDialog(); }