using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Windows; namespace GraphingCalculator { /// /// Interaction logic for App.xaml /// public partial class App : Application { protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); Log.LogEvent("Session started!"); } protected override void OnExit(ExitEventArgs e) { base.OnExit(e); Log.LogEvent("Session finished! Exit code: {0}", e.ApplicationExitCode); Log.LogEvent("-----------------"); try { if (!System.IO.Directory.Exists("logs")) System.IO.Directory.CreateDirectory("logs"); if (System.IO.File.Exists("logs\\graphingcalc.log")) System.IO.File.AppendAllLines("logs\\graphingcalc.log", Log.Entries.ToArray()); else System.IO.File.WriteAllLines("logs\\graphingcalc.log", Log.Entries.ToArray()); } catch { } // Save settings GraphingCalculator.Properties.Settings.Default.Save(); } } }