public void button1_Click(object sender, EventArgs e) { string xml = Dades.dadesXMLPlanetesRegio(comboBox1.Text, regions, planetas); string path = Application.StartupPath + "\\XMLRegions\\" + comboBox1.Text + ".xml"; using (System.IO.StreamWriter sw = new System.IO.StreamWriter(path, false)) { sw.WriteLine(xml); } }
public void Form2_Load(object sender, EventArgs e) { directori = SolicitarDirectori(); if (directori != null) { using (System.IO.StreamReader sr = new System.IO.StreamReader(directori)) { regions = XML.obtenerDadesXML(sr, "regions", "Region", "nameRegion"); planetas = XML.obtenerDadesXML(sr, "planets", "planet", "name"); planetas = Dades.dadesTotalsPlanetes(planetas); foreach (string val in regions.Keys) { comboBox1.Items.Add(val); } } } }
private void button1_Click(object sender, EventArgs e) { SolicitarDirectori(); if (directori != null) { using (System.IO.StreamReader sr = new System.IO.StreamReader(directori)) { rutas = XML.obtenerDadesXML(sr, "hyperspaceRoutes", "Route", "nameRoute"); planetas = XML.obtenerDadesXML(sr, "planets", "planet", "name"); planetas = Dades.dadesTotalsPlanetes(planetas); foreach (string val in planetas.Keys) { comboBox1.Items.Add(val); } } } }
//COMBO BOX private void comboBox1_SelectedValueChanged(object sender, EventArgs e) { //BORRAR ABANS DE TORNAR A CARREGAR int i = 0; Dictionary <string, string> dadesPlaneta = planetas[comboBox1.Text]; string[][] dadesRuta = Dades.infoRutas(comboBox1.Text, planetas, rutas); dataGridView1.Rows.Clear(); foreach (string[] ruta in dadesRuta) { dataGridView1.Rows.Add(ruta); if (ruta[5].Equals("1")) { dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Green; dataGridView1.DefaultCellStyle.SelectionBackColor = Color.Green; } i++; } dataGridView1.ClearSelection(); dataGridView1.Refresh(); dataGridView1.Visible = true; panel1.Visible = true; panel2.Visible = true; panel3.Visible = true; Escriure esc1 = new Escriure(); Escriure esc2 = new Escriure(); Escriure esc3 = new Escriure(); Escriure esc4 = new Escriure(); Escriure esc5 = new Escriure(); Escriure esc6 = new Escriure(); Escriure esc7 = new Escriure(); Escriure esc8 = new Escriure(); esc8.path = dadesPlaneta["planetImage"]; esc8.pictbox = pictureBox1; Thread th_imagen = new Thread(new ThreadStart(esc8.canviImatge)); esc1.misatge = obtenirLletres(dadesPlaneta["sector"]); esc1.label = txb_sector; Thread th_sector = new Thread(new ThreadStart(esc1.EscriureFuncio)); esc2.misatge = obtenirLletres(dadesPlaneta["filiation"]); esc2.label = txb_nafiliacio; Thread th_filiation = new Thread(new ThreadStart(esc2.EscriureFuncio)); esc3.misatge = obtenirLletres(dadesPlaneta["lat"]); esc3.label = txb_latitud; Thread th_lat = new Thread(new ThreadStart(esc3.EscriureFuncio)); esc4.misatge = obtenirLletres(dadesPlaneta["long"]); esc4.label = txb_longitud; Thread th_long = new Thread(new ThreadStart(esc4.EscriureFuncio)); esc5.misatge = obtenirLletres(dadesPlaneta["parsecs"]); esc5.label = txb_parsecs; Thread th_parsecs = new Thread(new ThreadStart(esc5.EscriureFuncio)); esc6.misatge = obtenirLletres(dadesPlaneta["natives"]); esc6.label = txb_nativos; Thread th_natives = new Thread(new ThreadStart(esc6.EscriureFuncio)); esc7.misatge = obtenirLletres(dadesPlaneta["region"]); esc7.label = txb_regio; Thread th_region = new Thread(new ThreadStart(esc7.EscriureFuncio)); //COMPROVAR QUE ELS PLANETES NO ESTIGUIN DUPLICATS //COMPROVAR QUE LA IMATGE EXISTEIX th_imagen.Start(); th_imagen.Join(); th_sector.Start(); th_filiation.Start(); th_lat.Start(); th_long.Start(); th_parsecs.Start(); th_natives.Start(); th_region.Start(); Application.DoEvents(); th_sector.Join(); th_filiation.Join(); th_lat.Join(); th_long.Join(); th_parsecs.Join(); th_natives.Join(); th_region.Join(); }