math-suite/Source/GraphingCalculator/App.xaml.cs

43 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
namespace GraphingCalculator
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
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();
}
}
}