예제 #1
0
        private void Move(object sender, EventArgs e)
        {
            int day   = currentDate.Day;
            int month = currentDate.Month;
            int year  = currentDate.Year;


            currentDate = currentDate.AddSeconds(CustomTimer.AddSecond);

            CustomTimer.Time = currentDate.ToLongTimeString();
            if (day < currentDate.Day || month < currentDate.Month || year < currentDate.Year)
            {
                InformDeparture.CountPassengerLastDay = 0;
                InformArrive.CountPassengerLastDay    = 0;
                InformForGrapfics.Clear();
                CustomTimer.Date = currentDate.ToShortDateString();
                initializeInfromForGraphic();
            }
            var loopResult = Parallel.ForEach <Flight>(Flights, CheckFlight);

            DeleteFlights();
            if (Flights.Count == 0)
            {
                CustomTimer.Stop();
                CustomTimer.Timer.Tick -= Move;
                CustomEvent.RaiseDelegate();
                // событие на остановку
            }
        }
예제 #2
0
 private void initializeInfromForGraphic()
 {
     for (int i = 0; i < 24; i++)
     {
         InformForGrapfics.Add(new InformForGrapfic()
         {
             Time = TimeSpan.FromHours(i)
         });
     }
 }