Ejemplo n.º 1
0
 private void Game_FlightProgressChanged(object sender, FlightProgressEventArgs e)
 {
     if (!planesUI.ContainsKey(e.AssociatedPlaneID))
     {
         return;
     }
     if (planesUI[e.AssociatedPlaneID].IsHandleCreated)
     {
         planesUI[e.AssociatedPlaneID].Invoke(new Action(() => planesUI[e.AssociatedPlaneID].CityName = e.TimeLeft.TotalMinutes > 0 ?
                                                                                                        "В полёте" : game.GetPlaneLocation(e.AssociatedPlaneID).Name));
         planesUI[e.AssociatedPlaneID].Invoke(new Action(() => planesUI[e.AssociatedPlaneID].Plane.status = e.TimeLeft.TotalMinutes > 0 ? "В полёте" :
                                                                                                            ""));
     }
     else
     {
         planesUI[e.AssociatedPlaneID].CityName = e.TimeLeft.TotalMinutes > 0 ?
                                                  "В полёте" : game.GetPlaneLocation(e.AssociatedPlaneID).Name;
         planesUI[e.AssociatedPlaneID].Plane.status = e.TimeLeft.TotalMinutes > 0 ?
                                                      "В полёте" : "";
     }
     if (e.AssociatedFlight.HasValue && contractsUI.ContainsKey(e.AssociatedFlight.Value))
     {
         if (contractsUI[e.AssociatedFlight.Value].IsHandleCreated)
         {
             contractsUI[e.AssociatedFlight.Value].Invoke(new Action(() =>
                                                                     contractsUI[e.AssociatedFlight.Value].TimeValue = e.TimeLeft));
         }
         else
         {
             contractsUI[e.AssociatedFlight.Value].TimeValue = e.TimeLeft;
         }
     }
 }
Ejemplo n.º 2
0
        private void FillPlanes(PlaneDataType type, UserScroll userScroll)
        {
            // основные характеристики
            int startX = 10, startY = 5;
            var obsplane = game.GetPlanes();

            foreach (var plane in game.GetPlanes())
            {
                PlaneData planeData = new PlaneData(type, game, cities, plane)
                {
                    PlaneName = plane.Model.ToString(),
                    CityName  = game.GetPlaneLocation(plane.ID) == null ? "-"
                    : game.GetPlaneLocation(plane.ID).Name,
                    SpeedValue       = plane.Speed,
                    DeprecationValue = plane.DeprecationDegree,
                    Location         = new Point(startX, startY),
                };
                startY += planeData.Height + 10;
                userScroll.GetPanel.Controls.Add(planeData);
            }
        }