示例#1
0
 private void button1_Click(object sender, EventArgs e)
 {
     SolicitarDirectori();
     if (directori != null)
     {
         using (System.IO.StreamReader sr = new System.IO.StreamReader(directori))
         {
             try
             {
                 rutas    = XML.obtenerDadesXML(sr, "hyperspaceRoutes", "Route", "nameRoute");
                 planetas = XML.obtenerDadesXML(sr, "planets", "planet", "name");
                 planetas = Dades.dadesTotalsPlanetes(planetas);
                 sr.Close();
             }
             catch (FileNotFoundException exc)
             {
                 MessageBox.Show("S'ha perdut la conexió amb l'arxiu");
                 Close();
             }
             cbx_planetes.Items.Clear();
             foreach (string val in planetas.Keys)
             {
                 cbx_planetes.Items.Add(val);
             }
         }
     }
 }
示例#2
0
        public void btn_guardarXML_Click(object sender, EventArgs e)
        {
            string xml = Dades.dadesXMLPlanetesRegio(cbx_regions.Text, regions, planetas);

            path = Application.StartupPath + "\\XMLRegions\\" + cbx_regions.Text + ".xml";
            using (System.IO.StreamWriter sw = new System.IO.StreamWriter(path, false))
            {
                sw.WriteLine(xml);
            }
        }
示例#3
0
        public void button1_Click(object sender, EventArgs e)
        {
            string xml  = Dades.dadesXMLPlanetesRegio(comboBox1.Text, regions, planetas);
            string path = @"E:\\Planetes\\" + comboBox1.Text + ".xml";

            using (System.IO.StreamWriter sw = new System.IO.StreamWriter(path, false))
            {
                sw.WriteLine(xml);
            }
        }
示例#4
0
        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);
                    }
                }
            }
        }
示例#5
0
        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);
                    }
                }
            }
        }
示例#6
0
        //COMBO BOX
        private void comboBox1_SelectedValueChanged(object sender, EventArgs e)
        {
            //BORRAR ABANS DE TORNAR A CARREGAR
            int i = 0;
            Dictionary <string, string> dadesPlaneta = planetas[cbx_planetes.Text];

            string[][] dadesRuta = Dades.infoRutas(cbx_planetes.Text, planetas, rutas);
            dgv_rutes.Rows.Clear();
            foreach (string[] ruta in dadesRuta)
            {
                dgv_rutes.Rows.Add(ruta);
                if (ruta[5].Equals("1"))
                {
                    dgv_rutes.Rows[i].DefaultCellStyle.BackColor  = Color.Green;
                    dgv_rutes.DefaultCellStyle.SelectionBackColor = Color.Green;
                }
                i++;
            }
            dgv_rutes.ClearSelection();
            dgv_rutes.Refresh();
            dgv_rutes.Visible       = true;
            pnl_imagen.Visible      = true;
            pnl_info.Visible        = true;
            pnl_coordenades.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 = pbx_imatge;
            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();
        }
示例#7
0
 private void OmplirDiccionaris(System.IO.StreamReader sr)
 {
     regions  = XML.obtenerDadesXML(sr, "regions", "Region", "nameRegion");
     planetas = XML.obtenerDadesXML(sr, "planets", "planet", "name");
     planetas = Dades.dadesTotalsPlanetes(planetas);
 }