Beispiel #1
0
 public List<Stand> GetStandsClientWasNotBefore(Client client)
 {
     List<Stand> listOfStands = new List<Stand>();
     foreach (var stand in this)
     {
         if (client.VisitedStands[stand.StandId] == false)
         {
             listOfStands.Add(stand);
         }
     }
     return listOfStands;
 }
 public void Push(Client newMember)
 {
     List<Client> tempQueue = ClientsInQueue;
     tempQueue.Add(newMember);
     ClientsInQueue = tempQueue;
 }
 public void Pull(Client client)
 {
     ClientsInQueue.Remove(client);
 }
Beispiel #4
0
        private void AddNewClients(object countOfNewClients)
        {
            int count = (int)countOfNewClients;
            lock (this.shopClients)
            {
                Random random = new Random();
                for (int i = 0; i < count; i++)
                {
                    Client client = new Client(this.shop);
                    shopClients.Push(client);
                    string line = String.Format("Client {0} was pushed to shop.", client.ClientID);
                    Logger.LogInfo(line);

                    int rnd = random.Next(1,8);
                    Image image = Image.FromFile(@"E:\GitHub\Multithreading-Shop\images\"+rnd+".bmp"); // read in image

                    Label lbl = new Label()
                    {
                        Text = client.ClientID.ToString(),
                        Location = new System.Drawing.Point(464, 16),
                        Tag = "Client"+client.ClientID,
                        Image = image,
                        ImageAlign = ContentAlignment.MiddleCenter,
                        TextAlign = ContentAlignment.MiddleRight,
                        AutoSize = false,
                        Size = new System.Drawing.Size(image.Width + 30, image.Height)
                        //Size = new Size(image.Width, image.Height)
                    };
                    if (this.InvokeRequired)
                    {
                        this.Invoke(new Action(() => this.Controls.Add(lbl)));
                    }
                    else
                    {
                        this.Controls.Add(lbl);
                    }
                    lock (lbl)
                    {
                        FindTag(this.Controls, null, "Client" + lbl.Tag, false, 1000);
                    }
                    //clientsRepresentation[client.ClientID].PerformLayout();

                    //rtb_LogText(line);
                }
            }
        }