private void OK_Click(object sender, RoutedEventArgs e) { if (name.Text == "") { TextBox t = new TextBox(); errorDialog = new PromptDialog("Error", ModernWindow.GetWindow(this)); errorDialog.AddColoredHeader("Invalid Name"); errorDialog.AddTextBlock("Please enter a valid name."); errorDialog.ShowDialog(); if (errorDialog.DialogResult == true && t.Text != "") { a.name = t.Text; } else { errorDialog.ShowDialog(); } return; } SaveAll(); ItemEditor.UpdateItemNameAt(ItemEditor.index); if (ApplicationSettings.instance.autoSave) { Utils.SaveToFile(ItemEditor.kv_list, ApplicationSettings.instance.currentModPath + "\\scripts\\npc\\" + ItemEditor.file, rootKey); } this.Close(); }
/// <summary> /// Initialization. /// </summary> public AddHeroWindow() { InitializeComponent(); heroNameComboBox.AddHandler(TextBoxBase.TextChangedEvent, new TextChangedEventHandler(newHeroNameTextChanged)); try { heroesListLines = File.ReadAllLines("Data\\DefaultHeroesList.txt"); } catch { /*Button b = new Button(); * b.Content = "DefaultHeroesList.txt"; * b.Click += ErrorButtonClicked; * * errorDialog = new PromptDialog("Error"); * errorDialog.AddColoredHeader("File Not Found"); * errorDialog.AddButton(b); * errorDialog.AddBBCode("An empty file will be created. Feel free to edit it."); * errorDialog.AddBBCode("[url=http://pastebin.com/raw.php?i=EU59vmAb]Default Values.[/url]");*/ errorDialog = new PromptDialog(true, false, ModernWindow.GetWindow(this)); errorDialog.MissingFile("DefaultHeroesList.txt", "http://pastebin.com/raw.php?i=EU59vmAb"); errorDialog.ShowDialog(); } if (heroesListLines.Length > 0) { for (int i = 0; i < heroesListLines.Length; i++) { heroNameComboBox.Items.Add(heroesListLines[i]); } heroNameComboBox.SelectedIndex = 0; } }
private void Special_Click(object sender, RoutedEventArgs e) { abilitySpecialDialog = new AbilitySpecialDialog(); abilitySpecialDialog.Owner = ModernWindow.GetWindow(this); abilitySpecialDialog.abilitySpecials_list = a.abilitySpecials.Children.ToList(); CreateAbilitySpecialDialog(); abilitySpecialDialog.SetSpecials(); abilitySpecialDialog.ShowDialog(); if (abilitySpecialDialog.DialogResult == true) { a.abilitySpecials = abilitySpecialDialog.GetNewSpecials(); } }
private void TargetFlags_Click(object sender, RoutedEventArgs e) { abilityUnitTargetFlagsDialog = new AbilityUnitTargetFlagsDialog(); abilityUnitTargetFlagsDialog.Owner = ModernWindow.GetWindow(this); abilityUnitTargetFlagsDialog.abilityUnitTargetFlags_list = a.abilityUnitTargetFlags.ToList(); CreateAbilityUnitTargetFlagsDialog(); abilityUnitTargetFlagsDialog.SetFlags(); abilityUnitTargetFlagsDialog.ShowDialog(); if (abilityUnitTargetFlagsDialog.DialogResult == true) { a.abilityUnitTargetFlags = abilityUnitTargetFlagsDialog.GetNewFlags(); } }
private void Declarations_Click(object sender, RoutedEventArgs e) { itemDeclarationsDialog = new ItemDeclarationsDialog(); itemDeclarationsDialog.Owner = ModernWindow.GetWindow(this); itemDeclarationsDialog.itemDeclarations_list = a.itemDeclarations.ToList(); CreateitemDeclarationsDialog(); itemDeclarationsDialog.SetDeclarations(); itemDeclarationsDialog.ShowDialog(); if (itemDeclarationsDialog.DialogResult == true) { a.itemDeclarations = itemDeclarationsDialog.GetNewDeclarations(); } }
private void ShopTags_Click(object sender, RoutedEventArgs e) { itemShopTagsDialog = new ItemShopTagsDialog(); itemShopTagsDialog.Owner = ModernWindow.GetWindow(this); itemShopTagsDialog.itemShopTags_list = a.itemShopTags.ToList(); CreateItemShopTagsDialog(); itemShopTagsDialog.SetTags(); itemShopTagsDialog.ShowDialog(); if (itemShopTagsDialog.DialogResult == true) { a.itemShopTags = itemShopTagsDialog.GetNewTags(); } }
private void Behaviors_Click(object sender, RoutedEventArgs e) { abilityBehaviorsDialog = new AbilityBehaviorsDialog(); abilityBehaviorsDialog.Owner = ModernWindow.GetWindow(this); abilityBehaviorsDialog.abilityBehavior_list = a.abilityBehavior.ToList(); CreateBehaviorsDialog(); abilityBehaviorsDialog.SetBehaviors(); abilityBehaviorsDialog.ShowDialog(); if (abilityBehaviorsDialog.DialogResult == true) { a.abilityBehavior = abilityBehaviorsDialog.GetNewBehaviors(); } }
private void InvalidDotaPath() { PromptDialog errorDialog = new PromptDialog("Error", true, false, ModernWindow.GetWindow(this)); errorDialog.AddHeader("Invalid Path"); errorDialog.AddTextBlock("Dota 2 path is invalid.\r\nPlease browse to a correct path."); errorDialog.ShowDialog(); if ((bool)dotaFolderBrowser.ShowDialog(MainWindow.GetWindow(this))) { UpdateDotaPath(dotaFolderBrowser.SelectedPath); } else { InvalidDotaPath(); } }
private void ParseDataToList(string file, List <string> stringsList, string link) { try { currentLines = File.ReadAllLines("Data\\" + file); if (currentLines.Length > 0) { for (int i = 0; i < currentLines.Length; i++) { stringsList.Add(currentLines[i]); } } } catch { errorDialog = new PromptDialog(true, false, ModernWindow.GetWindow(this)); errorDialog.MissingFile(file, link); errorDialog.ShowDialog(); ParseDataToList(file, stringsList, link); } }
//Could use ParseDataToList directly. private void ParseDataToCombobox(string file, ComboBox comboBox, string link) { try { currentLines = File.ReadAllLines("Data\\" + file); if (currentLines.Length > 0) { for (int i = 0; i < currentLines.Length; i++) { comboBox.Items.Add(currentLines[i]); } } } catch { errorDialog = new PromptDialog(true, false, ModernWindow.GetWindow(this)); errorDialog.MissingFile(file, link); this.errorDialog.ShowDialog(); if (errorDialog.DialogResult == true) { ParseDataToCombobox(file, comboBox, link); } } }