void messageTimer_Tick(object sender, EventArgs e) { Application.Current.Dispatcher.BeginInvoke((Action) delegate { if (synchron == true) { num_text.Text = (T - 1).ToString(); } Derl.Add(""); derlo.Text = Derl[Convert.ToInt32(num_text.Text)]; text.Text = T++.ToString(); ColorAnimation myColorAnimation = new ColorAnimation(); //myColorAnimation.From = Colors.Cyan; Random r = new Random(); timeclr.R = (byte)r.Next(0, 50); timeclr.G = (byte)r.Next(150, 256); timeclr.B = (byte)r.Next(120, 200); myColorAnimation.To = Color.FromRgb(timeclr.R, timeclr.G, timeclr.B); myColorAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(3000)); // DoubleAnimation db2 = new DoubleAnimation(0, 100, TimeSpan.FromMilliseconds(2000)); timeE.BeginAnimation(Ellipse.StrokeThicknessProperty, db2); // Apply the animation to the brush's Color property. timeE.Stroke.BeginAnimation(SolidColorBrush.ColorProperty, myColorAnimation); // ColorAnimation textanime = new ColorAnimation(Colors.Black, Colors.White, TimeSpan.FromMilliseconds(1000)); DoubleAnimation db = new DoubleAnimation(100 - m.calcul_esplibre(), TimeSpan.FromMilliseconds(1000)); taille_lib.Text = m.calcul_esplibre().ToString() + "%"; frag.Text = "l'espace libre fragmenté : " + m.frag; int vitfe = 0; int ttl = 0; while (vitfe < m.list_zone_libre.Count()) { ttl += m.list_zone_libre[vitfe] / 1000; vitfe++; } libt.Text = "l'espace utilisable : " + ttl; esp_libre.BeginAnimation(Ellipse.StrokeThicknessProperty, db); // DoubleAnimation db1 = new DoubleAnimation(100 - proc.calcul_en_cours(), TimeSpan.FromMilliseconds(1000)); cours.BeginAnimation(Rectangle.HeightProperty, db1); en_courstext.Text = proc.en_cours.Count.ToString(); Canvas.SetTop(en_courstext, 135 - proc.calcul_en_cours()); //les state de la fifo DoubleAnimation db3 = new DoubleAnimation(100 - proc.calcul_fifo(), TimeSpan.FromMilliseconds(1000)); hover.BeginAnimation(Rectangle.HeightProperty, db3); fifotext.Text = proc.fifo.Count.ToString(); Canvas.SetTop(fifotext, 135 - proc.calcul_fifo()); // DoubleAnimation db4 = new DoubleAnimation(100 - proc.calcul_finis(), TimeSpan.FromMilliseconds(1000)); finishov.BeginAnimation(Rectangle.HeightProperty, db4); finistext.Text = proc.get_finis().ToString(); Canvas.SetTop(finistext, 135 - proc.calcul_finis()); }); Application.Current.Dispatcher.Invoke((Action) delegate { cn.Children.Clear(); Sta.Children.Clear(); }); Application.Current.Dispatcher.Invoke((Action) delegate { if (m != null) { if (un_plus == 0) { proc.CreateACircle_2(m, cn); } else { proc.CreateACircle(proc.fifo, cn); } m.afficher(cn, proc); /*proc.lilster_pro(Sta, choix_process);*/ proc.afficher_encours(Sta, choix_process); } }); if (un_plus == 0) { proc.plusieurs_fifo(m); } else { proc.une_file_rnd(m, Derl); } }
public void OnTimedEvent(Object source, EventArgs e) { int i = -1; Application.Current.Dispatcher.BeginInvoke((Action) delegate { if (synchron == true) { num_text.Text = (T - 1).ToString(); } Derl.Add(""); derlo.Text = Derl[Convert.ToInt32(num_text.Text)]; text.Text = T++.ToString(); ColorAnimation myColorAnimation = new ColorAnimation(); //myColorAnimation.From = Colors.Cyan; Random r = new Random(); timeclr.R = (byte)r.Next(0, 50); timeclr.G = (byte)r.Next(150, 256); timeclr.B = (byte)r.Next(120, 200); myColorAnimation.To = Color.FromRgb(timeclr.R, timeclr.G, timeclr.B); myColorAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(3000)); // DoubleAnimation db2 = new DoubleAnimation(0, 50, TimeSpan.FromMilliseconds(2000)); timeE.BeginAnimation(Ellipse.StrokeThicknessProperty, db2); // Apply the animation to the brush's Color property. timeE.Stroke.BeginAnimation(SolidColorBrush.ColorProperty, myColorAnimation); // ColorAnimation textanime = new ColorAnimation(Colors.Black, Colors.White, TimeSpan.FromMilliseconds(1000)); DoubleAnimation db = new DoubleAnimation((mem.capacite - mem.calcul_esplibre()) * 100 / mem.capacite / 2, TimeSpan.FromMilliseconds(1000)); taille_lib.Text = (mem.calcul_esplibre() * 100 / mem.capacite).ToString() + "%"; esp_libre.BeginAnimation(Ellipse.StrokeThicknessProperty, db); // DoubleAnimation db1 = new DoubleAnimation(100 - pro.calcul_en_cours(), TimeSpan.FromMilliseconds(1000)); cours.BeginAnimation(Rectangle.HeightProperty, db1); en_courstext.Text = pro.en_cours.Count.ToString(); Canvas.SetTop(en_courstext, 135 - pro.calcul_en_cours()); //les state de la fifo DoubleAnimation db3 = new DoubleAnimation(100 - pro.calcul_fifo(), TimeSpan.FromMilliseconds(1000)); hover.BeginAnimation(Rectangle.HeightProperty, db3); fifotext.Text = pro.fifo.Count.ToString(); Canvas.SetTop(fifotext, 135 - pro.calcul_fifo()); // DoubleAnimation db4 = new DoubleAnimation(100 - pro.calcul_finis(), TimeSpan.FromMilliseconds(1000)); finishov.BeginAnimation(Rectangle.HeightProperty, db4); finistext.Text = pro.get_finis().ToString(); Canvas.SetTop(finistext, 135 - pro.calcul_finis()); }); Application.Current.Dispatcher.Invoke((Action) delegate { ram1.Children.Clear(); Sta.Children.Clear(); }); string d = ""; while (true) { i++; if (i >= pro.en_cours.Count) { break; } pro.en_cours[i].Set_time(pro.en_cours[i].Get_temps() - 1); if (pro.en_cours[i].Get_temps() == 0) { Derl[T - 1] += ">>>> le processus <" + pro.en_cours[i].name + "> est libere de lemplacement<" + pro.en_cours[i].Get_part() + ">\n\n"; pro.corriger_prt(pro.en_cours[i].Get_part(), mem.Liberation_part(pro.en_cours[i].Get_part())); pro.finish(pro.en_cours[i].Get_id()); pro.check_fifo(mem, ref d, P); Derl[T - 1] += d; i--; } } Application.Current.Dispatcher.Invoke((Action) delegate { mem.afficher(ram1, pro); pro.afficher_fifo(ram1); pro.afficher_encours(Sta, param); }); }