Example #1
0
        /// <summary>
        /// Permet de générer la partie XML de l'Activite
        /// </summary>
        /// <param name="xmlDoc">XmlDocument global</param>
        /// <param name="xmlDocActs">XmlDocument pour les activités de base</param>
        /// <param name="journee">Le noeud de la journée</param>
        /// <param name="acts">Le noeud de l'activité (base)</param>
        /// <param name="progression">L'interface de progression</param>
        public void genererXML(XmlDocument xmlDoc, XmlDocument xmlDocActs, XmlNode journee, XmlNode acts, Progression progression)
        {
            XmlNode num = xmlDoc.CreateElement("Numero");

            num.InnerText = this.numero.ToString();
            journee.AppendChild(num);

            XmlNode etat = xmlDoc.CreateElement("Etat");

            etat.InnerText = this.etat.etat();
            journee.AppendChild(etat);

            XmlNode rapport = xmlDoc.CreateElement("Rapport");

            rapport.InnerText = this.rapport;
            journee.AppendChild(rapport);

            XmlNode activites = xmlDoc.CreateElement("Activites");

            journee.AppendChild(activites);

            foreach (Activite a in listeActivites)
            {
                XmlNode activite = xmlDoc.CreateElement("Activite");
                activites.AppendChild(activite);

                a.genererXML(xmlDoc, xmlDocActs, activite, acts, listeActivites, progression);
                progression.incrementer();
            }
        }
