示例#1
0
 private Image ActImage(ActJour A, Jour J)
 {
     string ch = "ok";
     foreach(string s in A.Act.Parents)
     {
         ch += s + "//";
     }
     Debug.WriteLine(ch);
     if(J.Num<_jourActu.Num)
     {
         if (A.Act.Parents.Contains("Living"))
             return Image.FromFile("images/filledBleu.png");
         else if (A.Act.Parents.Contains("Science"))
             return Image.FromFile("images/filledOrange.png");
         else if (A.Act.Parents.Contains("Maintenance"))
             return Image.FromFile("images/filledMarron.png");
         else if (A.Act.Parents.Contains("Communication"))
             return Image.FromFile("images/filledRouge.png");
         else if (A.Act.Parents.Contains("Repair"))
             return Image.FromFile("images/filledJaune.png");
         else
             return Image.FromFile("images/filledVert.png");
     }
     else
     {
         if (A.Act.Parents.Contains("Living"))
             return Image.FromFile("images/shapeBleu.png");
         else if (A.Act.Parents.Contains("Science"))
             return Image.FromFile("images/shapeOrange.png");
         else if (A.Act.Parents.Contains("Maintenance"))
             return Image.FromFile("images/shapeMarron.png");
         else if (A.Act.Parents.Contains("Communication"))
             return Image.FromFile("images/shapeRouge.png");
         else if (A.Act.Parents.Contains("Repair"))
             return Image.FromFile("images/shapeJaune.png");
         else
             return Image.FromFile("images/shapeVert.png");
     }
 }
示例#2
0
        public void InitXml()
        {
            string[] tabFiles;
            string chemin;
            bool present = false;
            chemin = Directory.GetCurrentDirectory();
            tabFiles = Directory.GetFiles(chemin, "*.xml");

            foreach (string X in tabFiles)
            {
                if (Path.GetFileName(X) == "calendrier.xml")
                    present = true;
            }
            if (present)
            {
                _docXml = XDocument.Load("calendrier.xml");
                ChargeEdtXml();
            }
            else
            {
                _docXml = new XDocument(_calendrierXml);
                int i = 1;

                while (i <= 500)
                {
                    Jour J = new Jour(i, _docXml);
                    Activite Sleep = null;
                    Activite Eat = null;
                    Activite Private = null;

                    foreach (Activite A in _list_Act)
                    {
                        if (A.Nom == "Sleeping")
                            Sleep = A;
                        else if (A.Nom == "Eating")
                            Eat = A;
                        else if (A.Nom == "Private")
                            Private = A;
                    }
                    J.addAct(Sleep, _list_Astro, 0, 0, 7, 0, 0, 0, "");
                    J.addAct(Sleep, _list_Astro, 23, 0, 24, 40, 0, 0, "");
                    J.addAct(Eat, _list_Astro, 7, 0, 8, 0, 0, 0, "");
                    J.addAct(Eat, _list_Astro, 12, 0, 14, 0, 0, 0, "");
                    J.addAct(Eat, _list_Astro, 19, 0, 21, 0, 0, 0, "");
                    J.addAct(Private, _list_Astro, 8, 0, 12, 0, 0, 0, "");
                    J.addAct(Private, _list_Astro, 14, 0, 19, 0, 0, 0, "");
                    J.addAct(Private, _list_Astro, 21, 0, 23, 0, 0, 0, "");
                    Debug.WriteLine("/////" + _list_Astro.Count);

                    _list_Jour.Add(J);
                    i++;
                }
            }
            _docActXml = XDocument.Load("Astro_Activites.xml");

            foreach (Button B in panel_calendrier.Controls)
            {
                bttn_jour.Add(B);
            }

            foreach (Jour J in _list_Jour)
            {
                if (J.Num == (int)(_dateActu - _premierJour).TotalMinutes / 1480)
                    _jourActu = J;
            }

            InitBtn();
            InitBtnCent();
            InitBtnDix();
            SaveXml();
        }
示例#3
0
 private string InfoAct(ActJour A, Jour J)
 {
     string ch = "";
     ch += "Activité : " + A.Act.Nom+"\n";
     ch += "Jour : " + J.Num + "\n";
     ch += "Heure début : " + A.Heure + "H" + A.Min + "min\n";
     ch += "Heure fin : " + A.HeureFin + "H" + A.MinFin + "min";
     return ch;
 }