private async void GracefullyExit() { Memory.TokenSource.Cancel(); // tell task we are done //step0. dispose stop sounds Module_movie_test.Reset(); init_debugger_Audio.StopMusic(); init_debugger_Audio.KillAudio(); //step1. kill init task. to prevent exceptions if exiting before fully loaded. await Memory.InitTask; // wait for task to finish what it's doing. }
private static async void GracefullyExit() { Memory.TokenSource.Cancel(); // tell task we are done //step0. dispose stop sounds Module_movie_test.Reset(); AV.Music.Stop(); AV.Music.KillAudio(); AV.Sound.KillAudio(); //step1. kill init task. to prevent exceptions if exiting before fully loaded. if (Memory.InitTask != null) { await Memory.InitTask; // wait for task to finish what it's doing. } }