Exemplo n.º 1
0
 private void AjouterExec()
 {
     foreach (ProduitViewModel item in PanierList)
     {
         if (item.Nom == Nom)
         {
             if (Ready.Contains(item))
             {
                 foreach (ProduitViewModel ReadyContent in Ready)
                 {
                     if (item.ProduitId == ReadyContent.ProduitId)
                     {
                         ReadyContent.Quantite += Quantite;
                         ReadyContent.TestPrix += Prix;
                         PrixTotal             += Prix;
                         Quantite = 1;
                         Prix     = PrixSimple;
                     }
                 }
                 ;
             }
             else
             {
                 item.Quantite = Quantite;
                 Prix          = item.Prix * Quantite;
                 item.TestPrix = Prix;
                 PrixTotal    += Prix;
                 Ready.Add(item);
                 Prix     = PrixSimple;
                 Quantite = 1;
             }
         }
     }
 }
Exemplo n.º 2
0
        // prebacujemo onaj proces koji je najvise koristio CPU
        public void RunningToReady()
        {
            int     cpu = 0;
            Process p   = null;

            foreach (Process pr in this.Running)
            {
                if (pr.CPU_usage >= cpu)
                {
                    cpu = pr.CPU_usage;
                    p   = pr;
                }
            }

            if (p == null || Running.Count == 0)
            {
                //Console.WriteLine("No running process.");
            }
            else
            {
                p.Status = "Ready";
                Running.Remove(p);
                Ready.Add(p);
                //Console.WriteLine("RunningTOReady");
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Marks a player as ready.
 /// </summary>
 /// <param name="player">Player to mark ready.</param>
 public bool MarkPlayerReady(SocketGuildUser player)
 {
     if (Attending.ContainsKey(player))
     {
         Ready.Add(player, Attending[player]);
         Attending.Remove(player);
         return(true);
     }
     return(false);
 }
Exemplo n.º 4
0
 private void addToReady()
 {
     System.Threading.Thread.Sleep(5000);
     foreach (Cargo i in WaitingFor)
     {
         int temp = (i.DeliveryTime * 1000);
         System.Threading.Thread.Sleep(temp);
         App.Current.Dispatcher.Invoke((Action) delegate
         {
             Ready.Add(i);
         });
     }
 }
Exemplo n.º 5
0
        public void Prepare()
        {
            //Tasks.Sort(new TaskComparerLinkCount());
            Tasks.Sort(new TaskComparerOrdinal());

            foreach (var task in Tasks)
            {
                if (task.IncomingAllFulfilled)
                {
                    Ready.Add(task);
                }
            }
            Point = Start;
        }
Exemplo n.º 6
0
        public void Step()
        {
            if (InProgress != null)
            {
                if (InProgress.Done)
                {
                    InProgress = null;
                }
                else if (InProgressTime == ExecTime)
                {
                    Ready.Add(InProgress);
                    InProgress = null;
                }
            }

            for (int i = 0; i < Tasks.Count; i++)
            {
                if (Tasks[i].LaunchTime == Time)
                {
                    Ready.Add(Tasks[i]);
                    Tasks.RemoveAt(i--);
                }
            }

            if (Time % PriorityUpdateInterval == 0)
            {
                UpdatePriorities();
            }

            Ready.Sort();

            if (InProgress == null && Ready.Count > 0)
            {
                InProgress = Ready.Last();
                Ready.Remove(InProgress);
                InProgressTime = 0;
            }

            if (InProgress != null)
            {
                InProgress.Execute(1);
                InProgressTime++;
            }

            if (Logging)
            {
                List <string> readyTasks = new List <string>();
                foreach (var task in Ready)
                {
                    readyTasks.Add(task.Name);
                }

                string inProg = "";
                if (InProgress != null)
                {
                    inProg = InProgress.Name;
                }
                LogTable.Add(new LogNode(Time, inProg, readyTasks));
            }

            Time++;
        }
Exemplo n.º 7
0
        public void NewProcess(String Name)
        {
            Process p = new Process(Name);

            Ready.Add(p);
        }