Exemple #1
0
 /// <summary>
 /// Sent shut down signal to all drones
 /// </summary>
 public void ShutDownDrones()
 {
     foreach (CancellationTokenSource shutdownToken in DroneNavigationRoutinesActive)
     {
         shutdownToken.Cancel();
     }
     DroneNavigationRoutinesActive.Clear();
 }
Exemple #2
0
        /// <summary>
        /// Power on all dispatcher's drones and starts their navigation routines
        /// </summary>
        public void StartDronesNavigationRoutine()
        {
            foreach (Drone drone in Drones)
            {
                var droneShutdownCancellationSource = new CancellationTokenSource();
                var droneShutdownToken = droneShutdownCancellationSource.Token;
                DroneNavigationRoutinesActive.Add(droneShutdownCancellationSource);

                Task.Run(() => PerformNavigationRoutine(drone, droneShutdownToken), droneShutdownToken);
            }
        }