private void saveToolStripMenuItem_Click(object sender, EventArgs e) { for (int i = 0; i < Prizes.Count; i++) { if ((Prizes[i].Text != "0") && (Prizes[i].Text != "")) { (Prizes[i].Tag as TreePosition).prize = Prizes[i].Text; } } List <List <string> > Parameters = new List <List <string> >(); for (int i = 0; i < Information.AP_Names.Count; i++) { Parameters.Add(new List <string>()); Parameters[i].Add(Information.AP_Names[i]); Parameters[i].Add(Information.AP_KeyLetters[i]); //Parameters[i].Add(BG.gp.AdParamValues[i]); } Graphic_Interface.SimpleTreeFileManagement STFM = new Graphic_Interface.SimpleTreeFileManagement (saveFileDialog1, buttons, Tree, Name1, Name2, Parameters); STFM.WriteFile(); }
public void openToolStripMenuItem_Click(object sender, EventArgs e) { bool manualy; if (sender is ToolStripDropDownItem) { manualy = true; } else { manualy = false; openFileDialog1.FileName = "C:\\Users\\Nick\\Desktop\\Diploma\\Tree.txt"; } Graphic_Interface.SimpleTreeFileManagement STFM = new Graphic_Interface.SimpleTreeFileManagement(openFileDialog1); if (STFM.OpenFile(manualy)) { ChopOldTree(); buttons = STFM.GetButtons(); Tree = STFM.GetTree(); string Names = STFM.GetNames(); Name1 = Names.Substring(0, Graphic_Interface.Analyzer.FindSeparator(Names, '+')); Name2 = Names.Substring(Graphic_Interface.Analyzer.FindSeparator(Names, '+') + 1); List <List <string> > Parameters = STFM.GetParameters(); BG.gp.AdParamValues.Clear(); for (int i = 0; i < Parameters.Count; i++) { bool found = false; for (int j = 0; j < Information.AP_Names.Count; j++) { if (Information.AP_Names[j] == Parameters[i][0]) { found = true; break; } } if (!found) { Information.AP_Names.Add(Parameters[i][0]); Information.AP_KeyLetters.Add(Parameters[i][1]); Information.AP_InitialValues.Add(new List <double>()); for (int j = 0; j < Information.AP_InitialValues.Count; j++) { Information.AP_InitialValues.Last().Add(0); } } //BG.gp.AdParamValues.Add(Parameters[i][2]); } for (int i = 0; i < buttons.Count; i++) { for (int j = 0; j < buttons[i].Count; j++) { CurrentButton = buttons[i][j]; ButtonsProperties(buttons[i][j], buttonssize, i); buttons[i][j].Text = WriteWordInFewLines(buttons[i][j].Text); } } AlphabetLetterIndex = Tree.Count; DrawButtons(); CorrectPictureBoxSize(); ClearScreen(); DrawLines(); DrawPrizes(); DrawPlayersPanel(); if (BG.gp.AdParamValues.Count > 0) { viewToolStripMenuItem_Click(this, new EventArgs()); } } }