Example #2
0
        /// <summary>
        /// Permet de générer la partie XML de Astronaute
        /// </summary>
        /// <param name="xmlDoc">XmlDocument global</param>
        /// <param name="xmlDocActs">XmlDocument pour les activités de base</param>
        /// <param name="astronaute">Le noeud de l'astronaute</param>
        /// <param name="acts">Le noeud de l'activité (base)</param>
        /// <param name="progression">L'interface de progression</param>
        public void genererXML(XmlDocument xmlDoc, XmlDocument xmlDocActs, XmlNode astronaute, XmlNode acts, Progression progression)
        {
            XmlNode nom = xmlDoc.CreateElement("Nom");

            nom.InnerText = this.nom;
            astronaute.AppendChild(nom);

            XmlNode prenom = xmlDoc.CreateElement("Prenom");

            prenom.InnerText = this.prenom;
            astronaute.AppendChild(prenom);

            XmlNode age = xmlDoc.CreateElement("Age");

            age.InnerText = this.age.ToString();
            astronaute.AppendChild(age);

            XmlNode journees = xmlDoc.CreateElement("JourneesMission");

            astronaute.AppendChild(journees);

            for (int i = 1; i <= journeesMission.Count; ++i)
            {
                XmlNode journee = xmlDoc.CreateElement("Journee");
                journees.AppendChild(journee);

                journeesMission[i].genererXML(xmlDoc, xmlDocActs, journee, acts, progression);
                progression.incrementer();
            }
        }
        /// <summary>
        /// Permet de charger les données depuis un fichier XML
        /// </summary>
        /// <param name="marsOMatic">Le fichier XML Mars-o-Matic</param>
        /// <param name="activitesRefs">Le fichier XML ActivitesRefs associé au fichier précédent</param>
        private void chargerXml(String marsOMatic, String activitesRefs)
        {
            XmlDocument mars = new XmlDocument();

            mars.Load(marsOMatic);
            XmlDocument acts = new XmlDocument();

            acts.Load(activitesRefs);

            Dictionary <int, Activite> activitesBase = new Dictionary <int, Activite>();

            int nbElements = int.Parse(mars.SelectSingleNode("Donnees").SelectSingleNode("NbElements").InnerText);

            Progression p = new Progression(nbElements);

            p.Show();

            /* Chargement données des activités de base */
            XmlNodeList activites = acts.GetElementsByTagName("Activite");

            foreach (XmlNode n in activites)
            {
                Activite a;

                int          num         = int.Parse(n.SelectSingleNode("Numero").InnerText);
                bool         exterieure  = bool.Parse(n.SelectSingleNode("Exterieure").InnerText);
                bool         exploration = bool.Parse(n.SelectSingleNode("Exploration").InnerText);
                TypeActivite ta          = new TypeActivite(n.SelectSingleNode("TypeActivite").SelectSingleNode("Nom").InnerText);

                if (exterieure)
                {
                    if (exploration)
                    {
                        a = new ExplorationExterieure(ta, "", null, null, null, null);
                    }
                    else
                    {
                        a = new ExperienceExterieure(ta, "", null, null, null, null);
                    }
                }
                else
                {
                    a = new Activite(ta);
                }

                activitesBase.Add(num, a);

                p.incrementer();
            }

            /* Chargement données */
            int jour     = int.Parse(mars.SelectSingleNode("Donnees").SelectSingleNode("DebutMission").SelectSingleNode("Jour").InnerText);
            int mois     = int.Parse(mars.SelectSingleNode("Donnees").SelectSingleNode("DebutMission").SelectSingleNode("Mois").InnerText);
            int annee    = int.Parse(mars.SelectSingleNode("Donnees").SelectSingleNode("DebutMission").SelectSingleNode("Annee").InnerText);
            int heures   = int.Parse(mars.SelectSingleNode("Donnees").SelectSingleNode("DebutMission").SelectSingleNode("Heures").InnerText);
            int minutes  = int.Parse(mars.SelectSingleNode("Donnees").SelectSingleNode("DebutMission").SelectSingleNode("Minutes").InnerText);
            int secondes = int.Parse(mars.SelectSingleNode("Donnees").SelectSingleNode("DebutMission").SelectSingleNode("Secondes").InnerText);

            this.debutMission = new DateTime(annee, mois, jour, heures, minutes, secondes);

            TimeMartien nb      = TimeMartien.calculerJours(debutMission);
            int         numJour = nb.getJours() + 1;

            if (numJour > 500)
            {
                numJour = 500;
            }

            XmlNodeList astronautesNodes = mars.GetElementsByTagName("Astronaute");

            foreach (XmlNode n in astronautesNodes)
            {
                String nom    = n.SelectSingleNode("Nom").InnerText;
                String prenom = n.SelectSingleNode("Prenom").InnerText;
                int    age    = int.Parse(n.SelectSingleNode("Age").InnerText);

                Astronaute a = new Astronaute(nom, prenom, age);

                Dictionary <int, Journee> joursMission = new Dictionary <int, Journee>();
                a.setJourneesMission(joursMission);

                astronautes.Add(a);
                a.getJourneesMission().Clear();
                astroList.Items.Add(a); // Ajout dans la liste => interface

                XmlNodeList missionNode = n.SelectSingleNode("JourneesMission").SelectNodes("Journee");

                foreach (XmlNode nn in missionNode)
                {
                    int    num         = int.Parse(nn.SelectSingleNode("Numero").InnerText);
                    String etat        = nn.SelectSingleNode("Etat").InnerText;
                    IEtat  etatJournee = new Passe();

                    if (etat.Equals("EnCours"))
                    {
                        etatJournee = new EnCours();
                    }
                    else if (etat.Equals("Futur"))
                    {
                        etatJournee = new Futur();
                    }

                    String rapport = nn.SelectSingleNode("Rapport").InnerText;

                    Journee j = new Journee(num, rapport, etatJournee, false);
                    j.getActivites().Clear();
                    joursMission.Add(num, j);

                    XmlNodeList activitesNode = nn.SelectSingleNode("Activites").SelectNodes("Activite");

                    foreach (XmlNode nnn in activitesNode)
                    {
                        int        numA         = int.Parse(nnn.SelectSingleNode("Numero").InnerText);
                        String     transport    = nnn.SelectSingleNode("Transport").InnerText;
                        ITransport transportAct = null;

                        if (transport.Equals("Scaphandre"))
                        {
                            transportAct = new Scaphandre();
                        }
                        else if (transport.Equals("Vehicule"))
                        {
                            transportAct = new Vehicule();
                        }

                        String description = nnn.SelectSingleNode("Description").InnerText;
                        etat = nnn.SelectSingleNode("Etat").InnerText;
                        IEtat etatAct = new Passe();

                        if (etat.Equals("EnCours"))
                        {
                            etatAct = new EnCours();
                        }
                        else if (etat.Equals("Futur"))
                        {
                            etatAct = new Futur();
                        }

                        int mD = int.Parse(nnn.SelectSingleNode("HeureDebut").InnerText);

                        int mF = int.Parse(nnn.SelectSingleNode("HeureFin").InnerText);

                        String xy = nnn.SelectSingleNode("XY").InnerText;
                        int    x  = int.Parse(xy.Split(',')[0]);
                        int    y  = int.Parse(xy.Split(',')[1]);

                        Lieu l = new Lieu(x, y);

                        Activite aBase = activitesBase[numA];
                        Activite act;

                        if (aBase.isActiviteExterieure())
                        {
                            if (aBase.isExperience())
                            {
                                act = new ExperienceExterieure(aBase.getTypeActivite(), description, new TimeMartien(0, 0, mD, 0), new TimeMartien(0, 0, mF, 0), l, transportAct);
                            }
                            else
                            {
                                act = new ExplorationExterieure(aBase.getTypeActivite(), description, new TimeMartien(0, 0, mD, 0), new TimeMartien(0, 0, mF, 0), l, transportAct);
                            }
                        }
                        else
                        {
                            act = new Activite(aBase.getTypeActivite(), description, new TimeMartien(0, 0, mD, 0), new TimeMartien(0, 0, mF, 0), l);
                        }


                        act.setDescription(description);

                        act.setEtat(etatAct);

                        j.ajouterActivite(act);

                        p.incrementer();
                    }
                    p.incrementer();
                }
                p.incrementer();
            }

            initialisationInterface();

            astronauteSelectionne = astronautes[0];
            journeesMission       = astronauteSelectionne.getJourneesMission();
            journeeActuelle       = journeesMission[numJour];

            modificationJourneeActuelle(numJour);

            changerPeriode(periode);
            verificationChangementPeriode();
            mettreAJourHeures();
            miseAJourEdt(journeesMission[journeeSelectionnee]);

            descriptionTexte.Text  = journeesMission[journeeSelectionnee].getDescription();
            astroList.SelectedItem = astronauteSelectionne;

            p.fermerFenetre();
        }
        /// <summary>
        /// Permet de générer les fichiers XML
        /// </summary>
        private void genererDocXML()
        {
            int nbElements = this.astronautes.Count;

            foreach (Astronaute a in this.astronautes)
            {
                a.nbJournees(ref nbElements);
            }

            nbElements += CalendrierMission.domaines.Count;
            foreach (Domaine d in CalendrierMission.domaines)
            {
                d.nbTypeActivite(ref nbElements);
            }

            Progression progression = new Progression(nbElements);

            progression.Show();

            XmlDocument xmlDoc     = new XmlDocument();
            XmlDocument xmlDocActs = new XmlDocument();

            XmlNode donnees = xmlDoc.CreateElement("Donnees");

            xmlDoc.AppendChild(donnees);

            XmlNode acts = xmlDocActs.CreateElement("Activites");

            xmlDocActs.AppendChild(acts);

            XmlNode debutMission = xmlDoc.CreateElement("DebutMission");

            donnees.AppendChild(debutMission);

            XmlNode jour     = xmlDoc.CreateElement("Jour");
            XmlNode mois     = xmlDoc.CreateElement("Mois");
            XmlNode annee    = xmlDoc.CreateElement("Annee");
            XmlNode heures   = xmlDoc.CreateElement("Heures");
            XmlNode minutes  = xmlDoc.CreateElement("Minutes");
            XmlNode secondes = xmlDoc.CreateElement("Secondes");

            debutMission.AppendChild(jour);
            debutMission.AppendChild(mois);
            debutMission.AppendChild(annee);
            debutMission.AppendChild(heures);
            debutMission.AppendChild(minutes);
            debutMission.AppendChild(secondes);

            jour.InnerText     = this.debutMission.Day.ToString();
            mois.InnerText     = this.debutMission.Month.ToString();
            annee.InnerText    = this.debutMission.Year.ToString();
            heures.InnerText   = this.debutMission.Hour.ToString();
            minutes.InnerText  = this.debutMission.Minute.ToString();
            secondes.InnerText = this.debutMission.Second.ToString();

            XmlNode nbE = xmlDoc.CreateElement("NbElements");

            donnees.AppendChild(nbE);
            nbE.InnerText = nbElements.ToString();

            XmlNode astronautes = xmlDoc.CreateElement("Astronautes");

            donnees.AppendChild(astronautes);

            foreach (Astronaute a in this.astronautes)
            {
                XmlNode astronaute = xmlDoc.CreateElement("Astronaute");
                astronautes.AppendChild(astronaute);
                a.genererXML(xmlDoc, xmlDocActs, astronaute, acts, progression);
                progression.incrementer();
            }

            if (!System.IO.Directory.Exists("Donnees"))
            {
                System.IO.Directory.CreateDirectory("Donnees");
            }

            XmlDocument xmlDocDom = new XmlDocument();
            XmlNode     domaines  = xmlDocDom.CreateElement("Domaines");

            xmlDocDom.AppendChild(domaines);

            foreach (Domaine d in CalendrierMission.domaines)
            {
                XmlNode domaine = xmlDocDom.CreateElement("Domaine");
                domaines.AppendChild(domaine);

                XmlNode nomD = xmlDocDom.CreateElement("NomDom");
                domaine.AppendChild(nomD);
                nomD.InnerText = d.getNom();

                XmlNode couleur = xmlDocDom.CreateElement("Couleur");
                domaine.AppendChild(couleur);

                XmlNode r = xmlDocDom.CreateElement("R");
                couleur.AppendChild(r);
                r.InnerText = d.getCouleur()[0].ToString();

                XmlNode g = xmlDocDom.CreateElement("G");
                couleur.AppendChild(g);
                g.InnerText = d.getCouleur()[1].ToString();

                XmlNode b = xmlDocDom.CreateElement("B");
                couleur.AppendChild(b);
                b.InnerText = d.getCouleur()[2].ToString();

                XmlNode typeActivite = xmlDocDom.CreateElement("TypeActivite");
                domaine.AppendChild(typeActivite);

                foreach (TypeActivite ta in d.getActivites())
                {
                    XmlNode nomType = xmlDocDom.CreateElement("NomTA");
                    typeActivite.AppendChild(nomType);
                    nomType.InnerText = ta.getNom();
                    progression.incrementer();
                }

                progression.incrementer();
            }

            xmlDocDom.Save("Donnees/Domaines.xml");
            xmlDoc.Save("Donnees/Mars-o-Matic_" + this.debutMission.Day + "_" + this.debutMission.Month + "_" + this.debutMission.Year + ".xml");
            xmlDocActs.Save("Donnees/ActivitesRefs_" + this.debutMission.Day + "_" + this.debutMission.Month + "_" + this.debutMission.Year + ".xml");
            progression.fermerFenetre();
        }
        /// <summary>
        /// Permet de générer les fichiers XML
        /// </summary>
        private void genererDocXML()
        {
            int nbElements = this.astronautes.Count;
            foreach (Astronaute a in this.astronautes)
                a.nbJournees(ref nbElements);

            nbElements += CalendrierMission.domaines.Count;
            foreach (Domaine d in CalendrierMission.domaines)
                d.nbTypeActivite(ref nbElements);

            Progression progression = new Progression(nbElements);
            progression.Show();

            XmlDocument xmlDoc = new XmlDocument();
            XmlDocument xmlDocActs = new XmlDocument();

            XmlNode donnees = xmlDoc.CreateElement("Donnees");
            xmlDoc.AppendChild(donnees);

            XmlNode acts = xmlDocActs.CreateElement("Activites");
            xmlDocActs.AppendChild(acts);

            XmlNode debutMission = xmlDoc.CreateElement("DebutMission");
            donnees.AppendChild(debutMission);

            XmlNode jour = xmlDoc.CreateElement("Jour");
            XmlNode mois = xmlDoc.CreateElement("Mois");
            XmlNode annee = xmlDoc.CreateElement("Annee");
            XmlNode heures = xmlDoc.CreateElement("Heures");
            XmlNode minutes = xmlDoc.CreateElement("Minutes");
            XmlNode secondes = xmlDoc.CreateElement("Secondes");

            debutMission.AppendChild(jour);
            debutMission.AppendChild(mois);
            debutMission.AppendChild(annee);
            debutMission.AppendChild(heures);
            debutMission.AppendChild(minutes);
            debutMission.AppendChild(secondes);

            jour.InnerText = this.debutMission.Day.ToString();
            mois.InnerText = this.debutMission.Month.ToString();
            annee.InnerText = this.debutMission.Year.ToString();
            heures.InnerText = this.debutMission.Hour.ToString();
            minutes.InnerText = this.debutMission.Minute.ToString();
            secondes.InnerText = this.debutMission.Second.ToString();

            XmlNode nbE = xmlDoc.CreateElement("NbElements");
            donnees.AppendChild(nbE);
            nbE.InnerText = nbElements.ToString();

            XmlNode astronautes = xmlDoc.CreateElement("Astronautes");
            donnees.AppendChild(astronautes);

            foreach (Astronaute a in this.astronautes)
            {
                XmlNode astronaute = xmlDoc.CreateElement("Astronaute");
                astronautes.AppendChild(astronaute);
                a.genererXML(xmlDoc, xmlDocActs, astronaute, acts, progression);
                progression.incrementer();
            }

            if (!System.IO.Directory.Exists("Donnees"))
                System.IO.Directory.CreateDirectory("Donnees");

            XmlDocument xmlDocDom = new XmlDocument();
            XmlNode domaines = xmlDocDom.CreateElement("Domaines");
            xmlDocDom.AppendChild(domaines);

            foreach (Domaine d in CalendrierMission.domaines)
            {
                XmlNode domaine = xmlDocDom.CreateElement("Domaine");
                domaines.AppendChild(domaine);

                XmlNode nomD = xmlDocDom.CreateElement("NomDom");
                domaine.AppendChild(nomD);
                nomD.InnerText = d.getNom();

                XmlNode couleur = xmlDocDom.CreateElement("Couleur");
                domaine.AppendChild(couleur);

                XmlNode r = xmlDocDom.CreateElement("R");
                couleur.AppendChild(r);
                r.InnerText = d.getCouleur()[0].ToString();

                XmlNode g = xmlDocDom.CreateElement("G");
                couleur.AppendChild(g);
                g.InnerText = d.getCouleur()[1].ToString();

                XmlNode b = xmlDocDom.CreateElement("B");
                couleur.AppendChild(b);
                b.InnerText = d.getCouleur()[2].ToString();

                XmlNode typeActivite = xmlDocDom.CreateElement("TypeActivite");
                domaine.AppendChild(typeActivite);

                foreach (TypeActivite ta in d.getActivites())
                {
                    XmlNode nomType = xmlDocDom.CreateElement("NomTA");
                    typeActivite.AppendChild(nomType);
                    nomType.InnerText = ta.getNom();
                    progression.incrementer();
                }

                progression.incrementer();
            }

            xmlDocDom.Save("Donnees/Domaines.xml");
            xmlDoc.Save("Donnees/Mars-o-Matic_" + this.debutMission.Day + "_" + this.debutMission.Month + "_" + this.debutMission.Year + ".xml");
            xmlDocActs.Save("Donnees/ActivitesRefs_" + this.debutMission.Day + "_" + this.debutMission.Month + "_" + this.debutMission.Year + ".xml");
            progression.fermerFenetre();
        }
        /// <summary>
        /// Permet de charger les données depuis un fichier XML
        /// </summary>
        /// <param name="marsOMatic">Le fichier XML Mars-o-Matic</param>
        /// <param name="activitesRefs">Le fichier XML ActivitesRefs associé au fichier précédent</param>
        private void chargerXml(String marsOMatic, String activitesRefs)
        {
            XmlDocument mars = new XmlDocument();
            mars.Load(marsOMatic);
            XmlDocument acts = new XmlDocument();
            acts.Load(activitesRefs);

            Dictionary<int, Activite> activitesBase = new Dictionary<int, Activite>();

            int nbElements = int.Parse(mars.SelectSingleNode("Donnees").SelectSingleNode("NbElements").InnerText);

            Progression p = new Progression(nbElements);
            p.Show();

            /* Chargement données des activités de base */
            XmlNodeList activites = acts.GetElementsByTagName("Activite");

            foreach (XmlNode n in activites)
            {
                Activite a;

                int num = int.Parse(n.SelectSingleNode("Numero").InnerText);
                bool exterieure = bool.Parse(n.SelectSingleNode("Exterieure").InnerText);
                bool exploration = bool.Parse(n.SelectSingleNode("Exploration").InnerText);
                TypeActivite ta = new TypeActivite(n.SelectSingleNode("TypeActivite").SelectSingleNode("Nom").InnerText);

                if (exterieure)
                    if (exploration)
                        a = new ExplorationExterieure(ta, "", null, null, null, null);
                    else
                        a = new ExperienceExterieure(ta, "", null, null, null, null);
                else
                    a = new Activite(ta);

                activitesBase.Add(num, a);

                p.incrementer();
            }

            /* Chargement données */
            int jour = int.Parse(mars.SelectSingleNode("Donnees").SelectSingleNode("DebutMission").SelectSingleNode("Jour").InnerText);
            int mois = int.Parse(mars.SelectSingleNode("Donnees").SelectSingleNode("DebutMission").SelectSingleNode("Mois").InnerText);
            int annee = int.Parse(mars.SelectSingleNode("Donnees").SelectSingleNode("DebutMission").SelectSingleNode("Annee").InnerText);
            int heures = int.Parse(mars.SelectSingleNode("Donnees").SelectSingleNode("DebutMission").SelectSingleNode("Heures").InnerText);
            int minutes = int.Parse(mars.SelectSingleNode("Donnees").SelectSingleNode("DebutMission").SelectSingleNode("Minutes").InnerText);
            int secondes = int.Parse(mars.SelectSingleNode("Donnees").SelectSingleNode("DebutMission").SelectSingleNode("Secondes").InnerText);

            this.debutMission = new DateTime(annee, mois, jour, heures, minutes, secondes);

            TimeMartien nb = TimeMartien.calculerJours(debutMission);
            int numJour = nb.getJours() + 1;

            if (numJour > 500)
                numJour = 500;

            XmlNodeList astronautesNodes = mars.GetElementsByTagName("Astronaute");

            foreach (XmlNode n in astronautesNodes)
            {
                String nom = n.SelectSingleNode("Nom").InnerText;
                String prenom = n.SelectSingleNode("Prenom").InnerText;
                int age = int.Parse(n.SelectSingleNode("Age").InnerText);

                Astronaute a = new Astronaute(nom, prenom, age);

                Dictionary<int, Journee> joursMission = new Dictionary<int, Journee>();
                a.setJourneesMission(joursMission);

                astronautes.Add(a);
                a.getJourneesMission().Clear();
                astroList.Items.Add(a); // Ajout dans la liste => interface

                XmlNodeList missionNode = n.SelectSingleNode("JourneesMission").SelectNodes("Journee");

                foreach (XmlNode nn in missionNode)
                {
                    int num = int.Parse(nn.SelectSingleNode("Numero").InnerText);
                    String etat = nn.SelectSingleNode("Etat").InnerText;
                    IEtat etatJournee = new Passe();

                    if (etat.Equals("EnCours"))
                        etatJournee = new EnCours();
                    else if (etat.Equals("Futur"))
                        etatJournee = new Futur();

                    String rapport = nn.SelectSingleNode("Rapport").InnerText;

                    Journee j = new Journee(num, rapport, etatJournee, false);
                    j.getActivites().Clear();
                    joursMission.Add(num, j);

                    XmlNodeList activitesNode = nn.SelectSingleNode("Activites").SelectNodes("Activite");

                    foreach (XmlNode nnn in activitesNode)
                    {
                        int numA = int.Parse(nnn.SelectSingleNode("Numero").InnerText);
                        String transport = nnn.SelectSingleNode("Transport").InnerText;
                        ITransport transportAct = null;

                        if (transport.Equals("Scaphandre"))
                            transportAct = new Scaphandre();
                        else if (transport.Equals("Vehicule"))
                            transportAct = new Vehicule();

                        String description = nnn.SelectSingleNode("Description").InnerText;
                        etat = nnn.SelectSingleNode("Etat").InnerText;
                        IEtat etatAct = new Passe();

                        if (etat.Equals("EnCours"))
                            etatAct = new EnCours();
                        else if (etat.Equals("Futur"))
                            etatAct = new Futur();

                        int mD = int.Parse(nnn.SelectSingleNode("HeureDebut").InnerText);

                        int mF = int.Parse(nnn.SelectSingleNode("HeureFin").InnerText);

                        String xy = nnn.SelectSingleNode("XY").InnerText;
                        int x = int.Parse(xy.Split(',')[0]);
                        int y = int.Parse(xy.Split(',')[1]);

                        Lieu l = new Lieu(x, y);

                        Activite aBase = activitesBase[numA];
                        Activite act;

                        if (aBase.isActiviteExterieure())
                            if (aBase.isExperience())
                                act = new ExperienceExterieure(aBase.getTypeActivite(), description, new TimeMartien(0, 0, mD, 0), new TimeMartien(0, 0, mF, 0), l, transportAct);
                            else
                                act = new ExplorationExterieure(aBase.getTypeActivite(), description, new TimeMartien(0, 0, mD, 0), new TimeMartien(0, 0, mF, 0), l, transportAct);
                        else
                            act = new Activite(aBase.getTypeActivite(), description, new TimeMartien(0, 0, mD, 0), new TimeMartien(0, 0, mF, 0), l);

                        act.setDescription(description);

                        act.setEtat(etatAct);

                        j.ajouterActivite(act);

                        p.incrementer();
                    }
                    p.incrementer();
                }
                p.incrementer();
            }

            initialisationInterface();

            astronauteSelectionne = astronautes[0];
            journeesMission = astronauteSelectionne.getJourneesMission();
            journeeActuelle = journeesMission[numJour];

            modificationJourneeActuelle(numJour);

            changerPeriode(periode);
            verificationChangementPeriode();
            mettreAJourHeures();
            miseAJourEdt(journeesMission[journeeSelectionnee]);

            descriptionTexte.Text = journeesMission[journeeSelectionnee].getDescription();
            astroList.SelectedItem = astronauteSelectionne;

            p.fermerFenetre();
        }
