コード例 #1
0
ファイル: WindowLevel3.cs プロジェクト: Galadrine/AppliMars
        // Fenetre Niveau 3 pour activité existante
        public WindowLevel3(Activite activite, Journee jour, WindowLevel2 win2)
            : this()
        {
            maFenetrePrec = win2;
            monActivite = activite;
            maJournee = jour;
            if (maJournee.monNumero < maFenetrePrec.maFenetrePrec.maMission.monJourJ) {
                DisableControls(this);
                EnableControls(buttonRetourJournee);
            }
            this.Text = maFenetrePrec.maFenetrePrec.maMission.monNomMission + " - Activité du jour " + maJournee.monNumero.ToString("D3");
            labelNumeroJour.Text = maJournee.monNumero.ToString("D3");
            affichage_treeView();
            tB_descrAct.Text = monActivite.maDescription;
            cb_HDebAct.Text = monActivite.monHeureDebut.ToString();
            cb_MDebAct.Text = monActivite.mesMinutesDebut.ToString();
            cb_HFinAct.Text = monActivite.monHeureFin.ToString();
            cb_MFinAct.Text = monActivite.mesMinutesFin.ToString();
            tB_nomLieu.Text = monActivite.monLieu.monNom.ToString();
            numUpDown_xAct.Text = monActivite.monLieu.maPosX.ToString();
            numUpDown_yAct.Text = monActivite.monLieu.maPosY.ToString();
            cB_localisation.Checked = monActivite.enExterieur;

            // Verrouillage des cases pour éviter les modfis
            cb_HDebAct.Enabled = false;
            cb_MDebAct.Enabled = false;
            cb_HFinAct.Enabled = false;
            cb_MFinAct.Enabled = false;
            tB_descrAct.ReadOnly = true;
            lB_listePart.Enabled = false;
            cB_localisation.Enabled = false;
            tB_nomLieu.ReadOnly = true;
            pictureBoxMap.Enabled = false;
            b_valider.Visible = false;
            b_supprimer.Visible = false;

            foreach (Astronaute a in maFenetrePrec.maFenetrePrec.maMission.mesAstronautes) {
                int indexLB = 0;
                lB_listePart.Items.Add(a.monNom);
                foreach (Astronaute ast in monActivite.mesAstronautes) {
                    if (ast.monNom == a.monNom) {
                        lB_listePart.SetSelected(indexLB, true);
                    }
                    indexLB++;
                }
            }

            if (maJournee.monNumero < maFenetrePrec.maFenetrePrec.maMission.monJourJ) {
                DisableControls(this);
                EnableControls(buttonRetourJournee);
                EnableControls(treeViewCategories);
            }
        }
コード例 #2
0
 private void listBoxNom_SelectedIndexChanged(object sender, EventArgs e)
 {
     int sel = Int32.Parse(listBoxNom.GetItemText(listBoxNom.SelectedIndex));
     if (sel >= 0) {
         buttonGoTo.Enabled = true;
         maJourneeSel = maListeRechercheJour_Nom[sel];
         monActiviteSel = maListeRechercheActivit_Nom[sel];
         listBoxDescription.ClearSelected();
         listBoxCompteRendu.ClearSelected();
     }
 }
コード例 #3
0
ファイル: WindowNewAct.cs プロジェクト: Galadrine/AppliMars
        private void b_creerNvAct_Click(object sender, EventArgs e)
        {
            string filePlanningName = maFenetrePrec.maFenetrePrec.maMission.monCheminPlanningXML;
            string fileGeneralName = maFenetrePrec.maFenetrePrec.maMission.monCheminGeneralXML;
            XDocument _planningXML = XDocument.Load(filePlanningName);
            XDocument _generalXML = XDocument.Load(fileGeneralName);
            var jourSel = (from jour in _planningXML.Descendants("Jour") where (string)jour.Attribute("id") == maJournee.monNumero.ToString() select jour).FirstOrDefault();
            var act = (from activites in _planningXML.Descendants("Activites") where (string)activites.Parent.Attribute("id") == maJournee.monNumero.ToString() select activites).FirstOrDefault();
            Journee journeeAModif = maFenetrePrec.maFenetrePrec.maMission.monPlanning.monTableauJournees[maJournee.monNumero - 1];

            int hDebNvAct = int.Parse(cb_HDebAct.Text);
            int mDebNvAct = int.Parse(cb_MDebAct.Text);
            int hFinNvAct = int.Parse(cb_HFinAct.Text);
            int mFinNvAct = int.Parse(cb_MFinAct.Text);

            string checkChevauchement = journeeAModif.checkChevauchement(hDebNvAct, mDebNvAct, hFinNvAct, mFinNvAct);

            if (checkChevauchement == "") {
                Activite activit;

                // Récupération de toutes les informations
                int xNvAct, yNvAct;
                string nomLieuNvAct;
                if (cB_localisation.Checked == true) {
                    xNvAct = int.Parse(numUpDown_xAct.Text);
                    yNvAct = int.Parse(numUpDown_xAct.Text);
                    nomLieuNvAct = textBoxNomLieu.Text;
                }else{
                    xNvAct = 0;
                    yNvAct = 0;
                    nomLieuNvAct = "Habitat";
                }
                bool extNvAct = cB_localisation.Checked;
                string descrNvAct = tB_descrAct.Text;
                if (descrNvAct.Length > 400) {
                    tB_descrAct.ForeColor = Color.Red;
                }

                // Echange si les horaires de début et de fin sont inversés
                if (hDebNvAct > hFinNvAct) {
                    int tmp = hFinNvAct;
                    hFinNvAct = hDebNvAct;
                    hDebNvAct = tmp;
                    tmp = mFinNvAct;
                    mFinNvAct = mDebNvAct;
                    mDebNvAct = tmp;
                }

                XElement parts = new XElement("Participants");
                List<Astronaute> partNvAct = new List<Astronaute>();
                foreach (string astro in lB_listePart.SelectedItems) {
                    partNvAct.Add(new Astronaute(astro));
                    parts.Add(new XElement("NomAct", astro));

                }

                string nomNvAct = treeViewCategories.SelectedNode.Text;

                // Si tout est ok flag == true, on peut créer la nouvelle activité
                activit = new Activite(nomNvAct, extNvAct, descrNvAct, hDebNvAct, mDebNvAct, hFinNvAct, mFinNvAct, partNvAct, nomLieuNvAct, xNvAct, yNvAct);

                 _jour.maListeActivites.Add(activit);

                 act.Add(new XElement("Activite",
                    new XAttribute("idAct", activit.monID.ToString()),
                    new XElement("NomAct", activit.monNom.ToString()),
                    new XElement("HDebutAct", activit.monHeureDebut.ToString()),
                    new XElement("MDebutAct", activit.mesMinutesDebut.ToString()),
                    new XElement("HFinAct", activit.monHeureFin.ToString()),
                    new XElement("MFinAct", activit.mesMinutesFin.ToString()),
                    new XElement("BoolExt", activit.enExterieur.ToString()),
                    new XElement("Lieu",
                        new XElement("nomLieu", activit.monLieu.monNom.ToString()),
                        new XElement("posX", activit.monLieu.maPosX.ToString()),
                        new XElement("posY", activit.monLieu.maPosY.ToString())),
                    new XElement("DescriptionAct", activit.maDescription.ToString()),
                    parts));

                _planningXML.Save(filePlanningName);

                this.Close();
                maFenetrePrec.Show();
                maFenetrePrec.insertionActivitesListBox();

            } else { // Il y a des chevauchements entre les activités
                MessageBox.Show(checkChevauchement,
                    "Insertion impossible");
            }
        }