static int Main(string[] arguments) { // set thread name for debugging Thread.CurrentThread.Name = "Program main thread"; //Application.ThreadException += Application_ThreadException; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var appContext = new MyApplicationContext(); Application.Run(appContext); var exitCode = appContext.ExitCode; appContext.Dispose(); BasicGoogleTelemetry.SendScreenHit("ChannelList_Main: End"); BasicGoogleTelemetry.ManageSession(true); BasicGoogleTelemetry.EnsureHitsSents(); // Ensure all background threads end right now (like updating the EPG data with EpgDownloader) // TODO: Don't to this Thread.Sleep(1000); Environment.Exit(exitCode); return(exitCode); } // Main