Example #7
0
        /// <summary>
        /// Permet de générer la partie XML de Astronaute
        /// </summary>
        /// <param name="xmlDoc">XmlDocument global</param>
        /// <param name="xmlDocActs">XmlDocument pour les activités de base</param>
        /// <param name="astronaute">Le noeud de l'astronaute</param>
        /// <param name="acts">Le noeud de l'activité (base)</param>
        /// <param name="progression">L'interface de progression</param>
        public void genererXML(XmlDocument xmlDoc, XmlDocument xmlDocActs, XmlNode astronaute, XmlNode acts, Progression progression)
        {
            XmlNode nom = xmlDoc.CreateElement("Nom");
            nom.InnerText = this.nom;
            astronaute.AppendChild(nom);

            XmlNode prenom = xmlDoc.CreateElement("Prenom");
            prenom.InnerText = this.prenom;
            astronaute.AppendChild(prenom);

            XmlNode age = xmlDoc.CreateElement("Age");
            age.InnerText = this.age.ToString();
            astronaute.AppendChild(age);

            XmlNode journees = xmlDoc.CreateElement("JourneesMission");
            astronaute.AppendChild(journees);

            for (int i = 1; i <= journeesMission.Count; ++i)
            {
                XmlNode journee = xmlDoc.CreateElement("Journee");
                journees.AppendChild(journee);

                journeesMission[i].genererXML(xmlDoc, xmlDocActs, journee, acts, progression);
                progression.incrementer();
            }
        }
