예제 #1
0
        public void InitGrid()
        {
            InitializeComponent();

            dataGridView1.Refresh();
            listBox1.Items.Clear();
            foreach(Astronaute A in _list_Astro)
            {
                listBox1.Items.Add(A.NomAstronaute);
            }
            listBox1.SelectedIndex = 0;

            foreach (Astronaute Astr in _list_Astro)
            {
                if (Astr.NomAstronaute == listBox1.SelectedItem.ToString())
                    AstroCourant = Astr;
            }
            InitGrid(AstroCourant);
        }
예제 #2
0
        public void InitGrid(Astronaute Astro)
        {
            int index = listBox1.SelectedIndex;
            InitializeComponent();
            listBox1.Items.Clear();
            foreach (Astronaute A in _list_Astro)
            {
                listBox1.Items.Add(A.NomAstronaute);
            }
            listBox1.SelectedIndex = index;
            foreach (ActJour A in _jourCourant.ListAct)
            {
                if (A.ListA.Contains(Astro))
                {

                    string txt = A.Heure + "H" + A.Min + "-" + A.Act.ToString();
                    if (A.Heure == A.HeureFin)
                        AddActBtn((A.Min / 10) + 1, A.Heure + 1, A.Duree / 10, 1, txt, A.Act);
                    else if (A.Min == 0 && A.MinFin == 0)
                    {
                        AddActBtn((A.Min / 10) + 1, A.Heure + 1, 6, A.HeureFin - A.Heure, txt, A.Act);
                    }
                    else
                    {
                        if (A.MinFin == 0)
                        {
                            AddActBtn((A.Min / 10) + 1, A.Heure + 1, (60 - A.Min) / 10, 1, txt, A.Act);

                            AddActBtn(1, A.Heure + 2, 6, A.HeureFin - A.Heure - 1, txt, A.Act);
                        }
                        else if (A.Min == 0)
                        {
                            AddActBtn(1, A.Heure + 1, 6, A.HeureFin - A.Heure, txt, A.Act);

                            AddActBtn(1, A.HeureFin + 1, (A.MinFin / 10) + 1, 1, txt, A.Act);

                        }
                        else
                        {
                            if (A.HeureFin - A.Heure >= 2)
                            {
                                AddActBtn((A.Min / 10) + 1, A.Heure + 1, 6, 1, txt, A.Act);

                                AddActBtn(1, A.Heure + 2, 6, A.HeureFin - A.Heure - 1, txt, A.Act);

                            }
                            else
                            {
                                AddActBtn((A.Min / 10) + 1, A.Heure + 1, (60 - A.Min) / 10, 1, txt, A.Act);

                            }
                            AddActBtn(1, A.HeureFin + 1, A.MinFin / 10, 1, txt, A.Act);

                        }
                    }
                }
                else
                {
                    Debug.WriteLine("pas d'act");
                }

            }
            dataGridView1.Refresh();
        }
예제 #3
0
 private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     foreach (Astronaute Astr in _list_Astro)
     {
         if (Astr.NomAstronaute == listBox1.SelectedItem.ToString())
             AstroCourant = Astr;
     }
     InitGrid(AstroCourant);
 }