private void timer1_Tick(object sender, EventArgs e)
        {
            systemtime++;
            LblTime.Text = "Time : " + systemtime;
            //update system

            if (queue.Count != 0 && !Is_serverBusy)
            {
                person current = queue[0];
                current.BeginService = systemtime;
                current.Delay        = current.BeginService - current.Arrival;
                serverperson         = current;
                queue.Remove(current);
                Is_serverBusy = true;
            }
            else
            {
                for (int i = 0; i < persons.Count; i++)
                {
                    person current = persons[i];
                    if (current.Arrival == systemtime)
                    {
                        if (!Is_serverBusy)
                        {
                            current.BeginService = systemtime;
                            current.Delay        = current.BeginService - current.Arrival;
                            serverperson         = current;
                            persons.Remove(current);
                            Is_serverBusy = true;
                        }
                        else
                        {
                            queue.Add(current);
                            persons.Remove(current);
                        }
                    }
                }
            }


            if (serverperson != null && serverperson.BeginService + serverperson.ServiceTime == systemtime)
            {
                serverperson.Done      = true;
                serverperson.Leave     = systemtime;
                serverperson.TotalWait = serverperson.Leave - serverperson.Arrival;
                result.Add(serverperson);
                serverperson  = null;
                Is_serverBusy = false;
            }

            g.Clear(Color.White);

            //draw queue
            g.DrawString("Queue", new Font(FontFamily.GenericSansSerif, 14f, FontStyle.Bold), MainPen.Brush, new PointF(380, 24));
            g.DrawRectangle(MainPen, new Rectangle(200, 50, 400, 100));

            //draw server
            g.DrawString("Server", new Font(FontFamily.GenericSansSerif, 14f, FontStyle.Bold), MainPen.Brush, new PointF(780, 290));
            g.DrawRectangle(MainPen, new Rectangle(700, 250, 200, 100));

            int X = 0;

            foreach (person perr in queue)
            {
                g.FillEllipse((new Pen(perr.Col)).Brush, new Rectangle(450 - X, 75, 50, 50));
                g.DrawString(perr.ID.ToString(), new Font(FontFamily.GenericSansSerif, 14f, FontStyle.Bold), (new Pen(Color.Black)).Brush, new PointF(475 - X, 100));
                X += 100;
            }
            if (Is_serverBusy)
            {
                g.FillEllipse((new Pen(serverperson.Col)).Brush, new Rectangle(680, 300, 50, 50));
                g.DrawString(serverperson.ID.ToString(), new Font(FontFamily.GenericSansSerif, 14f, FontStyle.Bold), (new Pen(Color.Black)).Brush, new PointF(705, 325));
            }

            int simend1 = (from e2 in persons where !e2.Done select e2).ToList <person>().Count;
            int simend2 = (from e2 in queue where !e2.Done select e2).ToList <person>().Count;

            if (simend1 == 0 && simend2 == 0 && serverperson == null)
            {
                timer1.Stop();
                UpdateStatistics();
            }
        }