Example #8
0
        /// <summary>
        /// Permet de générer la partie XML de l'Activite
        /// </summary>
        /// <param name="xmlDoc">XmlDocument global</param>
        /// <param name="xmlDocActs">XmlDocument pour les activités de base</param>
        /// <param name="journee">Le noeud de la journée</param>
        /// <param name="acts">Le noeud de l'activité (base)</param>
        /// <param name="progression">L'interface de progression</param>
        public void genererXML(XmlDocument xmlDoc, XmlDocument xmlDocActs, XmlNode journee, XmlNode acts, Progression progression)
        {
            XmlNode num = xmlDoc.CreateElement("Numero");
            num.InnerText = this.numero.ToString();
            journee.AppendChild(num);

            XmlNode etat = xmlDoc.CreateElement("Etat");
            etat.InnerText = this.etat.etat();
            journee.AppendChild(etat);

            XmlNode rapport = xmlDoc.CreateElement("Rapport");
            rapport.InnerText = this.rapport;
            journee.AppendChild(rapport);

            XmlNode activites = xmlDoc.CreateElement("Activites");
            journee.AppendChild(activites);

            foreach (Activite a in listeActivites)
            {
                XmlNode activite = xmlDoc.CreateElement("Activite");
                activites.AppendChild(activite);

                a.genererXML(xmlDoc, xmlDocActs, activite, acts, listeActivites, progression);
                progression.incrementer();
            }
        }