Files
ucalc/ucalc/App.xaml.cs
T
Tobias Erbshäußer 17ff9d0c0b Fixed bugs the following bugs:
* Opening the cost overview could lead to a crash if a cost entry did not cover all tenants.
* The amount in the unit calculation window was not updated when changes were made.
* After creation of a new billing the main window could be closed without getting a save dialog.

Added autosave functionality.
2021-04-06 13:41:41 +02:00

31 lines
954 B
C#

using System;
using System.IO;
using System.Windows;
using UCalc.Data;
namespace UCalc
{
public partial class App
{
private readonly RecentlyOpenedList _recentlyOpenedList;
private readonly Autosaver _autosaver;
public static RecentlyOpenedList RecentlyOpenedList => ((App) Current)._recentlyOpenedList;
public static Autosaver Autosaver => ((App) Current)._autosaver;
public App()
{
var appDataPath = $"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}/UCalc";
Directory.CreateDirectory(appDataPath);
_recentlyOpenedList = new RecentlyOpenedList($"{appDataPath}/recently.txt");
_autosaver = new Autosaver($"{appDataPath}/running.txt", $"{appDataPath}/autosave.mr");
}
protected override void OnExit(ExitEventArgs e)
{
_autosaver.OnExit();
base.OnExit(e);
}
}
}