-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.xaml.cs
More file actions
65 lines (59 loc) · 1.89 KB
/
App.xaml.cs
File metadata and controls
65 lines (59 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using AsusFanControl.Infrastructure;
using System.Configuration;
using System.Data;
using System.Windows;
using Microsoft.EntityFrameworkCore;
using AsusFanControl.Model;
namespace AsusFanControl
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
try
{
using (var db = new AppDbContext())
{
db.Database.EnsureCreated();
if (db.Setting.Any() == false)
{
var graph = new Graph()
{
Name = "По умолчанию",
GraphPoints = new List<GraphPoint>
{
new (30,30),
new (40,40),
new (57,45),
new (64,56),
new (70,60),
new (80,80),
new (90,95),
new (100,96),
}
};
db.Graph.Add(graph);
var setting = new AppSetting()
{
SensorInfoEnabled = true,
FanAutoState = true,
FanMode = Model.Enums.StatusMode.Soft,
FanPower = 50,
SelectedGraph = graph
};
db.Setting.Add(setting);
}
db.SaveChanges();
}
}
catch (Exception ex)
{
Logger.Log(ex.Message);
}
base.OnStartup(e);
}
}
}