[STAThread] // Needed for Windows Presentation Foundation (used for the menu) static void Main() { using (TrackViewer trackViewer = new TrackViewer()) { // code below is modified version from what is found in GameStateRunActivity.cs if (Debugger.IsAttached) // Separate code path during debugging, so IDE stops at the problem and not at the message. { trackViewer.Run(); } else { try { trackViewer.Run(); } catch (Exception error) { string errorSummary = error.GetType().FullName + ": " + error.Message; MessageBox.Show(String.Format( System.Globalization.CultureInfo.CurrentCulture, "A fatal error has occured and {0} cannot continue.\n\n" + " {1}\n\n" + "This error may be due to bad data or a bug. ", Application.ProductName, errorSummary), Application.ProductName, MessageBoxButtons.OKCancel, MessageBoxIcon.Error); } trackViewer.Exit(); } } }
[STAThread] // Needed for Windows Presentation Foundation (used for the menu) private static void Main(string[] args) { Application.SetHighDpiMode(HighDpiMode.PerMonitorV2); FileStream tvLogFile = File.Create("TrackViewerLog.txt"); TextWriterTraceListener TVtraceListener = new TextWriterTraceListener(tvLogFile); Trace.Listeners.Add(TVtraceListener); Trace.WriteLine("TrackViewer Starting"); using (TrackViewer trackViewer = new TrackViewer(args)) { // code below is modified version from what is found in GameStateRunActivity.cs if (Debugger.IsAttached) // Separate code path during debugging, so IDE stops at the problem and not at the message. { trackViewer.Run(); } else { try { trackViewer.Run(); } catch (Exception error) { string errorSummary = error.GetType().FullName + ": " + error.Message; MessageBox.Show(String.Format( System.Globalization.CultureInfo.CurrentCulture, "A fatal error has occured and {0} cannot continue.\n\n" + " {1}\n\n" + "This error may be due to bad data or a bug. ", Application.ProductName, errorSummary), Application.ProductName, MessageBoxButtons.OKCancel, MessageBoxIcon.Error); } trackViewer.Exit(); } } Trace.WriteLine("TrackViewer Ending"); Trace.Flush(); }