示例#1
0
        private void ClockTimer_Tick(object sender, EventArgs e)
        {
            var elapsedTime = model.GetStopwatchElapsedTime();

            clock.Text = string.Format("{0:00}:{1:00}:{2:00}",
                                       elapsedTime.Minutes, elapsedTime.Seconds, elapsedTime.Milliseconds / 10);
        }
示例#2
0
        public void AddAircraft(AircraftType type, AircraftFlow flow, int trackId, Action <Control> addControl)
        {
            var aircrafts = Aircrafts[type];

            var id        = 0;
            var entryTime = $"{Math.Round(model.GetStopwatchElapsedTime().TotalSeconds)}";

            if (aircrafts.Count > 0)
            {
                id = aircrafts[aircrafts.Keys.Max(key => key)].Id + 1;
            }

            var name     = AircraftOptions.Names[type];
            var velocity = AircraftOptions.AircraftVelocities[type];
            var image    = new Bitmap(AircraftOptions.ImagePaths[type]);
            var path     = AircraftPaths[flow][type][trackId];

            aircrafts.Add(id, new Aircraft(type, id, name, velocity, entryTime, image,
                                           AircraftOptions.AircraftsImageSizes[type], trackId, path));
            addControl(aircrafts[aircrafts.Keys.Max(key => key)].InfoForm);
            aircrafts.Last().Value.InfoForm.BringToFront();
        }