/// <summary> /// On clicking on a monarch, launch a monarchEditForm to edit the monarch, then apply the relevant changes /// </summary> private void monarchBox_MouseDoubleClick_1(object sender, MouseEventArgs e) { textBlock monarch = monarchBlocks[monarchBox.SelectedIndex]; monarchEditForm monarchEdit = new monarchEditForm(monarch); monarchEdit.ShowDialog(); int baseLocMon = historyLoc + monarchs[monarchs.Length - 1 - monarchBox.SelectedIndex]; textBlock heir = new textBlock(); reader.changeLine(baseLocMon + monarch.getPosition("name="), "\t\t\t\t\tname=\"" + monarchEdit.name + "\""); reader.changeLine(baseLocMon + monarch.getPosition("DIP="), "\t\t\t\t\tDIP=" + monarchEdit.dip); reader.changeLine(baseLocMon + monarch.getPosition("ADM="), "\t\t\t\t\tADM=" + monarchEdit.adm); reader.changeLine(baseLocMon + monarch.getPosition("MIL="), "\t\t\t\t\tMIL=" + monarchEdit.mil); //reader.changeLine(baseLocMon + monarch.getPosition("dynasty="), "\t\t\t\t\tdynasty=\"" + monarchEdit.dynasty+"\""); //reader.changeLine(baseLocMon + monarch.getPosition("birth_date="), "\t\t\t\t\tbirth_date=" + monarchEdit.birthDate); if (repeatHeirs.Contains(monarchBox.SelectedIndex)) { int baseLocHeir = historyLoc + heirs[heirs.Length - 1 - repeatHeirs.IndexOf(monarchBox.SelectedIndex)]; heir = heirBlocks[repeatHeirs.IndexOf(monarchBox.SelectedIndex)]; reader.changeLine(baseLocHeir + heir.getPosition("name="), "\t\t\t\t\tname=\"" + monarchEdit.name + "\""); reader.changeLine(baseLocHeir + heir.getPosition("DIP="), "\t\t\t\t\tDIP=" + monarchEdit.dip); reader.changeLine(baseLocHeir + heir.getPosition("ADM="), "\t\t\t\t\tADM=" + monarchEdit.adm); reader.changeLine(baseLocHeir + heir.getPosition("MIL="), "\t\t\t\t\tMIL=" + monarchEdit.mil); //reader.changeLine(baseLocHeir + heir.getPosition("dynasty="), "\t\t\t\t\tdynasty=\"" + monarchEdit.dynasty + "\""); //reader.changeLine(baseLocHeir + heir.getPosition("birth_date="), "\t\t\t\t\tbirth_date=" + monarchEdit.birthDate); } initialize(); }
//Same as for monarchs above private void heirBox_MouseDoubleClick(object sender, MouseEventArgs e) { textBlock monarch = heirBlocks[heirBox.SelectedIndex]; monarchEditForm monarchEdit = new monarchEditForm(monarch); monarchEdit.ShowDialog(); int baseLocMon = historyLoc + heirs[uniqueHeirs[heirBox.SelectedIndex]]; reader.changeLine(baseLocMon + monarch.getPosition("name="), "\t\t\t\t\tname=" + monarchEdit.name); reader.changeLine(baseLocMon + monarch.getPosition("DIP="), "\t\t\t\t\tDIP=" + monarchEdit.dip); reader.changeLine(baseLocMon + monarch.getPosition("ADM="), "\t\t\t\t\tADM=" + monarchEdit.adm); reader.changeLine(baseLocMon + monarch.getPosition("MIL="), "\t\t\t\t\tMIL=" + monarchEdit.mil); //reader.changeLine(baseLocMon + monarch.getPosition("dynasty="), "\t\t\t\t\tdynasty=" + monarchEdit.dynasty); //reader.changeLine(baseLocMon + monarch.getPosition("birth_date="), "\t\t\t\t\tbirth_date=" + monarchEdit.birthDate); initialize(); }